Layer Manager [SOLVED]



  • 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/Cinema4DCPPSDK/html/class_layer_set.html#afc9ab69643027a912262c285c59e2be8

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

    thanks



  • 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.



  • 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();  
          }  
    


  • 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


Log in to reply