Skip to content

Commit 4d19085

Browse files
committed
Doxygen docs insertion into pybind cpp code.
1 parent 0c1ed1e commit 4d19085

49 files changed

Lines changed: 1714 additions & 982 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

documents/Doxyfile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ FULL_SIDEBAR = NO
2323

2424
QUIET = YES
2525
WARN_IF_UNDOCUMENTED = NO
26+
27+
GENERATE_XML = YES
28+
XML_OUTPUT = doxygen_xml

python/Scripts/pybind_docs.py

Lines changed: 729 additions & 0 deletions
Large diffs are not rendered by default.

source/PyMaterialX/PyMaterialXCore/PyDefinition.cpp

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ namespace mx = MaterialX;
1414

1515
void bindPyDefinition(py::module& mod)
1616
{
17-
py::class_<mx::NodeDef, mx::NodeDefPtr, mx::InterfaceElement>(mod, "NodeDef")
18-
.def("setNodeString", &mx::NodeDef::setNodeString)
19-
.def("hasNodeString", &mx::NodeDef::hasNodeString)
20-
.def("getNodeString", &mx::NodeDef::getNodeString)
21-
.def("setNodeGroup", &mx::NodeDef::setNodeGroup)
22-
.def("hasNodeGroup", &mx::NodeDef::hasNodeGroup)
23-
.def("getNodeGroup", &mx::NodeDef::getNodeGroup)
24-
.def("getImplementation", &mx::NodeDef::getImplementation)
17+
py::class_<mx::NodeDef, mx::NodeDefPtr, mx::InterfaceElement>(mod, "NodeDef", "A node definition element within a Document.\n\nA NodeDef provides the declaration of a node interface, which may then be instantiated as a Node.")
18+
.def("setNodeString", &mx::NodeDef::setNodeString, "Set the node string of the NodeDef.")
19+
.def("hasNodeString", &mx::NodeDef::hasNodeString, "Return true if the given NodeDef has a node string.")
20+
.def("getNodeString", &mx::NodeDef::getNodeString, "Return the node string of the NodeDef.")
21+
.def("setNodeGroup", &mx::NodeDef::setNodeGroup, "Set the node group of the NodeDef.")
22+
.def("hasNodeGroup", &mx::NodeDef::hasNodeGroup, "Return true if the given NodeDef has a node group.")
23+
.def("getNodeGroup", &mx::NodeDef::getNodeGroup, "Return the node group of the NodeDef.")
24+
.def("getImplementation", &mx::NodeDef::getImplementation, "Return the Implementation, if any, with the given name.")
2525
.def("getImplementation", &mx::NodeDef::getImplementation,
26-
py::arg("target") = mx::EMPTY_STRING)
27-
.def("isVersionCompatible", &mx::NodeDef::isVersionCompatible)
26+
py::arg("target") = mx::EMPTY_STRING, "Return the Implementation, if any, with the given name.")
27+
.def("isVersionCompatible", &mx::NodeDef::isVersionCompatible, "Return true if the given version string is compatible with this NodeDef.\n\nThis may be used to test, for example, whether a NodeDef and Node may be used together.")
2828
.def_readonly_static("CATEGORY", &mx::NodeDef::CATEGORY)
2929
.def_readonly_static("NODE_ATTRIBUTE", &mx::NodeDef::NODE_ATTRIBUTE)
3030
.def_readonly_static("TEXTURE_NODE_GROUP", &mx::NodeDef::TEXTURE_NODE_GROUP)
@@ -36,70 +36,70 @@ void bindPyDefinition(py::module& mod)
3636
.def_readonly_static("ORGANIZATION_NODE_GROUP", &mx::NodeDef::ORGANIZATION_NODE_GROUP)
3737
.def_readonly_static("TRANSLATION_NODE_GROUP", &mx::NodeDef::TRANSLATION_NODE_GROUP);
3838

39-
py::class_<mx::Implementation, mx::ImplementationPtr, mx::InterfaceElement>(mod, "Implementation")
40-
.def("setFile", &mx::Implementation::setFile)
41-
.def("hasFile", &mx::Implementation::hasFile)
42-
.def("getFile", &mx::Implementation::getFile)
43-
.def("setFunction", &mx::Implementation::setFunction)
44-
.def("hasFunction", &mx::Implementation::hasFunction)
45-
.def("getFunction", &mx::Implementation::getFunction)
46-
.def("setNodeDef", &mx::Implementation::setNodeDef)
47-
.def("getNodeDef", &mx::Implementation::getNodeDef)
48-
.def("setNodeGraph", &mx::Implementation::setNodeGraph)
49-
.def("hasNodeGraph", &mx::Implementation::hasNodeGraph)
50-
.def("getNodeGraph", &mx::Implementation::getNodeGraph)
39+
py::class_<mx::Implementation, mx::ImplementationPtr, mx::InterfaceElement>(mod, "Implementation", "An implementation element within a Document.\n\nAn Implementation is used to associate external source code with a specific NodeDef, providing a definition for the node that may either be universal or restricted to a specific target.")
40+
.def("setFile", &mx::Implementation::setFile, "Set the file string for the Implementation.")
41+
.def("hasFile", &mx::Implementation::hasFile, "Return true if the given Implementation has a file string.")
42+
.def("getFile", &mx::Implementation::getFile, "Return the file string for the Implementation.")
43+
.def("setFunction", &mx::Implementation::setFunction, "Set the function string for the Implementation.")
44+
.def("hasFunction", &mx::Implementation::hasFunction, "Return true if the given Implementation has a function string.")
45+
.def("getFunction", &mx::Implementation::getFunction, "Return the function string for the Implementation.")
46+
.def("setNodeDef", &mx::Implementation::setNodeDef, "Set the NodeDef element referenced by the Implementation.")
47+
.def("getNodeDef", &mx::Implementation::getNodeDef, "Returns a nodedef for a given transform.")
48+
.def("setNodeGraph", &mx::Implementation::setNodeGraph, "Set the nodegraph string for the Implementation.")
49+
.def("hasNodeGraph", &mx::Implementation::hasNodeGraph, "Return true if the given Implementation has a nodegraph string.")
50+
.def("getNodeGraph", &mx::Implementation::getNodeGraph, "Return the NodeGraph, if any, with the given name.")
5151
.def_readonly_static("CATEGORY", &mx::Implementation::CATEGORY)
5252
.def_readonly_static("FILE_ATTRIBUTE", &mx::Implementation::FILE_ATTRIBUTE)
5353
.def_readonly_static("FUNCTION_ATTRIBUTE", &mx::Implementation::FUNCTION_ATTRIBUTE);
5454

55-
py::class_<mx::TypeDef, mx::TypeDefPtr, mx::Element>(mod, "TypeDef")
56-
.def("setSemantic", &mx::TypeDef::setSemantic)
57-
.def("hasSemantic", &mx::TypeDef::hasSemantic)
58-
.def("getSemantic", &mx::TypeDef::getSemantic)
59-
.def("setContext", &mx::TypeDef::setContext)
60-
.def("hasContext", &mx::TypeDef::hasContext)
61-
.def("getContext", &mx::TypeDef::getContext)
55+
py::class_<mx::TypeDef, mx::TypeDefPtr, mx::Element>(mod, "TypeDef", "A type definition element within a Document.")
56+
.def("setSemantic", &mx::TypeDef::setSemantic, "Set the variable semantic of this port.")
57+
.def("hasSemantic", &mx::TypeDef::hasSemantic, "Return true if the given TypeDef has a semantic string.")
58+
.def("getSemantic", &mx::TypeDef::getSemantic, "Return the variable semantic of this port.")
59+
.def("setContext", &mx::TypeDef::setContext, "Set the context string of the TypeDef.")
60+
.def("hasContext", &mx::TypeDef::hasContext, "Return true if the given TypeDef has a context string.")
61+
.def("getContext", &mx::TypeDef::getContext, "Return the context string of the TypeDef.")
6262
.def("addMember", &mx::TypeDef::addMember,
63-
py::arg("name") = mx::EMPTY_STRING)
64-
.def("getMember", &mx::TypeDef::getMember)
63+
py::arg("name") = mx::EMPTY_STRING, "Add a Member to the TypeDef.\n\nArgs:\n name: The name of the new Member. If no name is specified, then a unique name will automatically be generated.\n\nReturns:\n A shared pointer to the new Member.")
64+
.def("getMember", &mx::TypeDef::getMember, "Return the Member, if any, with the given name.")
6565
.def("getMembers", &mx::TypeDef::getMembers)
66-
.def("removeMember", &mx::TypeDef::removeMember)
66+
.def("removeMember", &mx::TypeDef::removeMember, "Remove the Member, if any, with the given name.")
6767
.def_readonly_static("CATEGORY", &mx::TypeDef::CATEGORY)
6868
.def_readonly_static("SEMANTIC_ATTRIBUTE", &mx::TypeDef::SEMANTIC_ATTRIBUTE)
6969
.def_readonly_static("CONTEXT_ATTRIBUTE", &mx::TypeDef::CONTEXT_ATTRIBUTE);
7070

71-
py::class_<mx::Member, mx::MemberPtr, mx::TypedElement>(mod, "Member")
71+
py::class_<mx::Member, mx::MemberPtr, mx::TypedElement>(mod, "Member", "A member element within a TypeDef.")
7272
.def_readonly_static("CATEGORY", &mx::TypeDef::CATEGORY);
7373

74-
py::class_<mx::Unit, mx::UnitPtr, mx::Element>(mod, "Unit")
74+
py::class_<mx::Unit, mx::UnitPtr, mx::Element>(mod, "Unit", "A unit declaration within a UnitDef.")
7575
.def_readonly_static("CATEGORY", &mx::Unit::CATEGORY);
7676

77-
py::class_<mx::UnitDef, mx::UnitDefPtr, mx::Element>(mod, "UnitDef")
78-
.def("setUnitType", &mx::UnitDef::setUnitType)
79-
.def("hasUnitType", &mx::UnitDef::hasUnitType)
80-
.def("getUnitType", &mx::UnitDef::getUnitType)
81-
.def("addUnit", &mx::UnitDef::addUnit)
82-
.def("getUnit", &mx::UnitDef::getUnit)
83-
.def("getUnits", &mx::UnitDef::getUnits)
77+
py::class_<mx::UnitDef, mx::UnitDefPtr, mx::Element>(mod, "UnitDef", "A unit definition element within a Document.")
78+
.def("setUnitType", &mx::UnitDef::setUnitType, "Set the element's unittype string.")
79+
.def("hasUnitType", &mx::UnitDef::hasUnitType, "Return true if the given element has a unittype string.")
80+
.def("getUnitType", &mx::UnitDef::getUnitType, "Return the unit type string.")
81+
.def("addUnit", &mx::UnitDef::addUnit, "Add a Unit to the UnitDef.\n\nArgs:\n name: The name of the new Unit. An exception is thrown if the name provided is an empty string.\n\nReturns:\n A shared pointer to the new Unit.")
82+
.def("getUnit", &mx::UnitDef::getUnit, "Return the unit type for the value on this port.")
83+
.def("getUnits", &mx::UnitDef::getUnits, "Return a vector of all Unit elements in the UnitDef.")
8484
.def_readonly_static("CATEGORY", &mx::UnitDef::CATEGORY)
8585
.def_readonly_static("UNITTYPE_ATTRIBUTE", &mx::UnitDef::UNITTYPE_ATTRIBUTE);
8686

87-
py::class_<mx::UnitTypeDef, mx::UnitTypeDefPtr, mx::Element>(mod, "UnitTypeDef")
88-
.def("getUnitDefs", &mx::UnitTypeDef::getUnitDefs)
87+
py::class_<mx::UnitTypeDef, mx::UnitTypeDefPtr, mx::Element>(mod, "UnitTypeDef", "A unit type definition element within a Document.")
88+
.def("getUnitDefs", &mx::UnitTypeDef::getUnitDefs, "Return a vector of all Member elements in the TypeDef.")
8989
.def_readonly_static("CATEGORY", &mx::UnitTypeDef::CATEGORY);
9090

91-
py::class_<mx::AttributeDef, mx::AttributeDefPtr, mx::TypedElement>(mod, "AttributeDef")
92-
.def("setAttrName", &mx::AttributeDef::setAttrName)
93-
.def("hasAttrName", &mx::AttributeDef::hasAttrName)
94-
.def("getAttrName", &mx::AttributeDef::getAttrName)
95-
.def("setValueString", &mx::AttributeDef::setValueString)
96-
.def("hasValueString", &mx::AttributeDef::hasValueString)
97-
.def("getValueString", &mx::AttributeDef::getValueString)
98-
.def("setExportable", &mx::AttributeDef::setExportable)
99-
.def("getExportable", &mx::AttributeDef::getExportable)
91+
py::class_<mx::AttributeDef, mx::AttributeDefPtr, mx::TypedElement>(mod, "AttributeDef", "An attribute definition element within a Document.")
92+
.def("setAttrName", &mx::AttributeDef::setAttrName, "Set the element's attrname string.")
93+
.def("hasAttrName", &mx::AttributeDef::hasAttrName, "Return true if this element has an attrname string.")
94+
.def("getAttrName", &mx::AttributeDef::getAttrName, "Return the element's attrname string.")
95+
.def("setValueString", &mx::AttributeDef::setValueString, "Set the value string of an element.")
96+
.def("hasValueString", &mx::AttributeDef::hasValueString, "Return true if the given element has a value string.")
97+
.def("getValueString", &mx::AttributeDef::getValueString, "Return value string.")
98+
.def("setExportable", &mx::AttributeDef::setExportable, "Set the exportable boolean for the element.")
99+
.def("getExportable", &mx::AttributeDef::getExportable, "Return the exportable boolean for the element.\n\nDefaults to false if exportable is not set.")
100100
.def_readonly_static("CATEGORY", &mx::AttributeDef::CATEGORY);
101101

102-
py::class_<mx::TargetDef, mx::TargetDefPtr, mx::TypedElement>(mod, "TargetDef")
103-
.def("getMatchingTargets", &mx::TargetDef::getMatchingTargets)
102+
py::class_<mx::TargetDef, mx::TargetDefPtr, mx::TypedElement>(mod, "TargetDef", "A definition of an implementation target.")
103+
.def("getMatchingTargets", &mx::TargetDef::getMatchingTargets, "Return a vector of target names that is matching this targetdef either by itself of by its inheritance.\n\nThe vector is ordered by priority starting with this targetdef itself and then upwards in the inheritance hierarchy.")
104104
.def_readonly_static("CATEGORY", &mx::TargetDef::CATEGORY);
105105
}

0 commit comments

Comments
 (0)