list all shaders with the same name [SOLVED]



  • On 08/01/2015 at 04:47, xxxxxxxx wrote:

    is there a function which is able to list all shaders with the same name and change values of it?



  • On 08/01/2015 at 07:02, xxxxxxxx wrote:

    Hello,

    in Cinema 4D, shaders are stored with objects. So you can iterate through all materials and iterate through all shaders of a material to get all shaders and work with them:

      
      mat = doc.GetFirstMaterial()  
       
      while mat:  
      
          shader = mat.GetFirstShader()  
            
          while shader:  
                
              print(shader.GetName())  
                
              shader = shader.GetNext()  
            
          mat = mat.GetNext()  
    

    best wishes,
    Sebastian



  • On 08/01/2015 at 08:16, xxxxxxxx wrote:

    cool!

    i need this for a python effector. is there a way to check only materials assigned to objects beneath a cloner to avoid searching all shaders in a scene.

    another feature would be refresh / search only on value change ?



  • On 08/01/2015 at 09:14, xxxxxxxx wrote:

    Hello,

    to get the material used by an object you have access the object's TextureTag. Then you can get this tag's material using GetMaterial(). This way you can get the materials used by a certain group of objects.

    What do you mean with "refresh / search only on value change"?

    For questions no longer related to this thread's original topic please open a new thread. Thanks.

    Best wishes,
    Sebastian


Log in to reply