AL_USDMaya  0.29.4
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AL::usdmaya::nodes::LayerManager Class Reference

The layer manager node handles serialization and deserialization of all layers used by all ProxyShapes It may temporarily contain non-dirty layers, but those will be filtered out by query operations. More...

#include <LayerManager.h>

Inheritance diagram for AL::usdmaya::nodes::LayerManager:

Public Member Functions

 LayerManager ()
 ctor
 
AL_USDMAYA_PUBLIC bool addLayer (SdfLayerHandle layer, const std::string &identifier=std::string())
 Methods to handle the saving and restoring of layer data. More...
 
AL_USDMAYA_PUBLIC bool removeLayer (SdfLayerHandle layer)
 Remove the given layer to the list of layers managed by this node, if present. More...
 
AL_USDMAYA_PUBLIC SdfLayerHandle findLayer (std::string identifier)
 Find the layer in the list of layers managed by this node, by identifier. More...
 
AL_USDMAYA_PUBLIC void getLayerIdentifiers (MStringArray &outputNames)
 Store a list of the managed layers' identifiers in the given MStringArray. More...
 
AL_USDMAYA_PUBLIC MStatus populateSerialisationAttributes ()
 Ensures that the layers attribute will be filled out with serialized versions of all tracked layers.
 
AL_USDMAYA_PUBLIC MStatus clearSerialisationAttributes ()
 Clears the layers attribute.
 
AL_USDMAYA_PUBLIC void loadAllLayers ()
 For every serialized layer stored in attributes, loads them as sdf layers.
 
 AL_MAYA_DECLARE_NODE ()
 Type Info & Registration.
 
 AL_DECL_ATTRIBUTE (layers)
 Type Info & Registration.
 
 AL_DECL_MULTI_CHILD_ATTRIBUTE (identifier)
 
 AL_DECL_MULTI_CHILD_ATTRIBUTE (serialized)
 
 AL_DECL_MULTI_CHILD_ATTRIBUTE (anonymous)
 

Static Public Member Functions

static AL_USDMAYA_PUBLIC MObject findNode ()
 Find the already-existing non-referenced LayerManager node in the scene, or return a null MObject. More...
 
static AL_USDMAYA_PUBLIC MObject findOrCreateNode (MDGModifier *dgmod=nullptr, bool *wasCreated=nullptr)
 Either find the already-existing non-referenced LayerManager node in the scene, or make one. More...
 
static AL_USDMAYA_PUBLIC
LayerManager
findManager ()
 Find the already-existing non-referenced LayerManager node in the scene, or return a nullptr. More...
 
static AL_USDMAYA_PUBLIC
LayerManager
findOrCreateManager (MDGModifier *dgmod=nullptr, bool *wasCreated=nullptr)
 Either find the already-existing non-referenced LayerManager in the scene, or make one. More...
 
static AL_USDMAYA_PUBLIC void * conditionalCreator ()
 Creates the node, but only if there is not a non-referenced one in the scene already.
 

Detailed Description

The layer manager node handles serialization and deserialization of all layers used by all ProxyShapes It may temporarily contain non-dirty layers, but those will be filtered out by query operations.

Member Function Documentation

AL_USDMAYA_PUBLIC bool AL::usdmaya::nodes::LayerManager::addLayer ( SdfLayerHandle  layer,
const std::string &  identifier = std::string() 
)

Methods to handle the saving and restoring of layer data.

Add the given layer to the list of layers managed by this node, if not already present.

Parameters
layerWhat layer to add to this LayerManager
identifierExtra identifier to add as a key to this layer; note that the "canonical" identifier, as returned by layer.GetIdentifier(), is ALWAYS added as an identifier key for this layer so this is intended as a way to provide a second identifier for the same layer (or third or more, if you call it repeatedly). This is useful both because multiple identifiers may resolve to the same underlying layer (especially when considering asset resolution), and for serializing and deserializing anonymous layers, the "canonical" identifier will change every time it is serialized and deserialized (and it can be necessary to refer to the layer both by it's "old" and "new" ids). If this is an empty string, it is ignored.
Returns
bool which is true if the layer was actually added to the list of layers managed by this node (ie, if it wasn't already managed, and the given layer handle was valid)
AL_USDMAYA_PUBLIC SdfLayerHandle AL::usdmaya::nodes::LayerManager::findLayer ( std::string  identifier)

Find the layer in the list of layers managed by this node, by identifier.

Returns
The found layer handle in the layer list managed by this node (invalid if not found)
static AL_USDMAYA_PUBLIC LayerManager* AL::usdmaya::nodes::LayerManager::findManager ( )
static

Find the already-existing non-referenced LayerManager node in the scene, or return a nullptr.

Returns
the found LayerManager, or a nullptr
static AL_USDMAYA_PUBLIC MObject AL::usdmaya::nodes::LayerManager::findNode ( )
static

Find the already-existing non-referenced LayerManager node in the scene, or return a null MObject.

Returns
the found LayerManager node, or a null MObject
static AL_USDMAYA_PUBLIC LayerManager* AL::usdmaya::nodes::LayerManager::findOrCreateManager ( MDGModifier *  dgmod = nullptr,
bool *  wasCreated = nullptr 
)
static

Either find the already-existing non-referenced LayerManager in the scene, or make one.

Parameters
dgmodAn optional dgmodifier to create the node, if necessary. Note that if one is passed in, createNode might be called on it, but doIt never will be, so the layer manager node may not be added to the scene graph yet
wasCreatedIf given, whether a new layer manager had to be created is stored here.
Returns
the found-or-created LayerManager
static AL_USDMAYA_PUBLIC MObject AL::usdmaya::nodes::LayerManager::findOrCreateNode ( MDGModifier *  dgmod = nullptr,
bool *  wasCreated = nullptr 
)
static

Either find the already-existing non-referenced LayerManager node in the scene, or make one.

Parameters
dgmodAn optional dgmodifier to create the node, if necessary. Note that if one is passed in, createNode might be called on it, but doIt never will be, so the layer manager node may not be added to the scene graph yet
wasCreatedIf given, whether a new layer manager had to be created is stored here.
Returns
the found-or-created LayerManager node
AL_USDMAYA_PUBLIC void AL::usdmaya::nodes::LayerManager::getLayerIdentifiers ( MStringArray &  outputNames)

Store a list of the managed layers' identifiers in the given MStringArray.

Parameters
outputNamesThe array to hold the identifier names; will be cleared before being filled. No guarantees are made about the order in which the layer identifiers will be returned.
AL_USDMAYA_PUBLIC bool AL::usdmaya::nodes::LayerManager::removeLayer ( SdfLayerHandle  layer)

Remove the given layer to the list of layers managed by this node, if present.

Returns
bool which is true if the layer was actually removed from the list of layers managed by this node (ie, if it was previously managed, and the given layer handle was valid)

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