#include <xsi_layer.h>
The Layer is a self-contained collection of SceneItem objects. It can be nested one level to provide Layer Group functionality.
Layers are exclusive group containers. An 3D object in the scene must belong to a layer, but can only belong one at a given time. This can be changed by moving objects from layer to layer.
Layers can be nested on level to provide layer grouping, meaning that users can control a set of layers in a non-destructive way. This can improve efficiency by quickly hiding/showing objects from a set of layers rather than having to change them and reset them afterward.
You can create a new layer with the CreateLayer command, and access a scene's layers via the Scene.
using namespace XSI; Application app; Project project = app.GetActiveProject(); Scene scn = project.GetActiveScene(); Layer myLayer = scn.GetActiveLayer() ; using namespace XSI; CValueArray args(2); CValue outArg; args[0] = CValue( L"" ); args[1] = CValue(L"MyNestedLayer"); app.ExecuteCommand( L"CreateLayer", args, outArg ); CValueArray result = outArg; Layer NestedLayer = result[0]; myLayer.AddLayer( NestedLayer ); app.LogMessage(L"Number of sub-Layers of myLayer is: " + myLayer.GetLayers().GetCount() ); myLayer.AddLayer( myLayer ); NestedLayer.AddLayer( myLayer ); myLayer.RemoveLayer( NestedLayer ); app.LogMessage(L"Number of sub-Layers of myLayer is: " + myLayer.GetLayers().GetCount() );
Public Member Functions |
|
Layer () | |
~Layer () | |
Layer (const CRef &in_ref) | |
Layer (const Layer &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
Layer & | operator= (const Layer &in_obj) |
Layer & | operator= (const CRef &in_ref) |
CRefArray | GetLayers () const |
CStatus | AddLayer (const Layer &in_member) |
CStatus | RemoveLayer (const Layer &in_member) |
Layer | ( | ) |
Default constructor.
~Layer | ( | ) |
Default destructor.
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from Group.
siClassID GetClassID | ( | ) | const [virtual] |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
CRefArray GetLayers | ( | ) | const |
property Layers
Returns the array of the sub layers parented under this layer.
property AddLayer Adds an existing layer. The existing layer will be removed from its current owner (LayerContainer or another Layer).
in_member | The layer to add as a child. |
property RemoveLayer Removes the layer from our child array. The layer will be reparented to the Layer Container.
in_member | The layer to remove |