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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Problems with Default Specular Layer? [SOLVED]

    SDK Help
    0
    3
    364
    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
      Helper
      last edited by

      On 21/02/2017 at 04:51, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R17.055 
      Platform:   Windows  ;   
      Language(s) :       PYTHON  ;

      ---------
      Hi,guys.
        I want to change some parameters of the Default Specular Layer in C4D R17,but it's not working,I don't know why?

      Here is the code below:

        
      import c4d  
      from c4d import gui  
        
        
      def main() :  
        doc.StartUndo()  
        mats = doc.GetActiveMaterials()  
        if not mats:  
            return  
        for mat in mats:  
            mat[c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION] = 3  
            mat[c4d.REFLECTION_LAYER_MAIN_ADDITIVE] = 0  
            doc.AddUndo(c4d.UNDOTYPE_CHANGE,mat)  
              
        doc.EndUndo()  
        c4d.EventAdd()  
              
        
      if __name__=='__main__':  
        main()  
      

      Thank you for any help!

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

        On 21/02/2017 at 09:43, xxxxxxxx wrote:

        It's been a while since I worked with materials in Python, but if I remember correctly you need to add the layerID to your atrribute index

          
          
              reflayer = mat.GetReflectionLayerIndex(idx)  
              mat[c4d.REFLECTION_LAYER_MAIN_DISTRIBUTION + reflayer.GetDataID()] = 3  
          
        
        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 21/02/2017 at 17:48, xxxxxxxx wrote:

          Thanks C4DS.
          You are talented!👍 It's working now.

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