Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    list all shaders with the same name [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 358 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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 ?

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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[URL-REMOVED]. Then you can get this tag's material using GetMaterial()[URL-REMOVED]. 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


            [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post