6 #ifndef MATERIALX_DOCUMENT
7 #define MATERIALX_DOCUMENT
52 doc->copyContentFrom(
getSelf());
53 doc->setDataLibrary(getDataLibrary());
58 StringSet getReferencedSourceUris()
const;
66 _dataLibrary = dataLibrary;
72 return (_dataLibrary !=
nullptr);
98 return addChild<NodeGraph>(
name);
104 return getChildOfType<NodeGraph>(
name);
110 return getChildrenOfType<NodeGraph>();
116 removeChildOfType<NodeGraph>(
name);
122 vector<PortElementPtr> getMatchingPorts(
const string& nodeName)
const;
137 geomInfo->setGeom(geom);
144 return getChildOfType<GeomInfo>(
name);
150 return getChildrenOfType<GeomInfo>();
156 removeChildOfType<GeomInfo>(
name);
173 geomPropDef->setGeomProp(geomprop);
180 return getChildOfType<GeomPropDef>(
name);
186 return getChildrenOfType<GeomPropDef>();
192 removeChildOfType<GeomPropDef>(
name);
200 vector<OutputPtr> getMaterialOutputs()
const;
213 return addChild<Look>(
name);
219 return getChildOfType<Look>(
name);
225 return getChildrenOfType<Look>();
231 removeChildOfType<Look>(
name);
245 return addChild<LookGroup>(
name);
251 return getChildOfType<LookGroup>(
name);
257 return getChildrenOfType<LookGroup>();
263 removeChildOfType<LookGroup>(
name);
277 return addChild<Collection>(
name);
283 return getChildOfType<Collection>(
name);
289 return getChildrenOfType<Collection>();
295 removeChildOfType<Collection>(
name);
309 return addChild<TypeDef>(
name);
315 return getChildOfType<TypeDef>(
name);
321 return getChildrenOfType<TypeDef>();
327 removeChildOfType<TypeDef>(
name);
350 child->addOutput(
"out",
type);
354 child->setNodeString(node);
366 const string& category,
const string& newGraphName);
371 return getChildOfType<NodeDef>(
name);
377 return getChildrenOfType<NodeDef>();
383 removeChildOfType<NodeDef>(
name);
387 vector<NodeDefPtr> getMatchingNodeDefs(
const string& nodeName)
const;
400 return addChild<AttributeDef>(
name);
406 return getChildOfType<AttributeDef>(
name);
412 return getChildrenOfType<AttributeDef>();
418 removeChildOfType<AttributeDef>(
name);
432 return addChild<TargetDef>(
name);
438 return getChildOfType<TargetDef>(
name);
444 return getChildrenOfType<TargetDef>();
450 removeChildOfType<TargetDef>(
name);
464 return addChild<PropertySet>(
name);
470 return getChildOfType<PropertySet>(
name);
476 return getChildrenOfType<PropertySet>();
482 removeChildOfType<PropertySet>(
name);
496 return addChild<VariantSet>(
name);
502 return getChildOfType<VariantSet>(
name);
508 return getChildrenOfType<VariantSet>();
514 removeChildOfType<VariantSet>(
name);
528 return addChild<Implementation>(
name);
534 return getChildOfType<Implementation>(
name);
540 return getChildrenOfType<Implementation>();
546 removeChildOfType<Implementation>(
name);
552 vector<InterfaceElementPtr> getMatchingImplementations(
const string& nodeDef)
const;
562 throw Exception(
"A unit definition name cannot be empty");
564 return addChild<UnitDef>(
name);
570 return getChildOfType<UnitDef>(
name);
576 return getChildrenOfType<UnitDef>();
582 removeChildOfType<UnitDef>(
name);
593 throw Exception(
"A unit type definition name cannot be empty");
595 return addChild<UnitTypeDef>(
name);
601 return getChildOfType<UnitTypeDef>(
name);
607 return getChildrenOfType<UnitTypeDef>();
613 removeChildOfType<UnitTypeDef>(
name);
625 void upgradeVersion();
687 void invalidateCache();
696 bool isDefaultVersion,
const string& nodeGroup,
const string& newGraphName);
708 std::unique_ptr<Cache> _cache;
GLuint GLsizei const GLchar * message
static const string CMS_ATTRIBUTE
ImplementationPtr addImplementation(const string &name=EMPTY_STRING)
shared_ptr< NodeDef > NodeDefPtr
bool hasColorManagementConfig() const
Return true if a color management config string has been set.
vector< ImplementationPtr > getImplementations() const
Return a vector of all Implementation elements in the document.
shared_ptr< Collection > CollectionPtr
A shared pointer to a Collection.
TypeDefPtr getTypeDef(const string &name) const
Return the TypeDef, if any, with the given name.
ElementPtr getSelf()
Return our self pointer.
LookGroupPtr getLookGroup(const string &name) const
Return the LookGroup, if any, with the given name.
void removeTargetDef(const string &name)
Remove the TargetDef, if any, with the given name.
shared_ptr< TargetDef > TargetDefPtr
A shared pointer to a TargetDef.
#define MATERIALX_NAMESPACE_BEGIN
vector< TypeDefPtr > getTypeDefs() const
Return a vector of all TypeDef elements in the document.
shared_ptr< AttributeDef > AttributeDefPtr
A shared pointer to an AttributeDef.
GeomInfoPtr addGeomInfo(const string &name=EMPTY_STRING, const string &geom=UNIVERSAL_GEOM_NAME)
static const string CATEGORY
vector< LookPtr > getLooks() const
Return a vector of all Look elements in the document.
shared_ptr< Look > LookPtr
A shared pointer to a Look.
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string EMPTY_STRING
bool hasDataLibrary() const
Return true if this document has a data library.
vector< UnitTypeDefPtr > getUnitTypeDefs() const
Return a vector of all UnitTypeDef elements in the document.
const string & getAttribute(const string &attrib) const
void removeUnitTypeDef(const string &name)
Remove the UnitTypeDef, if any, with the given name.
void removeLookGroup(const string &name)
Remove the LookGroup, if any, with the given name.
AttributeDefPtr getAttributeDef(const string &name) const
Return the AttributeDef, if any, with the given name.
vector< UnitDefPtr > getUnitDefs() const
Return a vector of all Member elements in the TypeDef.
const string & getColorManagementConfig() const
Return the color management config string.
class OCIOEXPORT Exception
shared_ptr< GeomInfo > GeomInfoPtr
A shared pointer to a GeomInfo.
static const string CMS_CONFIG_ATTRIBUTE
bool hasColorManagementSystem() const
Return true if a color management system string has been set.
shared_ptr< VariantSet > VariantSetPtr
A shared pointer to a VariantSet.
void removeCollection(const string &name)
Remove the Collection, if any, with the given name.
shared_ptr< UnitTypeDef > UnitTypeDefPtr
A shared pointer to a UnitTypeDef.
TypeDefPtr addTypeDef(const string &name)
shared_ptr< PropertySet > PropertySetPtr
A shared pointer to a PropertySet.
vector< NodeDefPtr > getNodeDefs() const
Return a vector of all NodeDef elements in the document.
virtual std::pair< int, int > getVersionIntegers() const
Return the major and minor versions as an integer pair.
shared_ptr< LookGroup > LookGroupPtr
A shared pointer to a LookGroup.
GLint GLint GLsizei GLint GLenum GLenum type
shared_ptr< const Document > ConstDocumentPtr
void removeGeomInfo(const string &name)
Remove the GeomInfo, if any, with the given name.
LookPtr getLook(const string &name) const
Return the Look, if any, with the given name.
NodeDefPtr addNodeDef(const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING, const string &node=EMPTY_STRING)
vector< VariantSetPtr > getVariantSets() const
Return a vector of all VariantSet elements in the document.
virtual bool validate(string *message=nullptr) const
ConstDocumentPtr getDataLibrary() const
Return the data library, if any, referenced by this document.
shared_ptr< Implementation > ImplementationPtr
A shared pointer to an Implementation.
vector< TargetDefPtr > getTargetDefs() const
Return a vector of all TargetDef elements in the document.
virtual DocumentPtr copy() const
Create a deep copy of the document.
PropertySetPtr addPropertySet(const string &name=EMPTY_STRING)
void removeImplementation(const string &name)
Remove the Implementation, if any, with the given name.
NodeDefPtr getNodeDef(const string &name) const
Return the NodeDef, if any, with the given name.
MX_CORE_API const string UNIVERSAL_GEOM_NAME
void removeNodeDef(const string &name)
Remove the NodeDef, if any, with the given name.
vector< AttributeDefPtr > getAttributeDefs() const
Return a vector of all AttributeDef elements in the document.
void setDataLibrary(ConstDocumentPtr dataLibrary)
Store a reference to a data library in this document.
UnitTypeDefPtr getUnitTypeDef(const string &name) const
Return the UnitTypeDef, if any, with the given name.
MX_CORE_API const string MULTI_OUTPUT_TYPE_STRING
void removeAttributeDef(const string &name)
Remove the AttributeDef, if any, with the given name.
GeomInfoPtr getGeomInfo(const string &name) const
Return the GeomInfo, if any, with the given name.
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
void removePropertySet(const string &name)
Remove the PropertySet, if any, with the given name.
shared_ptr< UnitDef > UnitDefPtr
A shared pointer to a UnitDef.
shared_ptr< GeomPropDef > GeomPropDefPtr
A shared pointer to a GeomPropDef.
vector< CollectionPtr > getCollections() const
Return a vector of all Collection elements in the document.
void removeGeomPropDef(const string &name)
Remove the GeomPropDef, if any, with the given name.
GLuint const GLchar * name
OPENVDB_API void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types. Also initializes blosc (if enabled).
LookPtr addLook(const string &name=EMPTY_STRING)
CollectionPtr getCollection(const string &name) const
Return the Collection, if any, with the given name.
void setColorManagementConfig(const string &cmsConfig)
Set the color management config string.
vector< LookGroupPtr > getLookGroups() const
Return a vector of all LookGroup elements in the document.
void removeUnitDef(const string &name)
Remove the UnitDef, if any, with the given name.
const string & getColorManagementSystem() const
Return the color management system string.
GT_API const UT_StringHolder version
ImplementationPtr getImplementation(const string &name) const
Return the Implementation, if any, with the given name.
void setAttribute(const string &attrib, const string &value)
Set the value string of the given attribute.
void setColorManagementSystem(const string &cms)
Set the color management system string.
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string DEFAULT_TYPE_STRING
shared_ptr< Document > DocumentPtr
GeomPropDefPtr addGeomPropDef(const string &name, const string &geomprop)
vector< GeomPropDefPtr > getGeomPropDefs() const
Return a vector of all GeomPropDef elements in the document.
vector< PropertySetPtr > getPropertySets() const
Return a vector of all PropertySet elements in the document.
TargetDefPtr getTargetDef(const string &name) const
Return the AttributeDef, if any, with the given name.
NodeGraphPtr getNodeGraph(const string &name) const
Return the NodeGraph, if any, with the given name.
bool hasAttribute(const string &attrib) const
Return true if the given attribute is present.
vector< GeomInfoPtr > getGeomInfos() const
Return a vector of all GeomInfo elements in the document.
void removeLook(const string &name)
Remove the Look, if any, with the given name.
static shared_ptr< T > createDocument()
Create a new document of the given subclass.
vector< NodeGraphPtr > getNodeGraphs() const
Return a vector of all NodeGraph elements in the document.
UnitDefPtr addUnitDef(const string &name)
Return the UnitDef, if any, with the given name.
UnitTypeDefPtr addUnitTypeDef(const string &name)
Return the UnitTypeDef, if any, with the given name.
std::set< string > StringSet
A set of strings.
NodeGraphPtr addNodeGraph(const string &name=EMPTY_STRING)
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
void removeTypeDef(const string &name)
Remove the TypeDef, if any, with the given name.
UnitDefPtr getUnitDef(const string &name) const
Return the UnitDef, if any, with the given name.
#define MATERIALX_NAMESPACE_END
LookGroupPtr addLookGroup(const string &name=EMPTY_STRING)
VariantSetPtr getVariantSet(const string &name) const
Return the VariantSet, if any, with the given name.
GeomPropDefPtr getGeomPropDef(const string &name) const
Return the GeomPropDef, if any, with the given name.
PropertySetPtr getPropertySet(const string &name) const
Return the PropertySet, if any, with the given name.
CollectionPtr addCollection(const string &name=EMPTY_STRING)
shared_ptr< Value > ValuePtr
A shared pointer to a Value.
AttributeDefPtr addAttributeDef(const string &name=EMPTY_STRING)
TargetDefPtr addTargetDef(const string &name=EMPTY_STRING)
shared_ptr< const Document > ConstDocumentPtr
A shared pointer to a const Document.
shared_ptr< NodeGraph > NodeGraphPtr
A shared pointer to a NodeGraph.
shared_ptr< class TypeDef > TypeDefPtr
void removeNodeGraph(const string &name)
Remove the NodeGraph, if any, with the given name.
VariantSetPtr addVariantSet(const string &name=EMPTY_STRING)
void removeVariantSet(const string &name)
Remove the VariantSet, if any, with the given name.
shared_ptr< NodeDef > NodeDefPtr
A shared pointer to a NodeDef.