Layer Class Reference
 
 
 
Layer Class Reference

#include <xsi_layer.h>


Class Description

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.

See also:
Scene::GetLayers, Scene::GetActiveLayer, CreateLayer
Example:
                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() );
Inheritance diagram for Layer:
Group SceneItem ProjectItem SIObject CBase

List of all members.

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)

Constructor & Destructor Documentation

Layer ( )

Default constructor.

~Layer ( )

Default destructor.

Layer ( const CRef in_ref )

Constructor.

Parameters:
in_ref constant reference object.
Layer ( const Layer in_obj )

Copy constructor.

Parameters:
in_obj constant class object.

Member Function Documentation

bool IsA ( siClassID  in_ClassID ) const [virtual]

Returns true if a given class type is compatible with this API class.

Parameters:
in_ClassID class type.
Returns:
true if the class is compatible, false otherwise.

Reimplemented from Group.

siClassID GetClassID ( ) const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from Group.

Layer& operator= ( const Layer in_obj )

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:
in_obj constant class object.
Returns:
The new Layer object.
Layer& operator= ( const CRef in_ref )

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:
in_ref constant class object.
Returns:
The new Layer object.

Reimplemented from Group.

CRefArray GetLayers ( ) const

property Layers

Returns the array of the sub layers parented under this layer.

Returns:
The layer children
CStatus AddLayer ( const Layer in_member )

property AddLayer Adds an existing layer. The existing layer will be removed from its current owner (LayerContainer or another Layer).

Parameters:
in_member The layer to add as a child.
CStatus RemoveLayer ( const Layer in_member )

property RemoveLayer Removes the layer from our child array. The layer will be reparented to the Layer Container.

Parameters:
in_member The layer to remove

The documentation for this class was generated from the following file: