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

    Turning Reflectance Layers On / Off

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 548 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 15/10/2014 at 17:34, xxxxxxxx wrote:

      Hey there!

      Is there a way to turn on / off different layers in the Reflectance channel using the Python API?  I want to be able to toggle the eyeball switch on my Specular layer based on some User Data.  Any help would be greatly appreciated.

      Thanks!

      joey

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

        On 16/10/2014 at 07:15, xxxxxxxx wrote:

        Hello,

        Reflectance is currently not supported by the Python API. You can only access it with the C++ Material class[URL-REMOVED].

        Best wishes,
        Sebastian


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

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

          On 10/10/2017 at 18:05, xxxxxxxx wrote:

          This is now possible.

            
          """Name-US: Toggle Reflectance   
          Description-US: Toggle the first reflectance layer on/off.   
          """   
            
          import c4d   
          from c4d import gui   
            
          def main() :   
              mat = doc.GetActiveMaterial()   
              if not mat:   
                  return   
                 
              doc.StartUndo()   
              doc.AddUndo(c4d.UNDOTYPE_CHANGE, mat)   
                 
              layer = mat.GetReflectionLayerIndex(0) # Get the top-most layer   
              if not layer:   
                  return   
                 
              flags = layer.GetFlags()   
              if flags is None:   
                  return   
                 
              active_toggled_flags = flags ^ c4d.REFLECTION_FLAG_ACTIVE   
              layer.SetFlags(active_toggled_flags)   
                 
              doc.EndUndo()   
              c4d.EventAdd()   
            
          if __name__=='__main__':   
              main()   
          
          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 05/11/2017 at 05:59, xxxxxxxx wrote:

            thanks for the update, is it now possible to enable/disable individual Reflectance Layers in Xpressso?

            My hack is going to be just to turn the Brightness to 0% otherwise lol

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

              On 06/11/2017 at 02:41, xxxxxxxx wrote:

              Hello,

              the activity state of a reflectance layer is stored in a flag, not a parameter. So I'm afraid it is not possible to edit this value using XPresso.

              best wishes,
              Sebastian

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

                On 07/11/2017 at 05:44, xxxxxxxx wrote:

                Hey,

                Thanks for the answer.  I did test using Xpresso to turn the Brightness of the Color channel to 0% and it works the same as turning the flag to 0.  Or at least it Renders the same, not sure on the back end.

                I need to get back into Python and C++ again.  Xpresso can do so much though.

                Cheers,

                Matt

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