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