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

Stores layers, in a way that they may be looked up by the layer ref ptr, or by identifier Also, unlike boost::multi_index, we can have multiple identifiers per layer You can add non-dirty layers to the database, but the query operations will "hide" them - ie, iteration will skip by them, and findLayer will return an invalid ptr if it's not dirty We allow adding non-dirty items because if we want to guarantee we always have all the latest items, we need to deal with the situation where the current edit target starts out not dirty... and it's easiest to just add it then filter it if it's not dirty. More...

#include <LayerManager.h>

Public Types

typedef std::map
< SdfLayerRefPtr, std::vector
< std::string > > 
LayerToIdsMap
 
typedef std::map< std::string,
SdfLayerRefPtr > 
IdToLayerMap
 
typedef DirtyOnlyIterator
< LayerToIdsMap::iterator > 
iterator
 
typedef DirtyOnlyIterator
< LayerToIdsMap::const_iterator > 
const_iterator
 

Public Member Functions

bool addLayer (SdfLayerRefPtr layer, const std::string &identifier=std::string())
 Add the given layer to the set of layers in this LayerDatabase, if not already present, and optionally add an extra identifier as a key to it. More...
 
bool removeLayer (SdfLayerRefPtr layer)
 Remove the given layer to the list of layers managed by this node, if present. More...
 
SdfLayerHandle findLayer (std::string identifier) const
 Find the layer in the set of layers managed by this node, by identifier. More...
 
 operator _UnspecifiedBoolType () const
 
size_t max_size () const
 Upper bound for the number of non-dirty layers in this object This is the count of all tracked layers, dirty-and-non-dirty; If it is zero, it can be guaranteed that there are no dirty layers, but if it is non-zero, we cannot guarantee that there are any non-dirty layers. Use boolean conversion above to test that.
 
iterator begin ()
 returns start of layer range
 
const_iterator begin () const
 returns start of layer range
 
const_iterator cbegin () const
 returns start of layer range
 
iterator end ()
 returns end of layer range
 
const_iterator end () const
 returns end of layer range
 
const_iterator cend () const
 returns end of layer range
 

Detailed Description

Stores layers, in a way that they may be looked up by the layer ref ptr, or by identifier Also, unlike boost::multi_index, we can have multiple identifiers per layer You can add non-dirty layers to the database, but the query operations will "hide" them - ie, iteration will skip by them, and findLayer will return an invalid ptr if it's not dirty We allow adding non-dirty items because if we want to guarantee we always have all the latest items, we need to deal with the situation where the current edit target starts out not dirty... and it's easiest to just add it then filter it if it's not dirty.

Member Function Documentation

bool AL::usdmaya::nodes::LayerDatabase::addLayer ( SdfLayerRefPtr  layer,
const std::string &  identifier = std::string() 
)

Add the given layer to the set of layers in this LayerDatabase, if not already present, and optionally add an extra identifier as a key to it.

Parameters
layerWhat layer to add to this database
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 set of layers managed by this node (ie, if it wasn't already managed)
SdfLayerHandle AL::usdmaya::nodes::LayerDatabase::findLayer ( std::string  identifier) const

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

Parameters
identifierthe identifier the full identifier of the layer to locate
Returns
The found layer handle in the layer list managed by this node (invalid if not found or not dirty)
bool AL::usdmaya::nodes::LayerDatabase::removeLayer ( SdfLayerRefPtr  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 set of layers managed by this node (ie, if was previously managed)

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