HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Document.h
Go to the documentation of this file.
1 //
2 // Copyright Contributors to the MaterialX Project
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 
6 #ifndef MATERIALX_DOCUMENT
7 #define MATERIALX_DOCUMENT
8 
9 /// @file
10 /// The top-level Document class
11 
12 #include <MaterialXCore/Export.h>
13 
14 #include <MaterialXCore/Look.h>
15 #include <MaterialXCore/Node.h>
16 
18 
19 class Document;
20 
21 /// A shared pointer to a Document
22 using DocumentPtr = shared_ptr<Document>;
23 /// A shared pointer to a const Document
24 using ConstDocumentPtr = shared_ptr<const Document>;
25 
26 /// @class Document
27 /// A MaterialX document, which represents the top-level element in the
28 /// MaterialX ownership hierarchy.
29 ///
30 /// Use the factory function createDocument() to create a Document instance.
32 {
33  public:
34  Document(ElementPtr parent, const string& name);
35  virtual ~Document();
36 
37  /// Create a new document of the given subclass.
38  template <class T> static shared_ptr<T> createDocument()
39  {
40  shared_ptr<T> doc = std::make_shared<T>(ElementPtr(), EMPTY_STRING);
41  doc->initialize();
42  return doc;
43  }
44 
45  /// Initialize the document, removing any existing content.
46  virtual void initialize();
47 
48  /// Create a deep copy of the document.
49  virtual DocumentPtr copy() const
50  {
51  DocumentPtr doc = createDocument<Document>();
52  doc->copyContentFrom(getSelf());
53  doc->setDataLibrary(getDataLibrary());
54  return doc;
55  }
56 
57  /// Get a list of source URIs referenced by the document
58  StringSet getReferencedSourceUris() const;
59 
60  /// @name Data Libraries
61  /// @{
62 
63  /// Store a reference to a data library in this document.
64  void setDataLibrary(ConstDocumentPtr dataLibrary)
65  {
66  _dataLibrary = dataLibrary;
67  }
68 
69  /// Return true if this document has a data library.
70  bool hasDataLibrary() const
71  {
72  return (_dataLibrary != nullptr);
73  }
74 
75  /// Return the data library, if any, referenced by this document.
77  {
78  return _dataLibrary;
79  }
80 
81  /// Import the given data library into this document.
82  /// The contents of the data library are copied into this one, and
83  /// are assigned the source URI of the library.
84  /// @param library The data library to be imported.
85  void importLibrary(const ConstDocumentPtr& library);
86 
87  /// @}
88  /// @name NodeGraph Elements
89  /// @{
90 
91  /// Add a NodeGraph to the document.
92  /// @param name The name of the new NodeGraph.
93  /// If no name is specified, then a unique name will automatically be
94  /// generated.
95  /// @return A shared pointer to the new NodeGraph.
96  NodeGraphPtr addNodeGraph(const string& name = EMPTY_STRING)
97  {
98  return addChild<NodeGraph>(name);
99  }
100 
101  /// Return the NodeGraph, if any, with the given name.
102  NodeGraphPtr getNodeGraph(const string& name) const
103  {
104  return getChildOfType<NodeGraph>(name);
105  }
106 
107  /// Return a vector of all NodeGraph elements in the document.
108  vector<NodeGraphPtr> getNodeGraphs() const
109  {
110  return getChildrenOfType<NodeGraph>();
111  }
112 
113  /// Remove the NodeGraph, if any, with the given name.
114  void removeNodeGraph(const string& name)
115  {
116  removeChildOfType<NodeGraph>(name);
117  }
118 
119  /// Return a vector of all port elements that match the given node name.
120  /// Port elements support spatially-varying upstream connections to
121  /// nodes, and include both Input and Output elements.
122  vector<PortElementPtr> getMatchingPorts(const string& nodeName) const;
123 
124  /// @}
125  /// @name GeomInfo Elements
126  /// @{
127 
128  /// Add a GeomInfo to the document.
129  /// @param name The name of the new GeomInfo.
130  /// If no name is specified, then a unique name will automatically be
131  /// generated.
132  /// @param geom An optional geometry string for the GeomInfo.
133  /// @return A shared pointer to the new GeomInfo.
134  GeomInfoPtr addGeomInfo(const string& name = EMPTY_STRING, const string& geom = UNIVERSAL_GEOM_NAME)
135  {
136  GeomInfoPtr geomInfo = addChild<GeomInfo>(name);
137  geomInfo->setGeom(geom);
138  return geomInfo;
139  }
140 
141  /// Return the GeomInfo, if any, with the given name.
142  GeomInfoPtr getGeomInfo(const string& name) const
143  {
144  return getChildOfType<GeomInfo>(name);
145  }
146 
147  /// Return a vector of all GeomInfo elements in the document.
148  vector<GeomInfoPtr> getGeomInfos() const
149  {
150  return getChildrenOfType<GeomInfo>();
151  }
152 
153  /// Remove the GeomInfo, if any, with the given name.
154  void removeGeomInfo(const string& name)
155  {
156  removeChildOfType<GeomInfo>(name);
157  }
158 
159  /// Return the value of a geometric property for the given geometry string.
160  ValuePtr getGeomPropValue(const string& geomPropName, const string& geom = UNIVERSAL_GEOM_NAME) const;
161 
162  /// @}
163  /// @name GeomPropDef Elements
164  /// @{
165 
166  /// Add a GeomPropDef to the document.
167  /// @param name The name of the new GeomPropDef.
168  /// @param geomprop The geometric property to use for the GeomPropDef.
169  /// @return A shared pointer to the new GeomPropDef.
170  GeomPropDefPtr addGeomPropDef(const string& name, const string& geomprop)
171  {
172  GeomPropDefPtr geomPropDef = addChild<GeomPropDef>(name);
173  geomPropDef->setGeomProp(geomprop);
174  return geomPropDef;
175  }
176 
177  /// Return the GeomPropDef, if any, with the given name.
178  GeomPropDefPtr getGeomPropDef(const string& name) const
179  {
180  return getChildOfType<GeomPropDef>(name);
181  }
182 
183  /// Return a vector of all GeomPropDef elements in the document.
184  vector<GeomPropDefPtr> getGeomPropDefs() const
185  {
186  return getChildrenOfType<GeomPropDef>();
187  }
188 
189  /// Remove the GeomPropDef, if any, with the given name.
190  void removeGeomPropDef(const string& name)
191  {
192  removeChildOfType<GeomPropDef>(name);
193  }
194 
195  /// @}
196  /// @name Material Outputs
197  /// @{
198 
199  /// Return material-type outputs for all nodegraphs in the document.
200  vector<OutputPtr> getMaterialOutputs() const;
201 
202  /// @}
203  /// @name Look Elements
204  /// @{
205 
206  /// Add a Look to the document.
207  /// @param name The name of the new Look.
208  /// If no name is specified, then a unique name will automatically be
209  /// generated.
210  /// @return A shared pointer to the new Look.
211  LookPtr addLook(const string& name = EMPTY_STRING)
212  {
213  return addChild<Look>(name);
214  }
215 
216  /// Return the Look, if any, with the given name.
217  LookPtr getLook(const string& name) const
218  {
219  return getChildOfType<Look>(name);
220  }
221 
222  /// Return a vector of all Look elements in the document.
223  vector<LookPtr> getLooks() const
224  {
225  return getChildrenOfType<Look>();
226  }
227 
228  /// Remove the Look, if any, with the given name.
229  void removeLook(const string& name)
230  {
231  removeChildOfType<Look>(name);
232  }
233 
234  /// @}
235  /// @name LookGroup Elements
236  /// @{
237 
238  /// Add a LookGroup to the document.
239  /// @param name The name of the new LookGroup.
240  /// If no name is specified, then a unique name will automatically be
241  /// generated.
242  /// @return A shared pointer to the new LookGroup.
243  LookGroupPtr addLookGroup(const string& name = EMPTY_STRING)
244  {
245  return addChild<LookGroup>(name);
246  }
247 
248  /// Return the LookGroup, if any, with the given name.
249  LookGroupPtr getLookGroup(const string& name) const
250  {
251  return getChildOfType<LookGroup>(name);
252  }
253 
254  /// Return a vector of all LookGroup elements in the document.
255  vector<LookGroupPtr> getLookGroups() const
256  {
257  return getChildrenOfType<LookGroup>();
258  }
259 
260  /// Remove the LookGroup, if any, with the given name.
261  void removeLookGroup(const string& name)
262  {
263  removeChildOfType<LookGroup>(name);
264  }
265 
266  /// @}
267  /// @name Collection Elements
268  /// @{
269 
270  /// Add a Collection to the document.
271  /// @param name The name of the new Collection.
272  /// If no name is specified, then a unique name will automatically be
273  /// generated.
274  /// @return A shared pointer to the new Collection.
276  {
277  return addChild<Collection>(name);
278  }
279 
280  /// Return the Collection, if any, with the given name.
281  CollectionPtr getCollection(const string& name) const
282  {
283  return getChildOfType<Collection>(name);
284  }
285 
286  /// Return a vector of all Collection elements in the document.
287  vector<CollectionPtr> getCollections() const
288  {
289  return getChildrenOfType<Collection>();
290  }
291 
292  /// Remove the Collection, if any, with the given name.
293  void removeCollection(const string& name)
294  {
295  removeChildOfType<Collection>(name);
296  }
297 
298  /// @}
299  /// @name TypeDef Elements
300  /// @{
301 
302  /// Add a TypeDef to the document.
303  /// @param name The name of the new TypeDef.
304  /// If no name is specified, then a unique name will automatically be
305  /// generated.
306  /// @return A shared pointer to the new TypeDef.
307  TypeDefPtr addTypeDef(const string& name)
308  {
309  return addChild<TypeDef>(name);
310  }
311 
312  /// Return the TypeDef, if any, with the given name.
313  TypeDefPtr getTypeDef(const string& name) const
314  {
315  return getChildOfType<TypeDef>(name);
316  }
317 
318  /// Return a vector of all TypeDef elements in the document.
319  vector<TypeDefPtr> getTypeDefs() const
320  {
321  return getChildrenOfType<TypeDef>();
322  }
323 
324  /// Remove the TypeDef, if any, with the given name.
325  void removeTypeDef(const string& name)
326  {
327  removeChildOfType<TypeDef>(name);
328  }
329 
330  /// @}
331  /// @name NodeDef Elements
332  /// @{
333 
334  /// Add a NodeDef to the document.
335  /// @param name The name of the new NodeDef.
336  /// If no name is specified, then a unique name will automatically be
337  /// generated.
338  /// @param type An optional type string.
339  /// If specified, then the new NodeDef will be assigned an Output of
340  /// the given type.
341  /// @param node An optional node string.
342  /// @return A shared pointer to the new NodeDef.
343  NodeDefPtr addNodeDef(const string& name = EMPTY_STRING,
344  const string& type = DEFAULT_TYPE_STRING,
345  const string& node = EMPTY_STRING)
346  {
347  NodeDefPtr child = addChild<NodeDef>(name);
348  if (!type.empty() && type != MULTI_OUTPUT_TYPE_STRING)
349  {
350  child->addOutput("out", type);
351  }
352  if (!node.empty())
353  {
354  child->setNodeString(node);
355  }
356  return child;
357  }
358 
359  /// Create a NodeDef and Functional Graph based on a Compound NodeGraph
360  /// @param nodeGraph Compound NodeGraph.
361  /// @param newGraphName Name of new functional NodeGraph.
362  /// @param nodeDefName Name of new NodeDef
363  /// @param category Category of the new NodeDef
364  /// @return New declaration if successful.
365  NodeDefPtr addNodeDefFromGraph(NodeGraphPtr nodeGraph, const string& nodeDefName,
366  const string& category, const string& newGraphName);
367 
368  /// Return the NodeDef, if any, with the given name.
369  NodeDefPtr getNodeDef(const string& name) const
370  {
371  return getChildOfType<NodeDef>(name);
372  }
373 
374  /// Return a vector of all NodeDef elements in the document.
375  vector<NodeDefPtr> getNodeDefs() const
376  {
377  return getChildrenOfType<NodeDef>();
378  }
379 
380  /// Remove the NodeDef, if any, with the given name.
381  void removeNodeDef(const string& name)
382  {
383  removeChildOfType<NodeDef>(name);
384  }
385 
386  /// Return a vector of all NodeDef elements that match the given node name.
387  vector<NodeDefPtr> getMatchingNodeDefs(const string& nodeName) const;
388 
389  /// @}
390  /// @name AttributeDef Elements
391  /// @{
392 
393  /// Add an AttributeDef to the document.
394  /// @param name The name of the new AttributeDef.
395  /// If no name is specified, then a unique name will automatically be
396  /// generated.
397  /// @return A shared pointer to the new AttributeDef.
399  {
400  return addChild<AttributeDef>(name);
401  }
402 
403  /// Return the AttributeDef, if any, with the given name.
404  AttributeDefPtr getAttributeDef(const string& name) const
405  {
406  return getChildOfType<AttributeDef>(name);
407  }
408 
409  /// Return a vector of all AttributeDef elements in the document.
410  vector<AttributeDefPtr> getAttributeDefs() const
411  {
412  return getChildrenOfType<AttributeDef>();
413  }
414 
415  /// Remove the AttributeDef, if any, with the given name.
416  void removeAttributeDef(const string& name)
417  {
418  removeChildOfType<AttributeDef>(name);
419  }
420 
421  /// @}
422  /// @name TargetDef Elements
423  /// @{
424 
425  /// Add an TargetDef to the document.
426  /// @param name The name of the new TargetDef.
427  /// If no name is specified, then a unique name will automatically be
428  /// generated.
429  /// @return A shared pointer to the new TargetDef.
430  TargetDefPtr addTargetDef(const string& name = EMPTY_STRING)
431  {
432  return addChild<TargetDef>(name);
433  }
434 
435  /// Return the AttributeDef, if any, with the given name.
436  TargetDefPtr getTargetDef(const string& name) const
437  {
438  return getChildOfType<TargetDef>(name);
439  }
440 
441  /// Return a vector of all TargetDef elements in the document.
442  vector<TargetDefPtr> getTargetDefs() const
443  {
444  return getChildrenOfType<TargetDef>();
445  }
446 
447  /// Remove the TargetDef, if any, with the given name.
448  void removeTargetDef(const string& name)
449  {
450  removeChildOfType<TargetDef>(name);
451  }
452 
453  /// @}
454  /// @name PropertySet Elements
455  /// @{
456 
457  /// Add a PropertySet to the document.
458  /// @param name The name of the new PropertySet.
459  /// If no name is specified, then a unique name will automatically be
460  /// generated.
461  /// @return A shared pointer to the new PropertySet.
463  {
464  return addChild<PropertySet>(name);
465  }
466 
467  /// Return the PropertySet, if any, with the given name.
468  PropertySetPtr getPropertySet(const string& name) const
469  {
470  return getChildOfType<PropertySet>(name);
471  }
472 
473  /// Return a vector of all PropertySet elements in the document.
474  vector<PropertySetPtr> getPropertySets() const
475  {
476  return getChildrenOfType<PropertySet>();
477  }
478 
479  /// Remove the PropertySet, if any, with the given name.
480  void removePropertySet(const string& name)
481  {
482  removeChildOfType<PropertySet>(name);
483  }
484 
485  /// @}
486  /// @name VariantSet Elements
487  /// @{
488 
489  /// Add a VariantSet to the document.
490  /// @param name The name of the new VariantSet.
491  /// If no name is specified, then a unique name will automatically be
492  /// generated.
493  /// @return A shared pointer to the new VariantSet.
495  {
496  return addChild<VariantSet>(name);
497  }
498 
499  /// Return the VariantSet, if any, with the given name.
500  VariantSetPtr getVariantSet(const string& name) const
501  {
502  return getChildOfType<VariantSet>(name);
503  }
504 
505  /// Return a vector of all VariantSet elements in the document.
506  vector<VariantSetPtr> getVariantSets() const
507  {
508  return getChildrenOfType<VariantSet>();
509  }
510 
511  /// Remove the VariantSet, if any, with the given name.
512  void removeVariantSet(const string& name)
513  {
514  removeChildOfType<VariantSet>(name);
515  }
516 
517  /// @}
518  /// @name Implementation Elements
519  /// @{
520 
521  /// Add an Implementation to the document.
522  /// @param name The name of the new Implementation.
523  /// If no name is specified, then a unique name will automatically be
524  /// generated.
525  /// @return A shared pointer to the new Implementation.
527  {
528  return addChild<Implementation>(name);
529  }
530 
531  /// Return the Implementation, if any, with the given name.
532  ImplementationPtr getImplementation(const string& name) const
533  {
534  return getChildOfType<Implementation>(name);
535  }
536 
537  /// Return a vector of all Implementation elements in the document.
538  vector<ImplementationPtr> getImplementations() const
539  {
540  return getChildrenOfType<Implementation>();
541  }
542 
543  /// Remove the Implementation, if any, with the given name.
544  void removeImplementation(const string& name)
545  {
546  removeChildOfType<Implementation>(name);
547  }
548 
549  /// Return a vector of all node implementations that match the given
550  /// NodeDef string. Note that a node implementation may be either an
551  /// Implementation element or NodeGraph element.
552  vector<InterfaceElementPtr> getMatchingImplementations(const string& nodeDef) const;
553 
554  /// @}
555  /// @name UnitDef Elements
556  /// @{
557 
558  UnitDefPtr addUnitDef(const string& name)
559  {
560  if (name.empty())
561  {
562  throw Exception("A unit definition name cannot be empty");
563  }
564  return addChild<UnitDef>(name);
565  }
566 
567  /// Return the UnitDef, if any, with the given name.
568  UnitDefPtr getUnitDef(const string& name) const
569  {
570  return getChildOfType<UnitDef>(name);
571  }
572 
573  /// Return a vector of all Member elements in the TypeDef.
574  vector<UnitDefPtr> getUnitDefs() const
575  {
576  return getChildrenOfType<UnitDef>();
577  }
578 
579  /// Remove the UnitDef, if any, with the given name.
580  void removeUnitDef(const string& name)
581  {
582  removeChildOfType<UnitDef>(name);
583  }
584 
585  /// @}
586  /// @name UnitTypeDef Elements
587  /// @{
588 
589  UnitTypeDefPtr addUnitTypeDef(const string& name)
590  {
591  if (name.empty())
592  {
593  throw Exception("A unit type definition name cannot be empty");
594  }
595  return addChild<UnitTypeDef>(name);
596  }
597 
598  /// Return the UnitTypeDef, if any, with the given name.
599  UnitTypeDefPtr getUnitTypeDef(const string& name) const
600  {
601  return getChildOfType<UnitTypeDef>(name);
602  }
603 
604  /// Return a vector of all UnitTypeDef elements in the document.
605  vector<UnitTypeDefPtr> getUnitTypeDefs() const
606  {
607  return getChildrenOfType<UnitTypeDef>();
608  }
609 
610  /// Remove the UnitTypeDef, if any, with the given name.
611  void removeUnitTypeDef(const string& name)
612  {
613  removeChildOfType<UnitTypeDef>(name);
614  }
615 
616  /// @}
617  /// @name Version
618  /// @{
619 
620  /// Return the major and minor versions as an integer pair.
621  std::pair<int, int> getVersionIntegers() const override;
622 
623  /// Upgrade the content of this document from earlier supported versions to
624  /// the library version.
625  void upgradeVersion();
626 
627  /// @}
628  /// @name Color Management System
629  /// @{
630 
631  /// Set the color management system string.
632  void setColorManagementSystem(const string& cms)
633  {
634  setAttribute(CMS_ATTRIBUTE, cms);
635  }
636 
637  /// Return true if a color management system string has been set.
639  {
640  return hasAttribute(CMS_ATTRIBUTE);
641  }
642 
643  /// Return the color management system string.
644  const string& getColorManagementSystem() const
645  {
646  return getAttribute(CMS_ATTRIBUTE);
647  }
648 
649  /// @}
650  /// @name Color Management Config
651  /// @{
652 
653  /// Set the color management config string.
654  void setColorManagementConfig(const string& cmsConfig)
655  {
656  setAttribute(CMS_CONFIG_ATTRIBUTE, cmsConfig);
657  }
658 
659  /// Return true if a color management config string has been set.
661  {
662  return hasAttribute(CMS_CONFIG_ATTRIBUTE);
663  }
664 
665  /// Return the color management config string.
666  const string& getColorManagementConfig() const
667  {
668  return getAttribute(CMS_CONFIG_ATTRIBUTE);
669  }
670 
671  /// @}
672  /// @name Validation
673  /// @{
674 
675  /// Validate that the given document is consistent with the MaterialX
676  /// specification.
677  /// @param message An optional output string, to which a description of
678  /// each error will be appended.
679  /// @return True if the document passes all tests, false otherwise.
680  bool validate(string* message = nullptr) const override;
681 
682  /// @}
683  /// @name Utility
684  /// @{
685 
686  /// Invalidate cached data for optimized lookups within the given document.
687  void invalidateCache();
688 
689  /// @}
690 
691  //
692  // These are deprecated wrappers for older versions of the function interfaces in this module.
693  // Clients using these interfaces should update them to the latest API.
694  //
695  [[deprecated]] NodeDefPtr addNodeDefFromGraph(NodeGraphPtr nodeGraph, const string& nodeDefName, const string& node, const string& version,
696  bool isDefaultVersion, const string& nodeGroup, const string& newGraphName);
697 
698  public:
699  static const string CATEGORY;
700  static const string CMS_ATTRIBUTE;
701  static const string CMS_CONFIG_ATTRIBUTE;
702 
703  private:
704  class Cache;
705 
706  private:
707  ConstDocumentPtr _dataLibrary;
708  std::unique_ptr<Cache> _cache;
709 };
710 
711 /// Create a new Document.
712 /// @relates Document
713 MX_CORE_API DocumentPtr createDocument();
714 
716 
717 #endif
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
static const string CMS_ATTRIBUTE
Definition: Document.h:700
ImplementationPtr addImplementation(const string &name=EMPTY_STRING)
Definition: Document.h:526
shared_ptr< NodeDef > NodeDefPtr
Definition: Interface.h:325
bool hasColorManagementConfig() const
Return true if a color management config string has been set.
Definition: Document.h:660
vector< ImplementationPtr > getImplementations() const
Return a vector of all Implementation elements in the document.
Definition: Document.h:538
shared_ptr< Collection > CollectionPtr
A shared pointer to a Collection.
Definition: Geom.h:53
TypeDefPtr getTypeDef(const string &name) const
Return the TypeDef, if any, with the given name.
Definition: Document.h:313
ElementPtr getSelf()
Return our self pointer.
Definition: Element.h:538
LookGroupPtr getLookGroup(const string &name) const
Return the LookGroup, if any, with the given name.
Definition: Document.h:249
void removeTargetDef(const string &name)
Remove the TargetDef, if any, with the given name.
Definition: Document.h:448
shared_ptr< TargetDef > TargetDefPtr
A shared pointer to a TargetDef.
Definition: Definition.h:47
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
vector< TypeDefPtr > getTypeDefs() const
Return a vector of all TypeDef elements in the document.
Definition: Document.h:319
shared_ptr< AttributeDef > AttributeDefPtr
A shared pointer to an AttributeDef.
Definition: Definition.h:72
GeomInfoPtr addGeomInfo(const string &name=EMPTY_STRING, const string &geom=UNIVERSAL_GEOM_NAME)
Definition: Document.h:134
static const string CATEGORY
Definition: Document.h:699
vector< LookPtr > getLooks() const
Return a vector of all Look elements in the document.
Definition: Document.h:223
shared_ptr< Look > LookPtr
A shared pointer to a Look.
Definition: Look.h:27
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string EMPTY_STRING
bool hasDataLibrary() const
Return true if this document has a data library.
Definition: Document.h:70
vector< UnitTypeDefPtr > getUnitTypeDefs() const
Return a vector of all UnitTypeDef elements in the document.
Definition: Document.h:605
const string & getAttribute(const string &attrib) const
Definition: Element.h:492
void removeUnitTypeDef(const string &name)
Remove the UnitTypeDef, if any, with the given name.
Definition: Document.h:611
void removeLookGroup(const string &name)
Remove the LookGroup, if any, with the given name.
Definition: Document.h:261
AttributeDefPtr getAttributeDef(const string &name) const
Return the AttributeDef, if any, with the given name.
Definition: Document.h:404
vector< UnitDefPtr > getUnitDefs() const
Return a vector of all Member elements in the TypeDef.
Definition: Document.h:574
const string & getColorManagementConfig() const
Return the color management config string.
Definition: Document.h:666
class OCIOEXPORT Exception
shared_ptr< GeomInfo > GeomInfoPtr
A shared pointer to a GeomInfo.
Definition: Geom.h:38
#define MX_CORE_API
Definition: Export.h:18
static const string CMS_CONFIG_ATTRIBUTE
Definition: Document.h:701
bool hasColorManagementSystem() const
Return true if a color management system string has been set.
Definition: Document.h:638
shared_ptr< VariantSet > VariantSetPtr
A shared pointer to a VariantSet.
Definition: Variant.h:28
void removeCollection(const string &name)
Remove the Collection, if any, with the given name.
Definition: Document.h:293
shared_ptr< UnitTypeDef > UnitTypeDefPtr
A shared pointer to a UnitTypeDef.
Definition: Definition.h:67
TypeDefPtr addTypeDef(const string &name)
Definition: Document.h:307
shared_ptr< PropertySet > PropertySetPtr
A shared pointer to a PropertySet.
Definition: Property.h:34
vector< NodeDefPtr > getNodeDefs() const
Return a vector of all NodeDef elements in the document.
Definition: Document.h:375
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.
Definition: Look.h:32
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
shared_ptr< const Document > ConstDocumentPtr
Definition: Element.h:102
void removeGeomInfo(const string &name)
Remove the GeomInfo, if any, with the given name.
Definition: Document.h:154
LookPtr getLook(const string &name) const
Return the Look, if any, with the given name.
Definition: Document.h:217
NodeDefPtr addNodeDef(const string &name=EMPTY_STRING, const string &type=DEFAULT_TYPE_STRING, const string &node=EMPTY_STRING)
Definition: Document.h:343
vector< VariantSetPtr > getVariantSets() const
Return a vector of all VariantSet elements in the document.
Definition: Document.h:506
virtual bool validate(string *message=nullptr) const
ConstDocumentPtr getDataLibrary() const
Return the data library, if any, referenced by this document.
Definition: Document.h:76
shared_ptr< Implementation > ImplementationPtr
A shared pointer to an Implementation.
Definition: Definition.h:37
vector< TargetDefPtr > getTargetDefs() const
Return a vector of all TargetDef elements in the document.
Definition: Document.h:442
virtual DocumentPtr copy() const
Create a deep copy of the document.
Definition: Document.h:49
PropertySetPtr addPropertySet(const string &name=EMPTY_STRING)
Definition: Document.h:462
void removeImplementation(const string &name)
Remove the Implementation, if any, with the given name.
Definition: Document.h:544
NodeDefPtr getNodeDef(const string &name) const
Return the NodeDef, if any, with the given name.
Definition: Document.h:369
MX_CORE_API const string UNIVERSAL_GEOM_NAME
void removeNodeDef(const string &name)
Remove the NodeDef, if any, with the given name.
Definition: Document.h:381
vector< AttributeDefPtr > getAttributeDefs() const
Return a vector of all AttributeDef elements in the document.
Definition: Document.h:410
void setDataLibrary(ConstDocumentPtr dataLibrary)
Store a reference to a data library in this document.
Definition: Document.h:64
UnitTypeDefPtr getUnitTypeDef(const string &name) const
Return the UnitTypeDef, if any, with the given name.
Definition: Document.h:599
MX_CORE_API const string MULTI_OUTPUT_TYPE_STRING
void removeAttributeDef(const string &name)
Remove the AttributeDef, if any, with the given name.
Definition: Document.h:416
GeomInfoPtr getGeomInfo(const string &name) const
Return the GeomInfo, if any, with the given name.
Definition: Document.h:142
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:22
void removePropertySet(const string &name)
Remove the PropertySet, if any, with the given name.
Definition: Document.h:480
shared_ptr< UnitDef > UnitDefPtr
A shared pointer to a UnitDef.
Definition: Definition.h:62
shared_ptr< GeomPropDef > GeomPropDefPtr
A shared pointer to a GeomPropDef.
Definition: Geom.h:48
vector< CollectionPtr > getCollections() const
Return a vector of all Collection elements in the document.
Definition: Document.h:287
void removeGeomPropDef(const string &name)
Remove the GeomPropDef, if any, with the given name.
Definition: Document.h:190
GLuint const GLchar * name
Definition: glcorearb.h:786
OPENVDB_API void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types. Also initializes blosc (if enabled).
Definition: logging.h:294
LookPtr addLook(const string &name=EMPTY_STRING)
Definition: Document.h:211
CollectionPtr getCollection(const string &name) const
Return the Collection, if any, with the given name.
Definition: Document.h:281
void setColorManagementConfig(const string &cmsConfig)
Set the color management config string.
Definition: Document.h:654
vector< LookGroupPtr > getLookGroups() const
Return a vector of all LookGroup elements in the document.
Definition: Document.h:255
void removeUnitDef(const string &name)
Remove the UnitDef, if any, with the given name.
Definition: Document.h:580
const string & getColorManagementSystem() const
Return the color management system string.
Definition: Document.h:644
GT_API const UT_StringHolder version
ImplementationPtr getImplementation(const string &name) const
Return the Implementation, if any, with the given name.
Definition: Document.h:532
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.
Definition: Document.h:632
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string DEFAULT_TYPE_STRING
shared_ptr< Document > DocumentPtr
Definition: Element.h:101
GeomPropDefPtr addGeomPropDef(const string &name, const string &geomprop)
Definition: Document.h:170
vector< GeomPropDefPtr > getGeomPropDefs() const
Return a vector of all GeomPropDef elements in the document.
Definition: Document.h:184
vector< PropertySetPtr > getPropertySets() const
Return a vector of all PropertySet elements in the document.
Definition: Document.h:474
TargetDefPtr getTargetDef(const string &name) const
Return the AttributeDef, if any, with the given name.
Definition: Document.h:436
NodeGraphPtr getNodeGraph(const string &name) const
Return the NodeGraph, if any, with the given name.
Definition: Document.h:102
bool hasAttribute(const string &attrib) const
Return true if the given attribute is present.
Definition: Element.h:485
vector< GeomInfoPtr > getGeomInfos() const
Return a vector of all GeomInfo elements in the document.
Definition: Document.h:148
void removeLook(const string &name)
Remove the Look, if any, with the given name.
Definition: Document.h:229
static shared_ptr< T > createDocument()
Create a new document of the given subclass.
Definition: Document.h:38
vector< NodeGraphPtr > getNodeGraphs() const
Return a vector of all NodeGraph elements in the document.
Definition: Document.h:108
UnitDefPtr addUnitDef(const string &name)
Return the UnitDef, if any, with the given name.
Definition: Document.h:558
UnitTypeDefPtr addUnitTypeDef(const string &name)
Return the UnitTypeDef, if any, with the given name.
Definition: Document.h:589
std::set< string > StringSet
A set of strings.
Definition: Library.h:64
NodeGraphPtr addNodeGraph(const string &name=EMPTY_STRING)
Definition: Document.h:96
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
Definition: Element.h:31
void removeTypeDef(const string &name)
Remove the TypeDef, if any, with the given name.
Definition: Document.h:325
UnitDefPtr getUnitDef(const string &name) const
Return the UnitDef, if any, with the given name.
Definition: Document.h:568
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
LookGroupPtr addLookGroup(const string &name=EMPTY_STRING)
Definition: Document.h:243
VariantSetPtr getVariantSet(const string &name) const
Return the VariantSet, if any, with the given name.
Definition: Document.h:500
GeomPropDefPtr getGeomPropDef(const string &name) const
Return the GeomPropDef, if any, with the given name.
Definition: Document.h:178
PropertySetPtr getPropertySet(const string &name) const
Return the PropertySet, if any, with the given name.
Definition: Document.h:468
CollectionPtr addCollection(const string &name=EMPTY_STRING)
Definition: Document.h:275
shared_ptr< Value > ValuePtr
A shared pointer to a Value.
Definition: Value.h:30
AttributeDefPtr addAttributeDef(const string &name=EMPTY_STRING)
Definition: Document.h:398
TargetDefPtr addTargetDef(const string &name=EMPTY_STRING)
Definition: Document.h:430
shared_ptr< const Document > ConstDocumentPtr
A shared pointer to a const Document.
Definition: Document.h:24
shared_ptr< NodeGraph > NodeGraphPtr
A shared pointer to a NodeGraph.
Definition: Node.h:34
shared_ptr< class TypeDef > TypeDefPtr
Definition: Element.h:878
void removeNodeGraph(const string &name)
Remove the NodeGraph, if any, with the given name.
Definition: Document.h:114
VariantSetPtr addVariantSet(const string &name=EMPTY_STRING)
Definition: Document.h:494
void removeVariantSet(const string &name)
Remove the VariantSet, if any, with the given name.
Definition: Document.h:512
shared_ptr< NodeDef > NodeDefPtr
A shared pointer to a NodeDef.
Definition: Definition.h:32