HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Document Class Reference

#include <Document.h>

+ Inheritance diagram for Document:

Public Member Functions

 Document (ElementPtr parent, const string &name)
 
virtual ~Document ()
 
virtual void initialize ()
 Initialize the document, removing any existing content. More...
 
virtual DocumentPtr copy () const
 Create a deep copy of the document. More...
 
StringSet getReferencedSourceUris () const
 Get a list of source URIs referenced by the document. More...
 
NodeDefPtr addNodeDefFromGraph (NodeGraphPtr nodeGraph, const string &nodeDefName, const string &node, const string &version, bool isDefaultVersion, const string &nodeGroup, const string &newGraphName)
 
Data Libraries
void setDataLibrary (ConstDocumentPtr dataLibrary)
 Store a reference to a data library in this document. More...
 
bool hasDataLibrary () const
 Return true if this document has a data library. More...
 
ConstDocumentPtr getDataLibrary () const
 Return the data library, if any, referenced by this document. More...
 
void importLibrary (const ConstDocumentPtr &library)
 
NodeGraph Elements
NodeGraphPtr addNodeGraph (const string &name=EMPTY_STRING)
 
NodeGraphPtr getNodeGraph (const string &name) const
 Return the NodeGraph, if any, with the given name. More...
 
vector< NodeGraphPtrgetNodeGraphs () const
 Return a vector of all NodeGraph elements in the document. More...
 
void removeNodeGraph (const string &name)
 Remove the NodeGraph, if any, with the given name. More...
 
vector< PortElementPtrgetMatchingPorts (const string &nodeName) const
 
GeomInfo Elements
GeomInfoPtr addGeomInfo (const string &name=EMPTY_STRING, const string &geom=UNIVERSAL_GEOM_NAME)
 
GeomInfoPtr getGeomInfo (const string &name) const
 Return the GeomInfo, if any, with the given name. More...
 
vector< GeomInfoPtrgetGeomInfos () const
 Return a vector of all GeomInfo elements in the document. More...
 
void removeGeomInfo (const string &name)
 Remove the GeomInfo, if any, with the given name. More...
 
ValuePtr getGeomPropValue (const string &geomPropName, const string &geom=UNIVERSAL_GEOM_NAME) const
 Return the value of a geometric property for the given geometry string. More...
 
GeomPropDef Elements
GeomPropDefPtr addGeomPropDef (const string &name, const string &geomprop)
 
GeomPropDefPtr getGeomPropDef (const string &name) const
 Return the GeomPropDef, if any, with the given name. More...
 
vector< GeomPropDefPtrgetGeomPropDefs () const
 Return a vector of all GeomPropDef elements in the document. More...
 
void removeGeomPropDef (const string &name)
 Remove the GeomPropDef, if any, with the given name. More...
 
Material Outputs
vector< OutputPtrgetMaterialOutputs () const
 Return material-type outputs for all nodegraphs in the document. More...
 
Look Elements
LookPtr addLook (const string &name=EMPTY_STRING)
 
LookPtr getLook (const string &name) const
 Return the Look, if any, with the given name. More...
 
vector< LookPtrgetLooks () const
 Return a vector of all Look elements in the document. More...
 
void removeLook (const string &name)
 Remove the Look, if any, with the given name. More...
 
LookGroup Elements
LookGroupPtr addLookGroup (const string &name=EMPTY_STRING)
 
LookGroupPtr getLookGroup (const string &name) const
 Return the LookGroup, if any, with the given name. More...
 
vector< LookGroupPtrgetLookGroups () const
 Return a vector of all LookGroup elements in the document. More...
 
void removeLookGroup (const string &name)
 Remove the LookGroup, if any, with the given name. More...
 
Collection Elements
CollectionPtr addCollection (const string &name=EMPTY_STRING)
 
CollectionPtr getCollection (const string &name) const
 Return the Collection, if any, with the given name. More...
 
vector< CollectionPtrgetCollections () const
 Return a vector of all Collection elements in the document. More...
 
void removeCollection (const string &name)
 Remove the Collection, if any, with the given name. More...
 
TypeDef Elements
TypeDefPtr addTypeDef (const string &name)
 
TypeDefPtr getTypeDef (const string &name) const
 Return the TypeDef, if any, with the given name. More...
 
vector< TypeDefPtrgetTypeDefs () const
 Return a vector of all TypeDef elements in the document. More...
 
void removeTypeDef (const string &name)
 Remove the TypeDef, if any, with the given name. More...
 
NodeDef Elements
NodeDefPtr addNodeDef (const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING, const string &node=EMPTY_STRING)
 
NodeDefPtr addNodeDefFromGraph (NodeGraphPtr nodeGraph, const string &nodeDefName, const string &category, const string &newGraphName)
 
NodeDefPtr getNodeDef (const string &name) const
 Return the NodeDef, if any, with the given name. More...
 
vector< NodeDefPtrgetNodeDefs () const
 Return a vector of all NodeDef elements in the document. More...
 
void removeNodeDef (const string &name)
 Remove the NodeDef, if any, with the given name. More...
 
vector< NodeDefPtrgetMatchingNodeDefs (const string &nodeName) const
 Return a vector of all NodeDef elements that match the given node name. More...
 
AttributeDef Elements
AttributeDefPtr addAttributeDef (const string &name=EMPTY_STRING)
 
AttributeDefPtr getAttributeDef (const string &name) const
 Return the AttributeDef, if any, with the given name. More...
 
vector< AttributeDefPtrgetAttributeDefs () const
 Return a vector of all AttributeDef elements in the document. More...
 
void removeAttributeDef (const string &name)
 Remove the AttributeDef, if any, with the given name. More...
 
TargetDef Elements
TargetDefPtr addTargetDef (const string &name=EMPTY_STRING)
 
TargetDefPtr getTargetDef (const string &name) const
 Return the AttributeDef, if any, with the given name. More...
 
vector< TargetDefPtrgetTargetDefs () const
 Return a vector of all TargetDef elements in the document. More...
 
void removeTargetDef (const string &name)
 Remove the TargetDef, if any, with the given name. More...
 
PropertySet Elements
PropertySetPtr addPropertySet (const string &name=EMPTY_STRING)
 
PropertySetPtr getPropertySet (const string &name) const
 Return the PropertySet, if any, with the given name. More...
 
vector< PropertySetPtrgetPropertySets () const
 Return a vector of all PropertySet elements in the document. More...
 
void removePropertySet (const string &name)
 Remove the PropertySet, if any, with the given name. More...
 
VariantSet Elements
VariantSetPtr addVariantSet (const string &name=EMPTY_STRING)
 
VariantSetPtr getVariantSet (const string &name) const
 Return the VariantSet, if any, with the given name. More...
 
vector< VariantSetPtrgetVariantSets () const
 Return a vector of all VariantSet elements in the document. More...
 
void removeVariantSet (const string &name)
 Remove the VariantSet, if any, with the given name. More...
 
Implementation Elements
ImplementationPtr addImplementation (const string &name=EMPTY_STRING)
 
ImplementationPtr getImplementation (const string &name) const
 Return the Implementation, if any, with the given name. More...
 
vector< ImplementationPtrgetImplementations () const
 Return a vector of all Implementation elements in the document. More...
 
void removeImplementation (const string &name)
 Remove the Implementation, if any, with the given name. More...
 
vector< InterfaceElementPtrgetMatchingImplementations (const string &nodeDef) const
 
UnitDef Elements
UnitDefPtr addUnitDef (const string &name)
 Return the UnitDef, if any, with the given name. More...
 
UnitDefPtr getUnitDef (const string &name) const
 Return the UnitDef, if any, with the given name. More...
 
vector< UnitDefPtrgetUnitDefs () const
 Return a vector of all Member elements in the TypeDef. More...
 
void removeUnitDef (const string &name)
 Remove the UnitDef, if any, with the given name. More...
 
UnitTypeDef Elements
UnitTypeDefPtr addUnitTypeDef (const string &name)
 Return the UnitTypeDef, if any, with the given name. More...
 
UnitTypeDefPtr getUnitTypeDef (const string &name) const
 Return the UnitTypeDef, if any, with the given name. More...
 
vector< UnitTypeDefPtrgetUnitTypeDefs () const
 Return a vector of all UnitTypeDef elements in the document. More...
 
void removeUnitTypeDef (const string &name)
 Remove the UnitTypeDef, if any, with the given name. More...
 
Version
std::pair< int, intgetVersionIntegers () const override
 Return the major and minor versions as an integer pair. More...
 
void upgradeVersion ()
 
Color Management System
void setColorManagementSystem (const string &cms)
 Set the color management system string. More...
 
bool hasColorManagementSystem () const
 Return true if a color management system string has been set. More...
 
const stringgetColorManagementSystem () const
 Return the color management system string. More...
 
Color Management Config
void setColorManagementConfig (const string &cmsConfig)
 Set the color management config string. More...
 
bool hasColorManagementConfig () const
 Return true if a color management config string has been set. More...
 
const stringgetColorManagementConfig () const
 Return the color management config string. More...
 
Validation
bool validate (string *message=nullptr) const override
 
Utility
void invalidateCache ()
 Invalidate cached data for optimized lookups within the given document. More...
 
- Public Member Functions inherited from GraphElement
virtual ~GraphElement ()
 
NodePtr addNode (const string &category, const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING)
 
NodePtr addNodeInstance (ConstNodeDefPtr nodeDef, const string &name=EMPTY_STRING)
 Add a Node that is an instance of the given NodeDef. More...
 
NodePtr getNode (const string &name) const
 Return the Node, if any, with the given name. More...
 
vector< NodePtrgetNodes (const string &category=EMPTY_STRING) const
 
vector< NodePtrgetNodesOfType (const string &nodeType) const
 Return a vector of nodes in the graph which have a given type. More...
 
void removeNode (const string &name)
 Remove the Node, if any, with the given name. More...
 
NodePtr addMaterialNode (const string &name=EMPTY_STRING, ConstNodePtr shaderNode=nullptr)
 
vector< NodePtrgetMaterialNodes () const
 Return a vector of all material nodes. More...
 
BackdropPtr addBackdrop (const string &name=EMPTY_STRING)
 Add a Backdrop to the graph. More...
 
BackdropPtr getBackdrop (const string &name) const
 Return the Backdrop, if any, with the given name. More...
 
vector< BackdropPtrgetBackdrops () const
 Return a vector of all Backdrop elements in the graph. More...
 
void removeBackdrop (const string &name)
 Remove the Backdrop, if any, with the given name. More...
 
void flattenSubgraphs (const string &target=EMPTY_STRING, NodePredicate filter=nullptr)
 
ElementVec topologicalSort () const
 
NodePtr addGeomNode (ConstGeomPropDefPtr geomPropDef, const string &namePrefix)
 
string asStringDot () const
 
- Public Member Functions inherited from InterfaceElement
virtual ~InterfaceElement ()
 
void setNodeDefString (const string &nodeDef)
 Set the NodeDef string for the interface. More...
 
bool hasNodeDefString () const
 Return true if the given interface has a NodeDef string. More...
 
const stringgetNodeDefString () const
 Return the NodeDef string for the interface. More...
 
InputPtr addInput (const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING)
 
InputPtr getInput (const string &name) const
 Return the Input, if any, with the given name. More...
 
vector< InputPtrgetInputs () const
 Return a vector of all Input elements. More...
 
size_t getInputCount () const
 Return the number of Input elements. More...
 
void removeInput (const string &name)
 Remove the Input, if any, with the given name. More...
 
InputPtr getActiveInput (const string &name) const
 
vector< InputPtrgetActiveInputs () const
 
OutputPtr addOutput (const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING)
 
OutputPtr getOutput (const string &name) const
 Return the Output, if any, with the given name. More...
 
vector< OutputPtrgetOutputs () const
 Return a vector of all Output elements. More...
 
size_t getOutputCount () const
 Return the number of Output elements. More...
 
void removeOutput (const string &name)
 Remove the Output, if any, with the given name. More...
 
OutputPtr getActiveOutput (const string &name) const
 
vector< OutputPtrgetActiveOutputs () const
 
void setConnectedOutput (const string &inputName, OutputPtr output)
 
OutputPtr getConnectedOutput (const string &inputName) const
 
TokenPtr addToken (const string &name=EMPTY_STRING)
 
TokenPtr getToken (const string &name) const
 Return the Token, if any, with the given name. More...
 
vector< TokenPtrgetTokens () const
 Return a vector of all Token elements. More...
 
void removeToken (const string &name)
 Remove the Token, if any, with the given name. More...
 
TokenPtr getActiveToken (const string &name) const
 
vector< TokenPtrgetActiveTokens () const
 
ValueElementPtr getValueElement (const string &name) const
 Return the ValueElement, if any, with the given name. More...
 
ValueElementPtr getActiveValueElement (const string &name) const
 
vector< ValueElementPtrgetActiveValueElements () const
 
template<class T >
InputPtr setInputValue (const string &name, const T &value, const string &type=EMPTY_STRING)
 
ValuePtr getInputValue (const string &name, const string &target=EMPTY_STRING) const
 
TokenPtr setTokenValue (const string &name, const string &value)
 
string getTokenValue (const string &name)
 
void setTarget (const string &target)
 Set the target string of this interface. More...
 
bool hasTarget () const
 Return true if the given interface has a target string. More...
 
const stringgetTarget () const
 Return the target string of this interface. More...
 
void setVersionString (const string &version)
 Set the version string of this interface. More...
 
bool hasVersionString () const
 Return true if this interface has a version string. More...
 
const stringgetVersionString () const
 Return the version string of this interface. More...
 
void setVersionIntegers (int majorVersion, int minorVersion)
 Set the major and minor versions as an integer pair. More...
 
void setDefaultVersion (bool defaultVersion)
 Set the default version flag of this element. More...
 
bool getDefaultVersion () const
 Return the default version flag of this element. More...
 
virtual ConstInterfaceElementPtr getDeclaration (const string &target=EMPTY_STRING) const
 
void clearContent () override
 Clear all attributes and descendants from this element. More...
 
bool hasExactInputMatch (ConstInterfaceElementPtr declaration, string *message=nullptr) const
 
- Public Member Functions inherited from TypedElement
virtual ~TypedElement ()
 
void setType (const string &type)
 Set the element's type string. More...
 
bool hasType () const
 Return true if the given element has a type string. More...
 
virtual const stringgetType () const
 Return the element's type string. More...
 
bool isColorType () const
 Return true if the element is of color type. More...
 
bool isMultiOutputType () const
 Return true if the element is of multi-output type. More...
 
TypeDefPtr getTypeDef () const
 
- Public Member Functions inherited from Element
virtual ~Element ()
 
 Element (const Element &)=delete
 
Elementoperator= (const Element &)=delete
 
bool operator== (const Element &rhs) const
 
bool operator!= (const Element &rhs) const
 
void setCategory (const string &category)
 Set the element's category string. More...
 
const stringgetCategory () const
 
void setName (const string &name)
 
const stringgetName () const
 Return the element's name string. More...
 
string getNamePath (ConstElementPtr relativeTo=nullptr) const
 
ElementPtr getDescendant (const string &namePath) const
 
void setFilePrefix (const string &prefix)
 Set the element's file prefix string. More...
 
bool hasFilePrefix () const
 Return true if the given element has a file prefix string. More...
 
const stringgetFilePrefix () const
 Return the element's file prefix string. More...
 
const stringgetActiveFilePrefix () const
 
void setGeomPrefix (const string &prefix)
 Set the element's geom prefix string. More...
 
bool hasGeomPrefix () const
 Return true if the given element has a geom prefix string. More...
 
const stringgetGeomPrefix () const
 Return the element's geom prefix string. More...
 
const stringgetActiveGeomPrefix () const
 
void setColorSpace (const string &colorSpace)
 Set the element's color space string. More...
 
bool hasColorSpace () const
 Return true if the given element has a color space string. More...
 
const stringgetColorSpace () const
 Return the element's color space string. More...
 
const stringgetActiveColorSpace () const
 
void setInheritString (const string &inherit)
 Set the inherit string of this element. More...
 
bool hasInheritString () const
 Return true if this element has an inherit string. More...
 
const stringgetInheritString () const
 Return the inherit string of this element. More...
 
void setInheritsFrom (ConstElementPtr super)
 Set the element that this one directly inherits from. More...
 
ElementPtr getInheritsFrom () const
 Return the element, if any, that this one directly inherits from. More...
 
bool hasInheritedBase (ConstElementPtr base) const
 
bool hasInheritanceCycle () const
 Return true if the inheritance chain for this element contains a cycle. More...
 
void setNamespace (const string &space)
 Set the namespace string of this element. More...
 
bool hasNamespace () const
 Return true if this element has a namespace string. More...
 
const stringgetNamespace () const
 Return the namespace string of this element. More...
 
string getQualifiedName (const string &name) const
 
void setDocString (const string &doc)
 Set the documentation string of this element. More...
 
string getDocString () const
 Return the documentation string of this element. More...
 
template<class T >
bool isA (const string &category=EMPTY_STRING) const
 
template<class T >
shared_ptr< TasA ()
 Dynamic cast to an instance of the given subclass. More...
 
template<class T >
shared_ptr< const TasA () const
 Dynamic cast to a const instance of the given subclass. More...
 
template<class T >
shared_ptr< TaddChild (const string &name=EMPTY_STRING)
 
ElementPtr addChildOfCategory (const string &category, string name=EMPTY_STRING)
 
ElementPtr changeChildCategory (ElementPtr child, const string &category)
 
ElementPtr getChild (const string &name) const
 Return the child element, if any, with the given name. More...
 
template<class T >
shared_ptr< TgetChildOfType (const string &name) const
 
const ElementVecgetChildren () const
 
template<class T >
vector< shared_ptr< T > > getChildrenOfType (const string &category=EMPTY_STRING) const
 
void setChildIndex (const string &name, int index)
 
int getChildIndex (const string &name) const
 
void removeChild (const string &name)
 Remove the child element, if any, with the given name. More...
 
template<class T >
void removeChildOfType (const string &name)
 
void setAttribute (const string &attrib, const string &value)
 Set the value string of the given attribute. More...
 
bool hasAttribute (const string &attrib) const
 Return true if the given attribute is present. More...
 
const stringgetAttribute (const string &attrib) const
 
const StringVecgetAttributeNames () const
 Return a vector of stored attribute names, in the order they were set. More...
 
template<class T >
void setTypedAttribute (const string &attrib, const T &data)
 
template<class T >
T getTypedAttribute (const string &attrib) const
 
void removeAttribute (const string &attrib)
 Remove the given attribute, if present. More...
 
ElementPtr getSelf ()
 Return our self pointer. More...
 
ConstElementPtr getSelf () const
 Return our self pointer. More...
 
ElementPtr getParent ()
 Return our parent element. More...
 
ConstElementPtr getParent () const
 Return our parent element. More...
 
ElementPtr getRoot ()
 Return the root element of our tree. More...
 
ConstElementPtr getRoot () const
 Return the root element of our tree. More...
 
DocumentPtr getDocument ()
 Return the root document of our tree. More...
 
ConstDocumentPtr getDocument () const
 Return the root document of our tree. More...
 
template<class T >
shared_ptr< TgetAncestorOfType ()
 
template<class T >
shared_ptr< const TgetAncestorOfType () const
 
bool isEquivalent (ConstElementPtr rhs, const ElementEquivalenceOptions &options, string *message=nullptr) const
 
virtual bool isAttributeEquivalent (ConstElementPtr rhs, const string &attributeName, const ElementEquivalenceOptions &options, string *message=nullptr) const
 
TreeIterator traverseTree () const
 
GraphIterator traverseGraph () const
 
virtual Edge getUpstreamEdge (size_t index=0) const
 
virtual size_t getUpstreamEdgeCount () const
 Return the number of queryable upstream edges for this element. More...
 
ElementPtr getUpstreamElement (size_t index=0) const
 
InheritanceIterator traverseInheritance () const
 
void setSourceUri (const string &sourceUri)
 
bool hasSourceUri () const
 Return true if this element has a source URI. More...
 
const stringgetSourceUri () const
 Return the element's source URI. More...
 
const stringgetActiveSourceUri () const
 
void copyContentFrom (const ConstElementPtr &source)
 
string createValidChildName (string name) const
 
StringResolverPtr createStringResolver (const string &geom=EMPTY_STRING) const
 
string asString () const
 

Static Public Member Functions

template<class T >
static shared_ptr< TcreateDocument ()
 Create a new document of the given subclass. More...
 

Static Public Attributes

static const string CATEGORY
 
static const string CMS_ATTRIBUTE
 
static const string CMS_CONFIG_ATTRIBUTE
 
- Static Public Attributes inherited from InterfaceElement
static const string NODE_DEF_ATTRIBUTE
 
static const string TARGET_ATTRIBUTE
 
static const string VERSION_ATTRIBUTE
 
static const string DEFAULT_VERSION_ATTRIBUTE
 
- Static Public Attributes inherited from TypedElement
static const string TYPE_ATTRIBUTE
 
- Static Public Attributes inherited from Element
static const string NAME_ATTRIBUTE
 
static const string FILE_PREFIX_ATTRIBUTE
 
static const string GEOM_PREFIX_ATTRIBUTE
 
static const string COLOR_SPACE_ATTRIBUTE
 
static const string INHERIT_ATTRIBUTE
 
static const string NAMESPACE_ATTRIBUTE
 
static const string DOC_ATTRIBUTE
 
static const string XPOS_ATTRIBUTE
 
static const string YPOS_ATTRIBUTE
 

Additional Inherited Members

- Protected Types inherited from InterfaceElement
using NodeDefPtr = shared_ptr< NodeDef >
 
using ConstNodeDefPtr = shared_ptr< const NodeDef >
 
- Protected Types inherited from TypedElement
using TypeDefPtr = shared_ptr< class TypeDef >
 
- Protected Types inherited from Element
using DocumentPtr = shared_ptr< Document >
 
using ConstDocumentPtr = shared_ptr< const Document >
 
- Protected Member Functions inherited from GraphElement
 GraphElement (ElementPtr parent, const string &category, const string &name)
 
- Protected Member Functions inherited from InterfaceElement
 InterfaceElement (ElementPtr parent, const string &category, const string &name)
 
void registerChildElement (ElementPtr child) override
 
void unregisterChildElement (ElementPtr child) override
 
- Protected Member Functions inherited from TypedElement
 TypedElement (ElementPtr parent, const string &category, const string &name)
 
- Protected Member Functions inherited from Element
 Element (ElementPtr parent, const string &category, const string &name)
 
template<class T >
shared_ptr< TresolveNameReference (const string &name, ConstElementPtr parent=nullptr) const
 
void validateRequire (bool expression, bool &res, string *message, const string &errorDesc) const
 
ElementPtr getSelfNonConst () const
 
- Protected Attributes inherited from Element
string _category
 
string _name
 
string _sourceUri
 
ElementMap _childMap
 
ElementVec _childOrder
 
StringMap _attributeMap
 
StringVec _attributeOrder
 
weak_ptr< Element_parent
 
weak_ptr< Element_root
 

Detailed Description

A MaterialX document, which represents the top-level element in the MaterialX ownership hierarchy.

Use the factory function createDocument() to create a Document instance.

Definition at line 31 of file Document.h.

Constructor & Destructor Documentation

Document::Document ( ElementPtr  parent,
const string name 
)
virtual Document::~Document ( )
virtual

Member Function Documentation

AttributeDefPtr Document::addAttributeDef ( const string name = EMPTY_STRING)
inline

Add an AttributeDef to the document.

Parameters
nameThe name of the new AttributeDef. If no name is specified, then a unique name will automatically be generated.
Returns
A shared pointer to the new AttributeDef.

Definition at line 398 of file Document.h.

CollectionPtr Document::addCollection ( const string name = EMPTY_STRING)
inline

Add a Collection to the document.

Parameters
nameThe name of the new Collection. If no name is specified, then a unique name will automatically be generated.
Returns
A shared pointer to the new Collection.

Definition at line 275 of file Document.h.

GeomInfoPtr Document::addGeomInfo ( const string name = EMPTY_STRING,
const string geom = UNIVERSAL_GEOM_NAME 
)
inline

Add a GeomInfo to the document.

Parameters
nameThe name of the new GeomInfo. If no name is specified, then a unique name will automatically be generated.
geomAn optional geometry string for the GeomInfo.
Returns
A shared pointer to the new GeomInfo.

Definition at line 134 of file Document.h.

GeomPropDefPtr Document::addGeomPropDef ( const string name,
const string geomprop 
)
inline

Add a GeomPropDef to the document.

Parameters
nameThe name of the new GeomPropDef.
geompropThe geometric property to use for the GeomPropDef.
Returns
A shared pointer to the new GeomPropDef.

Definition at line 170 of file Document.h.

ImplementationPtr Document::addImplementation ( const string name = EMPTY_STRING)
inline

Add an Implementation to the document.

Parameters
nameThe name of the new Implementation. If no name is specified, then a unique name will automatically be generated.
Returns
A shared pointer to the new Implementation.

Definition at line 526 of file Document.h.

LookPtr Document::addLook ( const string name = EMPTY_STRING)
inline

Add a Look to the document.

Parameters
nameThe name of the new Look. If no name is specified, then a unique name will automatically be generated.
Returns
A shared pointer to the new Look.

Definition at line 211 of file Document.h.

LookGroupPtr Document::addLookGroup ( const string name = EMPTY_STRING)
inline

Add a LookGroup to the document.

Parameters
nameThe name of the new LookGroup. If no name is specified, then a unique name will automatically be generated.
Returns
A shared pointer to the new LookGroup.

Definition at line 243 of file Document.h.

NodeDefPtr Document::addNodeDef ( const string name = EMPTY_STRING,
const string type = DEFAULT_TYPE_STRING,
const string node = EMPTY_STRING 
)
inline

Add a NodeDef to the document.

Parameters
nameThe name of the new NodeDef. If no name is specified, then a unique name will automatically be generated.
typeAn optional type string. If specified, then the new NodeDef will be assigned an Output of the given type.
nodeAn optional node string.
Returns
A shared pointer to the new NodeDef.

Definition at line 343 of file Document.h.

NodeDefPtr Document::addNodeDefFromGraph ( NodeGraphPtr  nodeGraph,
const string nodeDefName,
const string category,
const string newGraphName 
)

Create a NodeDef and Functional Graph based on a Compound NodeGraph

Parameters
nodeGraphCompound NodeGraph.
newGraphNameName of new functional NodeGraph.
nodeDefNameName of new NodeDef
categoryCategory of the new NodeDef
Returns
New declaration if successful.
NodeDefPtr Document::addNodeDefFromGraph ( NodeGraphPtr  nodeGraph,
const string nodeDefName,
const string node,
const string version,
bool  isDefaultVersion,
const string nodeGroup,
const string newGraphName 
)
NodeGraphPtr Document::addNodeGraph ( const string name = EMPTY_STRING)
inline

Add a NodeGraph to the document.

Parameters
nameThe name of the new NodeGraph. If no name is specified, then a unique name will automatically be generated.
Returns
A shared pointer to the new NodeGraph.

Definition at line 96 of file Document.h.

PropertySetPtr Document::addPropertySet ( const string name = EMPTY_STRING)
inline

Add a PropertySet to the document.

Parameters
nameThe name of the new PropertySet. If no name is specified, then a unique name will automatically be generated.
Returns
A shared pointer to the new PropertySet.

Definition at line 462 of file Document.h.

TargetDefPtr Document::addTargetDef ( const string name = EMPTY_STRING)
inline

Add an TargetDef to the document.

Parameters
nameThe name of the new TargetDef. If no name is specified, then a unique name will automatically be generated.
Returns
A shared pointer to the new TargetDef.

Definition at line 430 of file Document.h.

TypeDefPtr Document::addTypeDef ( const string name)
inline

Add a TypeDef to the document.

Parameters
nameThe name of the new TypeDef. If no name is specified, then a unique name will automatically be generated.
Returns
A shared pointer to the new TypeDef.

Definition at line 307 of file Document.h.

UnitDefPtr Document::addUnitDef ( const string name)
inline

Return the UnitDef, if any, with the given name.

Definition at line 558 of file Document.h.

UnitTypeDefPtr Document::addUnitTypeDef ( const string name)
inline

Return the UnitTypeDef, if any, with the given name.

Definition at line 589 of file Document.h.

VariantSetPtr Document::addVariantSet ( const string name = EMPTY_STRING)
inline

Add a VariantSet to the document.

Parameters
nameThe name of the new VariantSet. If no name is specified, then a unique name will automatically be generated.
Returns
A shared pointer to the new VariantSet.

Definition at line 494 of file Document.h.

virtual DocumentPtr Document::copy ( ) const
inlinevirtual

Create a deep copy of the document.

Definition at line 49 of file Document.h.

template<class T >
MX_CORE_API DocumentPtr createDocument ( )
inlinestatic

Create a new document of the given subclass.

Create a new Document.

Definition at line 38 of file Document.h.

AttributeDefPtr Document::getAttributeDef ( const string name) const
inline

Return the AttributeDef, if any, with the given name.

Definition at line 404 of file Document.h.

vector<AttributeDefPtr> Document::getAttributeDefs ( ) const
inline

Return a vector of all AttributeDef elements in the document.

Definition at line 410 of file Document.h.

CollectionPtr Document::getCollection ( const string name) const
inline

Return the Collection, if any, with the given name.

Definition at line 281 of file Document.h.

vector<CollectionPtr> Document::getCollections ( ) const
inline

Return a vector of all Collection elements in the document.

Definition at line 287 of file Document.h.

const string& Document::getColorManagementConfig ( ) const
inline

Return the color management config string.

Definition at line 666 of file Document.h.

const string& Document::getColorManagementSystem ( ) const
inline

Return the color management system string.

Definition at line 644 of file Document.h.

ConstDocumentPtr Document::getDataLibrary ( ) const
inline

Return the data library, if any, referenced by this document.

Definition at line 76 of file Document.h.

GeomInfoPtr Document::getGeomInfo ( const string name) const
inline

Return the GeomInfo, if any, with the given name.

Definition at line 142 of file Document.h.

vector<GeomInfoPtr> Document::getGeomInfos ( ) const
inline

Return a vector of all GeomInfo elements in the document.

Definition at line 148 of file Document.h.

GeomPropDefPtr Document::getGeomPropDef ( const string name) const
inline

Return the GeomPropDef, if any, with the given name.

Definition at line 178 of file Document.h.

vector<GeomPropDefPtr> Document::getGeomPropDefs ( ) const
inline

Return a vector of all GeomPropDef elements in the document.

Definition at line 184 of file Document.h.

ValuePtr Document::getGeomPropValue ( const string geomPropName,
const string geom = UNIVERSAL_GEOM_NAME 
) const

Return the value of a geometric property for the given geometry string.

ImplementationPtr Document::getImplementation ( const string name) const
inline

Return the Implementation, if any, with the given name.

Definition at line 532 of file Document.h.

vector<ImplementationPtr> Document::getImplementations ( ) const
inline

Return a vector of all Implementation elements in the document.

Definition at line 538 of file Document.h.

LookPtr Document::getLook ( const string name) const
inline

Return the Look, if any, with the given name.

Definition at line 217 of file Document.h.

LookGroupPtr Document::getLookGroup ( const string name) const
inline

Return the LookGroup, if any, with the given name.

Definition at line 249 of file Document.h.

vector<LookGroupPtr> Document::getLookGroups ( ) const
inline

Return a vector of all LookGroup elements in the document.

Definition at line 255 of file Document.h.

vector<LookPtr> Document::getLooks ( ) const
inline

Return a vector of all Look elements in the document.

Definition at line 223 of file Document.h.

vector<InterfaceElementPtr> Document::getMatchingImplementations ( const string nodeDef) const

Return a vector of all node implementations that match the given NodeDef string. Note that a node implementation may be either an Implementation element or NodeGraph element.

vector<NodeDefPtr> Document::getMatchingNodeDefs ( const string nodeName) const

Return a vector of all NodeDef elements that match the given node name.

vector<PortElementPtr> Document::getMatchingPorts ( const string nodeName) const

Return a vector of all port elements that match the given node name. Port elements support spatially-varying upstream connections to nodes, and include both Input and Output elements.

vector<OutputPtr> Document::getMaterialOutputs ( ) const

Return material-type outputs for all nodegraphs in the document.

NodeDefPtr Document::getNodeDef ( const string name) const
inline

Return the NodeDef, if any, with the given name.

Definition at line 369 of file Document.h.

vector<NodeDefPtr> Document::getNodeDefs ( ) const
inline

Return a vector of all NodeDef elements in the document.

Definition at line 375 of file Document.h.

NodeGraphPtr Document::getNodeGraph ( const string name) const
inline

Return the NodeGraph, if any, with the given name.

Definition at line 102 of file Document.h.

vector<NodeGraphPtr> Document::getNodeGraphs ( ) const
inline

Return a vector of all NodeGraph elements in the document.

Definition at line 108 of file Document.h.

PropertySetPtr Document::getPropertySet ( const string name) const
inline

Return the PropertySet, if any, with the given name.

Definition at line 468 of file Document.h.

vector<PropertySetPtr> Document::getPropertySets ( ) const
inline

Return a vector of all PropertySet elements in the document.

Definition at line 474 of file Document.h.

StringSet Document::getReferencedSourceUris ( ) const

Get a list of source URIs referenced by the document.

TargetDefPtr Document::getTargetDef ( const string name) const
inline

Return the AttributeDef, if any, with the given name.

Definition at line 436 of file Document.h.

vector<TargetDefPtr> Document::getTargetDefs ( ) const
inline

Return a vector of all TargetDef elements in the document.

Definition at line 442 of file Document.h.

TypeDefPtr Document::getTypeDef ( const string name) const
inline

Return the TypeDef, if any, with the given name.

Definition at line 313 of file Document.h.

vector<TypeDefPtr> Document::getTypeDefs ( ) const
inline

Return a vector of all TypeDef elements in the document.

Definition at line 319 of file Document.h.

UnitDefPtr Document::getUnitDef ( const string name) const
inline

Return the UnitDef, if any, with the given name.

Definition at line 568 of file Document.h.

vector<UnitDefPtr> Document::getUnitDefs ( ) const
inline

Return a vector of all Member elements in the TypeDef.

Definition at line 574 of file Document.h.

UnitTypeDefPtr Document::getUnitTypeDef ( const string name) const
inline

Return the UnitTypeDef, if any, with the given name.

Definition at line 599 of file Document.h.

vector<UnitTypeDefPtr> Document::getUnitTypeDefs ( ) const
inline

Return a vector of all UnitTypeDef elements in the document.

Definition at line 605 of file Document.h.

VariantSetPtr Document::getVariantSet ( const string name) const
inline

Return the VariantSet, if any, with the given name.

Definition at line 500 of file Document.h.

vector<VariantSetPtr> Document::getVariantSets ( ) const
inline

Return a vector of all VariantSet elements in the document.

Definition at line 506 of file Document.h.

std::pair<int, int> Document::getVersionIntegers ( ) const
overridevirtual

Return the major and minor versions as an integer pair.

Reimplemented from InterfaceElement.

bool Document::hasColorManagementConfig ( ) const
inline

Return true if a color management config string has been set.

Definition at line 660 of file Document.h.

bool Document::hasColorManagementSystem ( ) const
inline

Return true if a color management system string has been set.

Definition at line 638 of file Document.h.

bool Document::hasDataLibrary ( ) const
inline

Return true if this document has a data library.

Definition at line 70 of file Document.h.

void Document::importLibrary ( const ConstDocumentPtr library)

Import the given data library into this document. The contents of the data library are copied into this one, and are assigned the source URI of the library.

Parameters
libraryThe data library to be imported.
virtual void Document::initialize ( )
virtual

Initialize the document, removing any existing content.

void Document::invalidateCache ( )

Invalidate cached data for optimized lookups within the given document.

void Document::removeAttributeDef ( const string name)
inline

Remove the AttributeDef, if any, with the given name.

Definition at line 416 of file Document.h.

void Document::removeCollection ( const string name)
inline

Remove the Collection, if any, with the given name.

Definition at line 293 of file Document.h.

void Document::removeGeomInfo ( const string name)
inline

Remove the GeomInfo, if any, with the given name.

Definition at line 154 of file Document.h.

void Document::removeGeomPropDef ( const string name)
inline

Remove the GeomPropDef, if any, with the given name.

Definition at line 190 of file Document.h.

void Document::removeImplementation ( const string name)
inline

Remove the Implementation, if any, with the given name.

Definition at line 544 of file Document.h.

void Document::removeLook ( const string name)
inline

Remove the Look, if any, with the given name.

Definition at line 229 of file Document.h.

void Document::removeLookGroup ( const string name)
inline

Remove the LookGroup, if any, with the given name.

Definition at line 261 of file Document.h.

void Document::removeNodeDef ( const string name)
inline

Remove the NodeDef, if any, with the given name.

Definition at line 381 of file Document.h.

void Document::removeNodeGraph ( const string name)
inline

Remove the NodeGraph, if any, with the given name.

Definition at line 114 of file Document.h.

void Document::removePropertySet ( const string name)
inline

Remove the PropertySet, if any, with the given name.

Definition at line 480 of file Document.h.

void Document::removeTargetDef ( const string name)
inline

Remove the TargetDef, if any, with the given name.

Definition at line 448 of file Document.h.

void Document::removeTypeDef ( const string name)
inline

Remove the TypeDef, if any, with the given name.

Definition at line 325 of file Document.h.

void Document::removeUnitDef ( const string name)
inline

Remove the UnitDef, if any, with the given name.

Definition at line 580 of file Document.h.

void Document::removeUnitTypeDef ( const string name)
inline

Remove the UnitTypeDef, if any, with the given name.

Definition at line 611 of file Document.h.

void Document::removeVariantSet ( const string name)
inline

Remove the VariantSet, if any, with the given name.

Definition at line 512 of file Document.h.

void Document::setColorManagementConfig ( const string cmsConfig)
inline

Set the color management config string.

Definition at line 654 of file Document.h.

void Document::setColorManagementSystem ( const string cms)
inline

Set the color management system string.

Definition at line 632 of file Document.h.

void Document::setDataLibrary ( ConstDocumentPtr  dataLibrary)
inline

Store a reference to a data library in this document.

Definition at line 64 of file Document.h.

void Document::upgradeVersion ( )

Upgrade the content of this document from earlier supported versions to the library version.

bool Document::validate ( string message = nullptr) const
overridevirtual

Validate that the given document is consistent with the MaterialX specification.

Parameters
messageAn optional output string, to which a description of each error will be appended.
Returns
True if the document passes all tests, false otherwise.

Reimplemented from Element.

Member Data Documentation

const string Document::CATEGORY
static

Definition at line 699 of file Document.h.

const string Document::CMS_ATTRIBUTE
static

Definition at line 700 of file Document.h.

const string Document::CMS_CONFIG_ATTRIBUTE
static

Definition at line 701 of file Document.h.


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