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 Manager [SOLVED]

    SDK Help
    0
    4
    360
    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 14/10/2015 at 14:40, xxxxxxxx wrote:

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

      ---------
      Hello,

      I want to read out all Layers from the Layer Manager. Also I want to add new layers, remove and rename. I found the LayerSet in the SDK: https://developers.maxon.net/docs/cpp/2023_2/class_layer_set.html#afc9ab69643027a912262c285c59e2be8

      But I don't know how to use it? Does someone has an example for me?

      thanks

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

        On 14/10/2015 at 15:41, xxxxxxxx wrote:

        No code but LayerData is where you want to begin.  You can get the root layer (a list head) of the Document using BaseDocument::GetLayerObjectRoot().  Search here for GetLayerObjectRoot for some topics and code.

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

          On 14/10/2015 at 22:02, xxxxxxxx wrote:

          Thank You,

          I figured out how it works:

            
                GeListHead* layerList = NULL;  
                layerList = doc->GetLayerObjectRoot();      
                LayerObject *layer = (LayerObject* )layerList->GetFirst();   //Get the first layer  
                const LayerData *data = layer->GetLayerData(doc, FALSE);    //Get the layer's container   
                  
            
                while (layer) {  
                    GePrint(layer->GetName());  
                    layer = layer->GetNext();  
                }  
          
          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 15/10/2015 at 01:14, xxxxxxxx wrote:

            Hello,

            Layers are not just stored in a list but actually in a tree. So to get all layers you also need to check the child layers with GetDown().

            Best wishes,
            Sebastian

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