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 questions

    Scheduled Pinned Locked Moved SDK Help
    8 Posts 0 Posters 730 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 10/09/2007 at 19:45, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   10.111 
      Platform:      
      Language(s) :     C++  ;

      ---------
      Hi,

      A couple quick questions about the layer browser:

      First, how to get access to the layer browser when no objects have been assigned a layer.

      LayerObject* layer = obj->GetLayerObject(bDoc); works, of course, when an object has a layer assigned. But, for example, if I have a new scene with no objects, and 4 layers, how do I get access to the first layer?

      Second question is how to return the data from the layers (solo, view, render, manager, etc...). I've seen the LayerData page of the SDK. Just not sure how to implement that.

      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 11/09/2007 at 04:05, xxxxxxxx wrote:

        Isn´t there an example in the sdk folder for the layer browser? I remember there is.

        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 11/09/2007 at 21:05, xxxxxxxx wrote:

          Unless I'm mistaken, that's for the layer shader, not the layer browser for managing objects.

          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/09/2007 at 01:30, xxxxxxxx wrote:

            ah, sorry, absolutely my mistake. I am not working with R10 so I totally forgot there are scene layers now. 🙂 Sorry cannot help then.

            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 17/09/2007 at 03:36, xxxxxxxx wrote:

              You can access the layers directly through GetLayerObjectRoot(). It will give the list of layers for the document. Here is a little example that prints the name of the first layer.

                
              GeListHead *llist = doc->GetLayerObjectRoot();  
              if(!llist)  
              {  
                   GePrint("no list");  
                   return FALSE;  
              }  
                
              LayerObject *layer = (LayerObject* )llist->GetFirst();  
              if(!layer)  
              {  
                   GePrint("no layers");  
                   return TRUE;  
              }  
                
              GePrint(layer->GetName());  
              

              cheers,
              Matthias

              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 17/09/2007 at 23:31, xxxxxxxx wrote:

                Thank you, Matthias!

                And once I have the layer, how do I extract the button states (solo, view, render, etc.)? I'm still not exactly sure how to use GetLayerData to return those values.

                If possible, can you also explain a little bit more the "rawdata" option of GetLayerData()? What does the SDK mean by "original layer values?"

                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 18/09/2007 at 01:26, xxxxxxxx wrote:

                  Just use GetLayerData() with the layer and check the states of the structure elements of the LayerData structure. Here a little example that prints all states of all layers in a scene.

                  You can of course also get the LayerData directly from objects, tags etc.

                    
                  static void StepThruLayers(GeListNode *layer, BaseDocument *doc)  
                  {  
                       while (layer)  
                       {  
                            LayerObject *lobj = (LayerObject* )layer;  
                    
                            const LayerData *ldata = lobj->GetLayerData(doc, FALSE);  
                    
                            GePrint(lobj->GetName());  
                    
                            if(ldata->solo)  
                                 GePrint("Solo On");  
                            else  
                                 GePrint("Solo Off");  
                            if(ldata->view)  
                                 GePrint("View On");  
                            else  
                                 GePrint("View Off");  
                            if(ldata->render)  
                                 GePrint("Render On");  
                            else  
                                 GePrint("Render Off");  
                            if(ldata->manager)  
                                 GePrint("Manager On");  
                            else  
                                 GePrint("Manager Off");  
                            if(ldata->locked)  
                                 GePrint("Locked On");  
                            else  
                                 GePrint("Locked Off");  
                            if(ldata->animation)  
                                 GePrint("Animation On");  
                            else  
                                 GePrint("Animation Off");  
                            if(ldata->generators)  
                                 GePrint("Generators On");  
                            else  
                                 GePrint("Generators Off");  
                            if(ldata->deformers)  
                                 GePrint("Deformers On");  
                            else  
                                 GePrint("Deformers Off");  
                            if(ldata->expressions)  
                                 GePrint("Expressions On");  
                            else  
                                 GePrint("Expressions Off");  
                    
                            StepThruLayers(layer->GetDown(), doc);  
                            layer = layer->GetNext();  
                       }  
                  }  
                    
                  Bool MenuTest::Execute(BaseDocument *doc)  
                  {  
                       GeListHead *llist = doc->GetLayerObjectRoot();  
                       if(!llist)  
                       {  
                            GePrint("no list");  
                            return FALSE;  
                       }  
                    
                       StepThruLayers(llist->GetFirst(), doc);  
                    
                       return TRUE;  
                  }  
                  

                  The "rawdata" flag set to TRUE gives you the raw layer states as seen in the Layer rowser. With set to FALSE it takes global settings like "Solo" into account. That means if a layer is set to "Solo" all other layers have their states disabled. Just play with the example of this post and see the difference for yourself.

                  cheers,
                  Matthias

                  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 19/09/2007 at 19:29, xxxxxxxx wrote:

                    Thank you, Matthias!

                    That's exactly what I needed.

                    The rawdata setting makes sense now, too. Thank you for the explanation.

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