AL_USDMaya  0.29.4
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AL::usdmaya::fileio::translators::TranslatorContext Struct Reference

This class provides a context to store mappings between UsdPrims, and the Maya nodes that represent them. More...

#include <TranslatorContext.h>

Inheritance diagram for AL::usdmaya::fileio::translators::TranslatorContext:

Classes

struct  PrimLookup
 An internal structure used to store a mapping between an SdfPath, the type of prim found at that location, the maya transform that may have been created (assuming the translator plugin specifies that it needs a parent transform), and any nodes that the translator plugin may have created. More...
 
struct  value_compare
 comparison utility (for sorting array of pointers to node references based on their path) More...
 

Public Types

typedef TranslatorContext This
 this type
 
typedef TfRefPtr< ThisRefPtr
 pointer to this type
 
typedef std::vector< PrimLookupPrimLookups
 a sorted array of prim mappings
 

Public Member Functions

const nodes::ProxyShapegetProxyShape () const
 return the proxy shape associated with this context More...
 
AL_USDMAYA_PUBLIC UsdStageRefPtr getUsdStage () const
 return the usd stage associated with this context More...
 
bool getTransform (const UsdPrim &prim, MObjectHandle &object)
 given a USD prim, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false. More...
 
AL_USDMAYA_PUBLIC bool getTransform (const SdfPath &path, MObjectHandle &object)
 given a USD prim path, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false. More...
 
bool getMObject (const UsdPrim &prim, MObjectHandle &object, MTypeId type)
 given a USD prim, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false. More...
 
AL_USDMAYA_PUBLIC bool getMObject (const SdfPath &path, MObjectHandle &object, MTypeId type)
 given a USD prim path, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false. More...
 
bool getMObject (const UsdPrim &prim, MObjectHandle &object, MFn::Type type)
 given a USD prim, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false. More...
 
AL_USDMAYA_PUBLIC bool getMObject (const SdfPath &path, MObjectHandle &object, MFn::Type type)
 given a USD prim path, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false. More...
 
bool getMObjects (const UsdPrim &prim, MObjectHandleArray &returned)
 returns all of the maya nodes that were created by the specific prim More...
 
AL_USDMAYA_PUBLIC bool getMObjects (const SdfPath &path, MObjectHandleArray &returned)
 returns all of the maya nodes that were created by the specific prim More...
 
AL_USDMAYA_PUBLIC void insertItem (const UsdPrim &prim, MObjectHandle object)
 If within your custom translator plug-in you need to create any maya nodes, associate that maya node with the prim path by calling this method. More...
 
void removeItems (const UsdPrim &prim)
 during a variant switch, if we lose a prim, then it's path will be passed into this method, and all the maya nodes that were created for it will be nuked. More...
 
AL_USDMAYA_PUBLIC void removeItems (const SdfPath &path)
 during a variant switch, if we lose a prim, then it's path will be passed into this method, and all the maya nodes that were created for it will be nuked. More...
 
AL_USDMAYA_PUBLIC ~TranslatorContext ()
 dtor
 
TfToken getTypeForPath (SdfPath path) const
 given a path to a prim, return the prim type we are aware of at that path More...
 
AL_USDMAYA_PUBLIC void updatePrimTypes ()
 this method is used after a variant switch to check to see if the prim types have changed in the stage, and will update the internal state accordingly.
 
AL_USDMAYA_PUBLIC void registerItem (const UsdPrim &prim, MObjectHandle object)
 Internal method. If within your custom translator plug-in you need to create any maya nodes, associate that maya node with the prim path by calling this method. More...
 
AL_USDMAYA_PUBLIC MString serialise () const
 serialises the content of the translator context to a text string. More...
 
AL_USDMAYA_PUBLIC void deserialise (const MString &string)
 deserialises the string back into the translator context More...
 
AL_USDMAYA_PUBLIC void validatePrims ()
 debugging utility to help keep track of prims during a variant switch
 
bool hasEntry (const SdfPath &path, const TfToken &type)
 This method is used to determine whether this DB has an entry for the specified prim path and the given type. This is used within a variant switch to determine if a node can be updated, or whether it needs to be imported. More...
 
AL_USDMAYA_PUBLIC void preRemoveEntry (const SdfPath &primPath, SdfPathVector &itemsToRemove, bool callPreUnload=true)
 This is called during a variant switch to determine whether the variant switch will allow Maya nodes to be updated, or whether they need to be deleted. More...
 
AL_USDMAYA_PUBLIC void removeEntries (const SdfPathVector &itemsToRemove)
 call this to remove a prim from the DB (you do not need to lock/unlock here). More...
 
void clearPrimMappings ()
 This is used for testing only. Do not call.
 
AL_USDMAYA_PUBLIC bool addExcludedGeometry (const SdfPath &newPath)
 add geometry to the exclusion list More...
 
AL_USDMAYA_PUBLIC bool removeExcludedGeometry (const SdfPath &newPath)
 remove geometry from the exclusion list More...
 
const SdfPathSet & excludedGeometry ()
 retrieve currently excluded translator geometries More...
 
bool isExcludedGeometryDirty ()
 Retrieves if the the excluded geometry has been pushed to the renderer. More...
 
void setForceDefaultRead (bool forceDefaultRead)
 
bool getForceDefaultRead ()
 

Static Public Member Functions

static RefPtr create (nodes::ProxyShape *proxyShape)
 construct a new context for the specified proxy shape node More...
 

Detailed Description

This class provides a context to store mappings between UsdPrims, and the Maya nodes that represent them.

Member Function Documentation

AL_USDMAYA_PUBLIC bool AL::usdmaya::fileio::translators::TranslatorContext::addExcludedGeometry ( const SdfPath &  newPath)
inline

add geometry to the exclusion list

Parameters
newPaththe path to add as an excluded translator path
Returns
true if the exclusion was added, false if it wasn't added since it might be already there
static RefPtr AL::usdmaya::fileio::translators::TranslatorContext::create ( nodes::ProxyShape proxyShape)
inlinestatic

construct a new context for the specified proxy shape node

Parameters
proxyShapethe proxy shape to associate the context with
Returns
a new context
AL_USDMAYA_PUBLIC void AL::usdmaya::fileio::translators::TranslatorContext::deserialise ( const MString &  string)

deserialises the string back into the translator context

Parameters
stringthe string to deserialised
const SdfPathSet& AL::usdmaya::fileio::translators::TranslatorContext::excludedGeometry ( )
inline

retrieve currently excluded translator geometries

Returns
retrieve currently excluded translator geometries
bool AL::usdmaya::fileio::translators::TranslatorContext::getMObject ( const UsdPrim &  prim,
MObjectHandle &  object,
MTypeId  type 
)
inline

given a USD prim, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false.

Parameters
primthe usd prim
objectthe returned handle
typethe type ID of the maya object you wish to retrieve. If the type ID is 0, the first node found will be returned. This may be useful if a prim type may create a type of node that is not known at compile time (e.g. a prim that creates a lambert, blinn, or phong based on some enum attribute). Another alternative would be to query all of the maya nodes via getMObjects
Returns
true if the prim exists
AL_USDMAYA_PUBLIC bool AL::usdmaya::fileio::translators::TranslatorContext::getMObject ( const SdfPath &  path,
MObjectHandle &  object,
MTypeId  type 
)

given a USD prim path, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false.

Parameters
paththe usd prim path
objectthe returned handle
typethe type ID of the maya object you wish to retrieve. If the type ID is 0, the first node found will be returned. This may be useful if a prim type may create a type of node that is not known at compile time (e.g. a prim that creates a lambert, blinn, or phong based on some enum attribute). Another alternative would be to query all of the maya nodes via getMObjects
Returns
true if the prim exists
bool AL::usdmaya::fileio::translators::TranslatorContext::getMObject ( const UsdPrim &  prim,
MObjectHandle &  object,
MFn::Type  type 
)
inline

given a USD prim, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false.

Parameters
primthe usd prim
objectthe returned handle
typethe type of the maya object you wish to retrieve. If the type is MFn::kInvalid, then the first node found will be returned. This may be useful if a prim type may create a type of node that is not known at compile time (e.g. a prim that creates a lambert, blinn, or phong based on some enum attribute). Another alternative would be to query all of the maya nodes via getMObjects
Returns
true if the prim exists
AL_USDMAYA_PUBLIC bool AL::usdmaya::fileio::translators::TranslatorContext::getMObject ( const SdfPath &  path,
MObjectHandle &  object,
MFn::Type  type 
)

given a USD prim path, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false.

Parameters
paththe usd prim path
objectthe returned handle
typethe type of the maya object you wish to retrieve. If the type is MFn::kInvalid, then the first node found will be returned. This may be useful if a prim type may create a type of node that is not known at compile time (e.g. a prim that creates a lambert, blinn, or phong based on some enum attribute). Another alternative would be to query all of the maya nodes via getMObjects
Returns
true if the prim exists
bool AL::usdmaya::fileio::translators::TranslatorContext::getMObjects ( const UsdPrim &  prim,
MObjectHandleArray &  returned 
)
inline

returns all of the maya nodes that were created by the specific prim

Parameters
primthe prim to query
returnedthe returned list of MObjects
Returns
true if a reference to the prim was found
AL_USDMAYA_PUBLIC bool AL::usdmaya::fileio::translators::TranslatorContext::getMObjects ( const SdfPath &  path,
MObjectHandleArray &  returned 
)

returns all of the maya nodes that were created by the specific prim

Parameters
paththe path to the prim to query
returnedthe returned list of MObjects
Returns
true if a reference to the prim was found
const nodes::ProxyShape* AL::usdmaya::fileio::translators::TranslatorContext::getProxyShape ( ) const
inline

return the proxy shape associated with this context

Returns
the proxy shape
bool AL::usdmaya::fileio::translators::TranslatorContext::getTransform ( const UsdPrim &  prim,
MObjectHandle &  object 
)
inline

given a USD prim, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false.

Parameters
primthe usd prim
objectthe returned handle
Returns
true if the prim exists
AL_USDMAYA_PUBLIC bool AL::usdmaya::fileio::translators::TranslatorContext::getTransform ( const SdfPath &  path,
MObjectHandle &  object 
)

given a USD prim path, this will see whether a maya node exists for it. If it does, that will be returned in the object handle. If the object is found, true is returned, otherwise false.

Parameters
paththe usd prim path
objectthe returned handle
Returns
true if the prim exists
TfToken AL::usdmaya::fileio::translators::TranslatorContext::getTypeForPath ( SdfPath  path) const
inline

given a path to a prim, return the prim type we are aware of at that path

Parameters
paththe prim path of a prim that was imported via a custom translator plug-in
Returns
the type name for that prim
AL_USDMAYA_PUBLIC UsdStageRefPtr AL::usdmaya::fileio::translators::TranslatorContext::getUsdStage ( ) const

return the usd stage associated with this context

Returns
the usd stage
bool AL::usdmaya::fileio::translators::TranslatorContext::hasEntry ( const SdfPath &  path,
const TfToken &  type 
)
inline

This method is used to determine whether this DB has an entry for the specified prim path and the given type. This is used within a variant switch to determine if a node can be updated, or whether it needs to be imported.

Parameters
paththe path to the prim to query
typethe type of prim
Returns
true if an entry is found that matches, false otherwise
AL_USDMAYA_PUBLIC void AL::usdmaya::fileio::translators::TranslatorContext::insertItem ( const UsdPrim &  prim,
MObjectHandle  object 
)

If within your custom translator plug-in you need to create any maya nodes, associate that maya node with the prim path by calling this method.

Parameters
primthe prim you are currently importing in a translator
objectthe handle to the maya node you have created.
bool AL::usdmaya::fileio::translators::TranslatorContext::isExcludedGeometryDirty ( )
inline

Retrieves if the the excluded geometry has been pushed to the renderer.

Returns
true if the excluded list hasn't been pushed the the renderer yet
AL_USDMAYA_PUBLIC void AL::usdmaya::fileio::translators::TranslatorContext::preRemoveEntry ( const SdfPath &  primPath,
SdfPathVector &  itemsToRemove,
bool  callPreUnload = true 
)

This is called during a variant switch to determine whether the variant switch will allow Maya nodes to be updated, or whether they need to be deleted.

Parameters
primPaththe path to the prim that triggered the variant switch
itemsToRemovethe returned list of items that need to be removed
callPreUnloadtrue calling the preUnload on all the prims is needed.
AL_USDMAYA_PUBLIC void AL::usdmaya::fileio::translators::TranslatorContext::registerItem ( const UsdPrim &  prim,
MObjectHandle  object 
)

Internal method. If within your custom translator plug-in you need to create any maya nodes, associate that maya node with the prim path by calling this method.

Parameters
primthe prim you are currently importing in a translator
objectthe handle to the maya node you have created.
AL_USDMAYA_PUBLIC void AL::usdmaya::fileio::translators::TranslatorContext::removeEntries ( const SdfPathVector &  itemsToRemove)

call this to remove a prim from the DB (you do not need to lock/unlock here).

Parameters
itemsToRemovethe prims that need to be removed from the DB. tearDown will be called on each prim
AL_USDMAYA_PUBLIC bool AL::usdmaya::fileio::translators::TranslatorContext::removeExcludedGeometry ( const SdfPath &  newPath)
inline

remove geometry from the exclusion list

Parameters
newPaththe path to add as an excluded translator path
Returns
true if the exclusion was removed, false if it wasn't removed or it may have never existed
void AL::usdmaya::fileio::translators::TranslatorContext::removeItems ( const UsdPrim &  prim)
inline

during a variant switch, if we lose a prim, then it's path will be passed into this method, and all the maya nodes that were created for it will be nuked.

Parameters
primthe usd prim that was removed due to a variant switch
AL_USDMAYA_PUBLIC void AL::usdmaya::fileio::translators::TranslatorContext::removeItems ( const SdfPath &  path)

during a variant switch, if we lose a prim, then it's path will be passed into this method, and all the maya nodes that were created for it will be nuked.

Parameters
pathpath to the usd prim that was removed due to a variant switch
AL_USDMAYA_PUBLIC MString AL::usdmaya::fileio::translators::TranslatorContext::serialise ( ) const

serialises the content of the translator context to a text string.

Returns
the translator context serialised into a string

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