AL_USDMaya  0.16.6
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros 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:

Public Types

typedef TranslatorContext This
 this type
 
typedef TfRefPtr< ThisRefPtr
 pointer to this type
 

Public Member Functions

const nodes::ProxyShapegetProxyShape () const
 return the proxy shape associated with this context More...
 
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...
 
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...
 
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...
 
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...
 
bool getMObjects (const SdfPath &path, MObjectHandleArray &returned)
 returns all of the maya nodes that were created by the specific prim More...
 
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...
 
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...
 
 ~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...
 
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...
 
MString serialise () const
 serialises the content of the translator context to a text string. More...
 
void deserialise (const MString &string)
 deserialises the string back into the translator context More...
 

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

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
void AL::usdmaya::fileio::translators::TranslatorContext::deserialise ( const MString &  string)

deserialises the string back into the translator context

Parameters
stringthe string to deserialised
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
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
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
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
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
UsdStageRefPtr AL::usdmaya::fileio::translators::TranslatorContext::getUsdStage ( ) const

return the usd stage associated with this context

Returns
the usd stage
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.
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.
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
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
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: