Skip to content

Commit

Permalink
More fixes in header files in MaterialXCore. (#1567)
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Habel <19556655+StefanHabel@users.noreply.github.com>
  • Loading branch information
StefanHabel committed Oct 31, 2023
1 parent 77b5944 commit be2db5e
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 93 deletions.
42 changes: 21 additions & 21 deletions source/MaterialXCore/Definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class MX_CORE_API NodeDef : public InterfaceElement
setAttribute(NODE_ATTRIBUTE, node);
}

/// Return true if the given NodeDef has a node string.
/// Return true if this NodeDef has a node string.
bool hasNodeString() const
{
return hasAttribute(NODE_ATTRIBUTE);
Expand All @@ -121,7 +121,7 @@ class MX_CORE_API NodeDef : public InterfaceElement
setAttribute(NODE_GROUP_ATTRIBUTE, category);
}

/// Return true if the given NodeDef has a node group.
/// Return true if this NodeDef has a node group.
bool hasNodeGroup() const
{
return hasAttribute(NODE_GROUP_ATTRIBUTE);
Expand Down Expand Up @@ -207,7 +207,7 @@ class MX_CORE_API Implementation : public InterfaceElement
setAttribute(FILE_ATTRIBUTE, file);
}

/// Return true if the given Implementation has a file string.
/// Return true if this Implementation has a file string.
bool hasFile() const
{
return hasAttribute(FILE_ATTRIBUTE);
Expand All @@ -229,7 +229,7 @@ class MX_CORE_API Implementation : public InterfaceElement
setAttribute(FUNCTION_ATTRIBUTE, function);
}

/// Return true if the given Implementation has a function string.
/// Return true if this Implementation has a function string.
bool hasFunction() const
{
return hasAttribute(FUNCTION_ATTRIBUTE);
Expand All @@ -251,7 +251,7 @@ class MX_CORE_API Implementation : public InterfaceElement
setAttribute(NODE_GRAPH_ATTRIBUTE, nodegraph);
}

/// Return true if the given Implementation has a nodegraph string.
/// Return true if this Implementation has a nodegraph string.
bool hasNodeGraph() const
{
return hasAttribute(NODE_GRAPH_ATTRIBUTE);
Expand All @@ -277,7 +277,7 @@ class MX_CORE_API Implementation : public InterfaceElement
/// @name Validation
/// @{

/// Validate that the given element tree, including all descendants, is
/// Validate that this element tree, including all descendants, is
/// consistent with the MaterialX specification.
bool validate(string* message = nullptr) const override;

Expand All @@ -286,7 +286,7 @@ class MX_CORE_API Implementation : public InterfaceElement
/// @{

/// Return the first declaration of this interface, optionally filtered
/// by the given target name.
/// by the given target name.
ConstInterfaceElementPtr getDeclaration(const string& target = EMPTY_STRING) const override;

/// @}
Expand Down Expand Up @@ -318,7 +318,7 @@ class MX_CORE_API TypeDef : public Element
setAttribute(SEMANTIC_ATTRIBUTE, semantic);
}

/// Return true if the given TypeDef has a semantic string.
/// Return true if this TypeDef has a semantic string.
bool hasSemantic() const
{
return hasAttribute(SEMANTIC_ATTRIBUTE);
Expand All @@ -340,7 +340,7 @@ class MX_CORE_API TypeDef : public Element
setAttribute(CONTEXT_ATTRIBUTE, context);
}

/// Return true if the given TypeDef has a context string.
/// Return true if this TypeDef has a context string.
bool hasContext() const
{
return hasAttribute(CONTEXT_ATTRIBUTE);
Expand Down Expand Up @@ -458,18 +458,18 @@ class MX_CORE_API UnitDef : public Element
/// @{

/// Set the element's unittype string.
void setUnitType(const string& type)
void setUnitType(const string& unitType)
{
setAttribute(UNITTYPE_ATTRIBUTE, type);
setAttribute(UNITTYPE_ATTRIBUTE, unitType);
}

/// Return true if the given element has a unittype string.
/// Return true if this element has a unittype string.
bool hasUnitType() const
{
return hasAttribute(UNITTYPE_ATTRIBUTE);
}

/// Return the element's type string.
/// Return the element's unittype string.
const string& getUnitType() const
{
return getAttribute(UNITTYPE_ATTRIBUTE);
Expand All @@ -480,14 +480,14 @@ class MX_CORE_API UnitDef : public Element
/// @{

/// Add a Unit to the UnitDef.
/// @param name The name of the new Unit. An exception is thrown
/// if the name provided is an empty string.
/// @param name The name of the new Unit.
/// @return A shared pointer to the new Unit.
/// @throws Exception if an empty name is given.
UnitPtr addUnit(const string& name)
{
if (name.empty())
{
throw Exception("A unit definition name cannot be empty");
throw Exception("A unit name cannot be empty");
}
return addChild<Unit>(name);
}
Expand Down Expand Up @@ -571,19 +571,19 @@ class MX_CORE_API AttributeDef : public TypedElement
/// @name Value String
/// @{

/// Set the value string of an element.
/// Set the value string of the element.
void setValueString(const string& value)
{
setAttribute(VALUE_ATTRIBUTE, value);
}

/// Return true if the given element has a value string.
/// Return true if this element has a value string.
bool hasValueString() const
{
return hasAttribute(VALUE_ATTRIBUTE);
}

/// Get the value string of a element.
/// Return the value string of the element.
const string& getValueString() const
{
return getAttribute(VALUE_ATTRIBUTE);
Expand Down Expand Up @@ -650,13 +650,13 @@ class MX_CORE_API AttributeDef : public TypedElement
/// @name Exportable
/// @{

/// Set the exportable boolean for the element.
/// Set the exportable flag for the element.
void setExportable(bool value)
{
setTypedAttribute<bool>(EXPORTABLE_ATTRIBUTE, value);
}

/// Return the exportable boolean for the element.
/// Return the exportable flag for the element.
/// Defaults to false if exportable is not set.
bool getExportable() const
{
Expand Down
31 changes: 22 additions & 9 deletions source/MaterialXCore/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MX_CORE_API Document : public GraphElement
/// @param library The library document to be imported.
void importLibrary(const ConstDocumentPtr& library);

/// Get a list of source URI's referenced by the document
/// Get a list of source URI's referenced by the document.
StringSet getReferencedSourceUris() const;

/// @name NodeGraph Elements
Expand Down Expand Up @@ -338,13 +338,18 @@ class MX_CORE_API Document : public GraphElement
/// @param nodeDefName Declaration name
/// @param node Node type for the new declaration
/// @param version Version for the new declaration
/// @param isDefaultVersion If a version is specified is thie definition the default version
/// @param isDefaultVersion Flag that specifies whether the given `version` is the default version.
/// @param newGraphName Make a copy of this NodeGraph with the given name if a non-empty name is provided. Otherwise
/// modify the existing NodeGraph. Default value is an empty string.
/// @param nodeGroup Optional node group for the new declaration. The Default value is an emptry string.
/// modify the existing NodeGraph.
/// @param nodeGroup Optional node group for the new declaration.
/// @return New declaration if successful.
NodeDefPtr addNodeDefFromGraph(const NodeGraphPtr nodeGraph, const string& nodeDefName, const string& node, const string& version,
bool isDefaultVersion, const string& nodeGroup, const string& newGraphName);
NodeDefPtr addNodeDefFromGraph(const NodeGraphPtr nodeGraph,
const string& nodeDefName,
const string& node,
const string& version,
bool isDefaultVersion,
const string& nodeGroup,
const string& newGraphName);

/// Return the NodeDef, if any, with the given name.
NodeDefPtr getNodeDef(const string& name) const
Expand Down Expand Up @@ -403,7 +408,7 @@ class MX_CORE_API Document : public GraphElement
/// @name TargetDef Elements
/// @{

/// Add an TargetDef to the document.
/// Add a TargetDef to the document.
/// @param name The name of the new TargetDef.
/// If no name is specified, then a unique name will automatically be
/// generated.
Expand All @@ -413,7 +418,7 @@ class MX_CORE_API Document : public GraphElement
return addChild<TargetDef>(name);
}

/// Return the AttributeDef, if any, with the given name.
/// Return the TargetDef, if any, with the given name.
TargetDefPtr getTargetDef(const string& name) const
{
return getChildOfType<TargetDef>(name);
Expand Down Expand Up @@ -536,6 +541,10 @@ class MX_CORE_API Document : public GraphElement
/// @name UnitDef Elements
/// @{

/// Add a UnitDef to the document.
/// @param name The name of the new UnitDef.
/// @return A shared pointer to the new UnitDef.
/// @throws Exception if an empty name is given.
UnitDefPtr addUnitDef(const string& name)
{
if (name.empty())
Expand All @@ -551,7 +560,7 @@ class MX_CORE_API Document : public GraphElement
return getChildOfType<UnitDef>(name);
}

/// Return a vector of all Member elements in the TypeDef.
/// Return a vector of all UnitDef elements in the document.
vector<UnitDefPtr> getUnitDefs() const
{
return getChildrenOfType<UnitDef>();
Expand All @@ -567,6 +576,10 @@ class MX_CORE_API Document : public GraphElement
/// @name UnitTypeDef Elements
/// @{

/// Add a UnitTypeDef to the document.
/// @param name The name of the new UnitTypeDef.
/// @return A shared pointer to the new UnitTypeDef.
/// @throws Exception if an empty name is given.
UnitTypeDefPtr addUnitTypeDef(const string& name)
{
if (name.empty())
Expand Down
8 changes: 4 additions & 4 deletions source/MaterialXCore/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -1053,14 +1053,14 @@ class MX_CORE_API ValueElement : public TypedElement
return getAttribute(UNIT_ATTRIBUTE);
}

/// Return the unit defined by the assocaited NodeDef if this element
/// Return the unit defined by the associated NodeDef if this element
/// is a child of a Node.
const string& getActiveUnit() const;

/// Set the unit type of an element.
void setUnitType(const string& unit)
void setUnitType(const string& unitType)
{
setAttribute(UNITTYPE_ATTRIBUTE, unit);
setAttribute(UNITTYPE_ATTRIBUTE, unitType);
}

/// Return true if the given element has a unit type.
Expand All @@ -1085,7 +1085,7 @@ class MX_CORE_API ValueElement : public TypedElement
setTypedAttribute<bool>(UNIFORM_ATTRIBUTE, value);
}

/// The the uniform attribute flag for this element.
/// Return the uniform attribute flag for this element.
bool getIsUniform() const
{
return getTypedAttribute<bool>(UNIFORM_ATTRIBUTE);
Expand Down
4 changes: 2 additions & 2 deletions source/MaterialXCore/Geom.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,9 @@ class MX_CORE_API GeomPropDef : public TypedElement
/// @{

/// Set the index string of this element.
void setIndex(const string& space)
void setIndex(const string& index)
{
setAttribute(INDEX_ATTRIBUTE, space);
setAttribute(INDEX_ATTRIBUTE, index);
}

/// Return true if this element has an index string.
Expand Down
26 changes: 13 additions & 13 deletions source/MaterialXCore/Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ class MX_CORE_API PortElement : public ValueElement

/// Set the node name string of this element, creating a connection to
/// the Node with the given name within the same NodeGraph.
void setNodeName(const string& node)
void setNodeName(const string& nodeName)
{
setAttribute(NODE_NAME_ATTRIBUTE, node);
setAttribute(NODE_NAME_ATTRIBUTE, nodeName);
}

/// Return true if this element has a node name string.
Expand All @@ -91,9 +91,9 @@ class MX_CORE_API PortElement : public ValueElement
/// @{

/// Set the node graph string of this element.
void setNodeGraphString(const string& node)
void setNodeGraphString(const string& nodeGraph)
{
setAttribute(NODE_GRAPH_ATTRIBUTE, node);
setAttribute(NODE_GRAPH_ATTRIBUTE, nodeGraph);
}

/// Return true if this element has a node graph string.
Expand Down Expand Up @@ -219,19 +219,19 @@ class MX_CORE_API Input : public PortElement
/// @name Default Geometric Property
/// @{

/// Set the defaultgeomprop string for the input.
/// Set the defaultgeomprop string for this input.
void setDefaultGeomPropString(const string& geomprop)
{
setAttribute(DEFAULT_GEOM_PROP_ATTRIBUTE, geomprop);
}

/// Return true if the given input has a defaultgeomprop string.
/// Return true if this input has a defaultgeomprop string.
bool hasDefaultGeomPropString() const
{
return hasAttribute(DEFAULT_GEOM_PROP_ATTRIBUTE);
}

/// Return the defaultgeomprop string for the input.
/// Return the defaultgeomprop string for this input.
const string& getDefaultGeomPropString() const
{
return getAttribute(DEFAULT_GEOM_PROP_ATTRIBUTE);
Expand Down Expand Up @@ -341,7 +341,7 @@ class MX_CORE_API InterfaceElement : public TypedElement
setAttribute(NODE_DEF_ATTRIBUTE, nodeDef);
}

/// Return true if the given interface has a NodeDef string.
/// Return true if this interface has a NodeDef string.
bool hasNodeDefString() const
{
return hasAttribute(NODE_DEF_ATTRIBUTE);
Expand Down Expand Up @@ -453,13 +453,13 @@ class MX_CORE_API InterfaceElement : public TypedElement
/// taking inheritance into account.
vector<OutputPtr> getActiveOutputs() const;

/// Set the output to which the given input is connected, creating a
/// child input if needed. If the node argument is null, then any
/// Set the output to which the specified input is connected, creating a
/// child input if needed. If the output argument is null, then any
/// existing output connection on the input will be cleared.
void setConnectedOutput(const string& inputName, OutputPtr output);

/// Return the output connected to the given input. If the given input is
/// not present, then an empty OutputPtr is returned.
/// Return the output connected to the specified input. If the specified
/// input is not present, then an empty OutputPtr is returned.
OutputPtr getConnectedOutput(const string& inputName) const;

/// @}
Expand Down Expand Up @@ -571,7 +571,7 @@ class MX_CORE_API InterfaceElement : public TypedElement
setAttribute(TARGET_ATTRIBUTE, target);
}

/// Return true if the given interface has a target string.
/// Return true if this interface has a target string.
bool hasTarget() const
{
return hasAttribute(TARGET_ATTRIBUTE);
Expand Down
Loading

0 comments on commit be2db5e

Please sign in to comment.