Skip to content

Commit

Permalink
Merge pull request #1179 from autodesk-forks/adsk_contrib/compound_no…
Browse files Browse the repository at this point in the history
…de_doc_attr_fix

Fix the data types related to compound note doc attribute.
  • Loading branch information
lyuborusev authored Apr 30, 2021
2 parents 0fda845 + 591b6d3 commit 278bd45
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions source/MaterialXRuntime/RtNodeDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ const RtIdentifier& RtNodeDef::getNamespace() const
return attr ? attr->asIdentifier() : EMPTY_IDENTIFIER;
}

void RtNodeDef::setDoc(const RtIdentifier& info) {
void RtNodeDef::setDoc(const string& doc) {
RtTypedValue* attr = prim()->createAttribute(Identifiers::DOC, RtType::STRING);
attr->asString() = info.str();
attr->asString() = doc;
}

const RtIdentifier& RtNodeDef::getDoc() const {
const string& RtNodeDef::getDoc() const {
RtTypedValue* attr = prim()->getAttribute(Identifiers::DOC, RtType::STRING);
return attr ? attr->asIdentifier() : EMPTY_IDENTIFIER;
return attr ? attr->asString() : EMPTY_STRING;
}

bool RtNodeDef::isVersionCompatible(const RtIdentifier& version) const
Expand Down
4 changes: 2 additions & 2 deletions source/MaterialXRuntime/RtNodeDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ class RtNodeDef : public RtTypedSchema
const RtIdentifier& getNamespace() const;

/// Set the doc metadata for this nodedef.
void setDoc(const RtIdentifier& doc);
void setDoc(const string& doc);

/// Return the doc metadata fo this nodedef.
const RtIdentifier& getDoc() const;
const string& getDoc() const;

/// Add an input port to the interface.
/// Shorthand for calling getPrim().createInput().
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXRuntime/RtStage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ RtPrim RtStage::createNodeDef(RtPrim nodegraphPrim,
bool isDefaultVersion,
const RtIdentifier& nodeGroup,
const RtIdentifier& namespaceString,
const RtIdentifier& doc)
const string& doc)
{
// Must have a nodedef name and a node name
if (nodeDefName == EMPTY_IDENTIFIER || nodeName == EMPTY_IDENTIFIER)
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXRuntime/RtStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RtStage : public RtSharedBase<RtStage>
const RtIdentifier& version, bool isDefaultVersion,
const RtIdentifier& nodeGroup = EMPTY_IDENTIFIER,
const RtIdentifier& namespaceString = EMPTY_IDENTIFIER,
const RtIdentifier& doc = EMPTY_IDENTIFIER);
const string& doc = EMPTY_STRING);

/// Remove a prim from the stage.
void removePrim(const RtPath& path);
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXTest/MaterialXRuntime/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ TEST_CASE("Runtime: NodeGraphs", "[runtime]")
const mx::RtIdentifier ADDGRAPH_TARGET("mytarget");
const mx::RtIdentifier NAMESPACE("namespace1");
const mx::RtIdentifier QUALIFIED_DEFINITION("namespace1:ND_addgraph");
const mx::RtIdentifier DOC("Sample documentation string");
const std::string DOC("Sample documentation string");
bool isDefaultVersion = false;
stage->renamePrim(graph1.getPath(), NG_ADDGRAPH);
REQUIRE(!api->hasDefinition<mx::RtNodeDef>(ND_ADDGRAPH));
Expand Down

0 comments on commit 278bd45

Please sign in to comment.