Announcement

Collapse
No announcement yet.

Materials lost when importing / inserting / pasting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Materials lost when importing / inserting / pasting

    I'm trying to cut and paste from one project to another and while the objects and layers are imported correctly, the vray materials are not imported.
    Similarly when I export a selection and open the exported file, all the materials are gone.
    The projects where created with vray 2.0
    The problem does not occur with brand new vray3 scenes or if I create a new material in an old scene, apply it to an object and export. Then opening the exported object file has retained the material.
    That is a huge problem as it requires to re-create all the materials affecting the objects to export/import or cut/paste).
    There needs to be a better compatibility with the scenes created with vray 2. Obviously there's WAY more projects created in vray 2 than any brand new projects created since vray 3 hit the market.
    This is unacceptable. I would understand if they were projects from vray version 1 or 1.5, I get that, but vray 2 which was the main renderer for many of us just months ago .... ?
    Is there some sort of script that validates all vray 2 materials to be properly accepted by vray 3?

    Also, when working on a scene created with vray 2, the changes in the diffuse layer don't reflect in the viewport when in rendered view mode. For example if I change the color from white to red, the viewport keeps showing the object white despite rendering correctly in red.
    Ready to dump vray 3 and stick with 2, frankly. Way too many bugs ! (Rant ...)

    EDIT: I've just read this post and it seems to confirm these issues ....
    Last edited by palosanto; 14-09-2018, 09:27 AM.
    www.marinevisuals.com
    3D Visualization for the Marine Industry

  • #2
    Hi,

    The issue seems to be reproducible only when a material has been applied to a layer.

    As a workaround, you could run the following Python script in Rhino (EditPythonScript), which will convert the source of all materials in the project that use the setting 'Use Layer Material' to 'Use Plug-in' instead. This change from layer source to object source will resolve the issue when you copy and paste an object from one file to another.

    import scriptcontext as sc
    import Rhino.DocObjects

    for layer in sc.doc.Layers:
    objs = list(filter(lambda obj : obj.Attributes.LayerIndex == layer.LayerIndex and obj.Attributes.MaterialSource == Rhino.DocObjects.ObjectMaterialSource.MaterialFrom Layer, sc.doc.Objects))
    for o in objs:
    o.Attributes.MaterialSource = Rhino.DocObjects.ObjectMaterialSource.MaterialFrom Object
    o.Attributes.MaterialIndex = layer.RenderMaterialIndex
    o.CommitChanges()

    sc.doc.Views.Redraw()
    Attached Files
    Last edited by georgi.georgiev; 20-09-2018, 09:32 AM.

    Comment


    • #3
      Originally posted by georgi.georgiev View Post
      Hi,

      The issue seems to be reproducible only when a material has been applied to a layer. [/I]
      Thanks Georgi,
      Any way to keep the selection from the script and be able to reverse the process once the objects have been imported or pasted so that their materials can be assigned back to bylayer ?
      www.marinevisuals.com
      3D Visualization for the Marine Industry

      Comment


      • #4
        Hello, Juan,

        Simplest way would be to:
        1. Run the script
        2. Copy & paste the objects wherever you need them
        3. Use the Undo command to revert the change caused by the script. (you'll notice a command line will confirm the action, e.g. Undoing RunPythonScript)


        Misunderstood your last post. If the copied objects' layers already exist in the project they are pasted in, then it is not possible to automatically reassign the materials (has to be redone manually).
        However, if the objects' layers do not exist in the other project, the layers can be transferred with its state.
        To make it more, clear, here is the complete solution:

        You have project A with objects in layers L1 and L2 (with Mtl1 and Mtl2 applied on each layer respectively)
        You open project B and wish to transfer the objects from project A with their materials assigned by layer

        1. Copy objects from project A's L1 and L2 and paste them in project B
        2. The L1 and L2 layers will appear correctly in project B, however, due to the bug in V-Ray, the Asset Editor will not be populated with Mtl1 and Mtl2
        3. Run the provided script in project A. Then copy the objects from Layers L1 and L2 to project B.
        4. Undo the last command (runPythonScript) in project A.
        5. Select the copied objects in project B and set their material source from "object" back to "layer"

        Kind regards,
        Peter
        Last edited by Peter.Chaushev; 21-09-2018, 03:58 AM.
        Peter Chaushev
        V-Ray for SketchUp | V-Ray for Rhino | Product Owner
        www.chaos.com

        Comment


        • #5
          Hi Peter,
          If the copied objects' layers already exist in the project they are pasted in, then it is not possible to automatically reassign the materials (has to be redone manually).
          This would not be usually a problem because usually the layers have already the same materials from one project another.

          However, unfortunately the workaround described will only work partially because step 5 will set all objects pasted in project B to 'layer' including the ones that were originally already set to "object" or "parent".
          That's why I was asking earlier if there's a way to keep the object selection filtered by the script as 'bylayer' in project A so that once we are in project B only those objects are set to bylayer and the others retain their original material attribute as by 'object' or 'parent'.
          www.marinevisuals.com
          3D Visualization for the Marine Industry

          Comment


          • #6
            We have this occurring also. I usually apply texture by object, so I don't think the script will help.
            One of our designers just sent me this email with the same issue:

            "I had a model crash and a recover file was created. This new file striped out all of the materials from the library but when I select an object it still tells me what material is applied…..but no editing ability. Also when I render the images that are very dim, as if the lighting was turned down.I tried coping and pasting into a new scene but that didn’t work."

            Does anyone have any suggestions?

            Comment

            Working...
            X