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

    Layers Options

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 847 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 12/07/2011 at 13:20, xxxxxxxx wrote:

      I'm having a hard time figuring out the proper Baselist2D object needed to access the options of a specific layer in the layer browser.

      I can create a layer, search for a layer, and select a layer.
      But once I have a Layer. I can't do anything with it :

      import c4d  
      from c4d import gui  
        
      def main() :  
        obj = doc.GetFirstObject()  
        root = doc.GetLayerObjectRoot()#Gets the layer manager  
        first = root.GetDown()         #Gets the first layer  
        first.SetBit(c4d.BIT_ACTIVE)   #Makes the first layer active  
        layers = obj[c4d.ID_LAYER_LINK]  
        
        #How do I get the right Baselist2D object  
        #So I can get at the various options(solo, view, render, manager, etc..)?  
        
        obj.GetLayerData(doc, True) #nope  
        root.GetLayerData(doc, True) #nope  
        first.GetLayerData(doc, True) #nope  
        layers.GetLayerData(doc, True) #nope  
        
      if __name__=='__main__':  
        main()
      

      Can anyone tell what the correct Baselist2D object is?

      -ScottA

      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 12/07/2011 at 23:38, xxxxxxxx wrote:

        """

        I can't test it right now, but I could imagine you can de-/activate the options using the layerobject's container.
        Try:

        import c4d  
          
        def **searchModule** (mod, what) :  
          d = mod.__dict__  
          for k in d:  
          if d[k] == what:  
            yield k  
          
        def **main** () :  
          lay = doc.GetLayerObjectRoot().GetDown()  
          bc = lay.GetDataInstance()  
          
          for i, e in bc:  
          d = searchModule(c4d, i)  
          d = tuple(d)  
          
          if d:  
            print "Matches for %s:" %i  
            for e in d:  
              print " " * 3, str(i).ljust(20), "c4d." + str(e)  
            print "- " * 20  
          
        main()
        

        I hope it works as expected, As already said, can't test it now.
        cheers,

        // Edit: I expected some entries in the contianer of this BaseList2D Object, but there are None..
        I'm sorry, can't help you here, don't know what to do here, too.

        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 13/07/2011 at 07:22, xxxxxxxx wrote:

          Thanks. That does sort of help. In a round about way.
          I found an old thread where Sebastian said that the GetLayerData() function wasn't supported yet. Even though it was listed in the docs.

          So I have a hunch that this function is still missing from python.
          Your method resulting in nothing supports my theory that it's still not supported.
          I guess layers are still not supported yet.

          In the mean time. I'll have to do my layer stuff in C++.

          -ScottA

          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 31/07/2011 at 18:19, xxxxxxxx wrote:

            um what do you actually want to do because from your first post it seems you just want to access the various settings of an individual layer like (solo, view, render, manager, etc..)

            well this works for me:

            doc = c4d.documents.GetActiveDocument()
                root = doc.GetLayerObjectRoot()#Gets the layer manager
                first = root.GetDown()         #Gets the first layer
                print first.GetName() #layer Name
                print first[c4d.ID_LAYER_SOLO] #print layer solo setting
                print first[c4d.ID_LAYER_VIEW] #print layer view setting
                #ect........................
                first[c4d.ID_LAYER_SOLO] = False #set layer solo setting
                first[c4d.ID_LAYER_VIEW] = False #set layer view setting
                #ect........................
                c4d.EventAdd()

            Just thought i would post a reply incase it helps anyone else.

            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 01/08/2011 at 02:17, xxxxxxxx wrote:

              This is confusing !
              It works, yes. But why are the values not stored in the Container ?
              There must be a bug anywhere. Either GetDataInstance() does not return the right container or the values are not stored in the container. 😵

              Thanks tundras

              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 01/08/2011 at 08:07, xxxxxxxx wrote:

                Thanks tundras.

                -ScottA

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