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

    Layer Browser

    Scheduled Pinned Locked Moved PYTHON Development
    8 Posts 0 Posters 1.4k 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 15/03/2011 at 04:51, xxxxxxxx wrote:

      Hi everyone,
       
      I'm looking for a way to access the switches on the active layer in the Layer Browser.
       
      Is this possible?
       
      I'm just starting out with Python for C4D, so a lot of this is very new to me.
       
      Thanks.

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 15/03/2011 at 07:02, xxxxxxxx wrote:

        You can use doc.GetLayerObjectRoot() to access the root of layers (only call GetDown() here!!).
        If root.GetDown()!=None layers exist in the document, otherwise not. You can browse the hierarchy
        of layers and check GetBit(c4d.BIT_ACTIVE) on each layer if its enabled.

        Cheers, Sebastian

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 15/03/2011 at 07:24, xxxxxxxx wrote:

          Thanks, that got me access to the layer name at least. Phew!
           
          This is what I have so far:

          import c4d, math, random  
          from c4d import bitmaps, documents, gui, modules, plugins, storage, utils  
            
          def main() :  
              c4d.CallCommand(100004738) # New Layer  
              root = doc.GetLayerObjectRoot()  
            
              root.GetDown().SetName("NEWLAYER")
                
          if __name__ == '__main__':  
          main()
          

          What I'm trying to do is change the switches on the layer, like Solo, Visible, etc.
           
          I think I need to use SetLayerData, but cannot for the life of me get it to work.
           
          Also, is  there a more elegant way to create a layer other than CallCommand?

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 15/03/2011 at 22:33, xxxxxxxx wrote:

            Hello.  I found this bit of code on CGSociety.  I cannot get it to work though.  Neither can I find any documentation about ID_LAYER_LINK.
             
            Can anyone help me out here?

            def main() :  
            	    obj = doc.GetActiveObject()  
            	    layer = obj[c4d.ID_LAYER_LINK]  
            	    color = layer[c4d.ID_LAYER_COLOR] = c4d.Vector(0,0,0)# Sets layer color to black  
            	    c4d.EventAdd()  
            	    print color
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 16/03/2011 at 01:38, xxxxxxxx wrote:

              I am (95%) convinced that GetLayerData and SetLayerData are not implemented yet.  Can anyone please confirm this?
               
              Using this code:

              import c4d, math, random  
              from c4d import*
               
              def main() :         
                c4d.CallCommand(100004738) # New Layer  
                c4d.CallCommand(100004736) # Add Objects to Layer      
                  
                lay = op.GetLayerObject(doc)  
                lay.SetName("NEWLAYER")  
                lay.GetLayerData(doc, True)  
                  
                c4d.EventAdd()
               
              if __name__ == '__main__':      
                main()
              

              throws the error "AttributeError: 'c4d.documents.LayerObject' object has no attribute 'GetLayerData'"
              **** 
              Am I using it incorrectly?

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 16/03/2011 at 02:34, xxxxxxxx wrote:

                Yes, these methods are currently not implemented yet.

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 16/03/2011 at 03:54, xxxxxxxx wrote:

                  Thanks again.
                   
                  I'm curious how a newcomer is supposed to accomplish anything when the documentation is so badly misleading.  The earlier function GetLayerObjectRoot() that you mentioned doesn't even exist in the docs, even though it's implemented. The reverse is true for Set and GetLayerData.  They're in the docs, but don't actually exist.
                   
                  Am I looking at the wrong docs?  How is it that you are aware of these things? Are you a Maxon developer?

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 16/03/2011 at 04:14, xxxxxxxx wrote:

                    Please note, the current documentation is still preliminary and will be updated. If a function is not part of the documentation, it was added in the latest C4D update.

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