3 #include "maya/MDagPath.h"
4 #include "AL/usdmaya/fileio/translators/TranslatorBase.h"
5 #include "AL/usdmaya/fileio/translators/TranslatorContext.h"
7 #include "pxr/usd/sdf/path.h"
8 #include "pxr/usd/usd/stage.h"
27 : m_primPath(path), m_mayaObj(mayaObj) {}
35 {
return m_primPath; }
40 {
return m_mayaObj.object(); }
44 MObjectHandle m_mayaObj;
101 bool hasEntry(
const SdfPath& path,
const TfToken& type)
103 auto it = std::lower_bound(m_nodeRefs.begin(), m_nodeRefs.end(), path,
value_compare());
104 if(it != m_nodeRefs.end() && (it->primPath() == path))
106 return type ==
context()->getTypeForPath(path);
116 void addEntry(
const SdfPath& primPath,
const MObject& primObj);
120 { std::sort(m_nodeRefs.begin(), m_nodeRefs.end(),
value_compare()); }
126 void preRemoveEntry(
const SdfPath& primPath, SdfPathVector& itemsToRemove);
138 fileio::translators::TranslatorContextPtr
context();
143 {
return m_translatorManufacture; }
152 const SdfPath& primPath,
153 const MObject& primObj);
156 const MObject& primObj);
158 typedef std::vector<SchemaNodeRef> SchemaNodeRefs;
159 SchemaNodeRefs m_nodeRefs;
161 fileio::translators::TranslatorContextPtr m_context;
const SdfPath & primPath() const
get the prim path of this reference
Definition: VariantDB.h:34
void preRemoveEntry(const SdfPath &primPath, SdfPathVector &itemsToRemove)
This is called during a variant switch to determine whether the variant switch will allow Maya nodes ...
A custom proxy shape node that attaches itself to a USD file, and then renders it. The stage is held internally as a member variable, and it will be composed based on a change to the "filePath" attribute.
Definition: ProxyShape.h:33
void unlock()
call this method after adding some entries into the DB
Definition: VariantDB.h:119
fileio::translators::TranslatorManufacture & translatorManufacture()
access the current translator factory for the schema prims
Definition: VariantDB.h:142
a mapping between a prim path and the transform node under which the prim was imported via a custom p...
Definition: VariantDB.h:19
SchemaNodeRefDB(nodes::ProxyShape *const proxy)
constructor
void addEntry(const SdfPath &primPath, const MObject &primObj)
create a mapping between the prim path, and the MObject that was created by a translator plugin when ...
~SchemaNodeRef()
dtor
Definition: VariantDB.h:30
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 giv...
Definition: VariantDB.h:101
comparison utility (for sorting array of pointers to node references based on their path) ...
Definition: VariantDB.h:58
SchemaNodeRef(const SdfPath &path, MObject mayaObj)
ctor
Definition: VariantDB.h:26
void outputPrims(std::ostream &os)
debugging util - prints a list of the schema nodes that currently exist within maya ...
The proxy shape node needs to store a mapping of all the schema nodes it has brought into the Maya sc...
Definition: VariantDB.h:53
Forms a registry of all plug-in translator types registered.
Definition: TranslatorBase.h:191
void removeEntries(const SdfPathVector &itemsToRemove)
call this to remove a prim from the DB (you do not need to lock/unlock here).
nodes::ProxyShape * proxy() const
returns the proxy shape node associated with the schema prims in this DB
Definition: VariantDB.h:147
void lock()
When adding new schema node entries into this DB, rather than forcing a sort after each entry is adde...
Definition: VariantDB.h:93
MObject mayaObject() const
get the maya object of the node
Definition: VariantDB.h:39
bool operator()(const SchemaNodeRef &a, const SdfPath &b) const
compare schema node ref to path
Definition: VariantDB.h:64
fileio::translators::TranslatorContextPtr context()
access the current translator context for the schema prims