Announcement

Collapse
No announcement yet.

Quick help with V-Ray example python script

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

  • Quick help with V-Ray example python script

    Hi,

    I really don't know anything about python, so was just wondering on how to modify your example script:

    from vray.utils import *

    l=findByType("Node") # Get all Node plugins
    p=l[0].get("material") # Get the material of the first node
    brdf=p.get("brdf") # Get the BRDF for the material
    brdf.set("color_tex", Color(.5, .5, .5)) # Set the BRDF color to red
    How do I get the line below to change ALL materials in the scene, not just the first node?

    p=l[0].get("material") # Get the material of the first node
    And second part, how does one issue a command to get this to appear in the "Post Translate Python Script" area in the GUI.

    So basic I know!
    Maya 2020/2022
    Win 10x64
    Vray 5

  • #2
    Do you want to override all materials with a grey color?

    Best regards,
    Vlado
    I only act like I know everything, Rogers.

    Comment


    • #3
      Hi,

      Yes Vlado.

      I know it's possible with Maya's Render Layers but I consider it too much of a risk to use in projects because it breaks.

      Doing this post translate would be the safest bet.
      Maya 2020/2022
      Win 10x64
      Vray 5

      Comment


      • #4
        Try this one:
        Code:
        from vray.utils import *
        
        # create a grey BRDF
        greyBrdf=create("BRDFDiffuse", "greyBrdf")
        greyBrdf.set("color", Color(0.5, 0.5, 0.5))
        
        # set the material of all scene nodes
        sceneNodes=findByType("Node") # Get all Node plugins
        for node in sceneNodes: # for each node
        	node.set("material", greyBrdf)
        Best regards,
        Vlado
        I only act like I know everything, Rogers.

        Comment


        • #5
          Many thanks Vlado!
          Maya 2020/2022
          Win 10x64
          Vray 5

          Comment

          Working...
          X