Layer Browser questions



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



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



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



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



  • 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



  • 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?"



  • 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



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


Log in to reply