Skip to content

Commit

Permalink
Remove conflicting bindings that redefine virtual functions through `…
Browse files Browse the repository at this point in the history
…optional_override`. (#1224)

Prevent function overload clashes by not redefining virtual functions with optional parameters via optional_override.
  • Loading branch information
frericp authored Jun 9, 2021
1 parent 6485164 commit 1d681e4
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions source/JsMaterialX/JsMaterialXCore/JsDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ EMSCRIPTEN_BINDINGS(definition)
.function("getNodeGroup", &mx::NodeDef::getNodeGroup)
BIND_MEMBER_FUNC("getImplementation", mx::NodeDef, getImplementation, 0, 1, stRef)
.function("isVersionCompatible", &mx::NodeDef::isVersionCompatible)
BIND_MEMBER_FUNC("getDeclaration", mx::NodeDef, getDeclaration, 0, 1, stRef)
.class_property("CATEGORY", &mx::NodeDef::CATEGORY)
.class_property("NODE_ATTRIBUTE", &mx::NodeDef::NODE_ATTRIBUTE)
.class_property("NODE_GROUP_ATTRIBUTE", &mx::NodeDef::NODE_GROUP_ATTRIBUTE)
Expand All @@ -53,7 +52,6 @@ EMSCRIPTEN_BINDINGS(definition)
.function("getFunction", &mx::Implementation::getFunction)
.function("setNodeDef", &mx::Implementation::setNodeDef)
.function("getNodeDef", &mx::Implementation::getNodeDef)
BIND_MEMBER_FUNC("getDeclaration", mx::Implementation, getDeclaration, 0, 1, stRef)
.class_property("CATEGORY", &mx::Implementation::CATEGORY)
.class_property("FILE_ATTRIBUTE", &mx::Implementation::FILE_ATTRIBUTE)
.class_property("FUNCTION_ATTRIBUTE", &mx::Implementation::FUNCTION_ATTRIBUTE);
Expand Down
1 change: 0 additions & 1 deletion source/JsMaterialX/JsMaterialXCore/JsInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ EMSCRIPTEN_BINDINGS(interface)
ems::class_<mx::Output, ems::base<mx::PortElement>>("Output")
.smart_ptr_constructor("Output", &std::make_shared<mx::Output, mx::ElementPtr, const std::string &>)
.smart_ptr<std::shared_ptr<const mx::Output>>("Output")
BIND_MEMBER_FUNC("getUpstreamEdge", mx::Output, getUpstreamEdge, 0, 1, std::size_t)
.function("getUpstreamEdgeCount", &mx::Output::getUpstreamEdgeCount)
.function("hasUpstreamCycle", &mx::Output::hasUpstreamCycle)
.class_property("CATEGORY", &mx::Output::CATEGORY)
Expand Down
3 changes: 0 additions & 3 deletions source/JsMaterialX/JsMaterialXCore/JsNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ EMSCRIPTEN_BINDINGS(node)
.function("getConnectedOutput", &mx::Node::getConnectedOutput)
BIND_MEMBER_FUNC("getNodeDef", mx::Node, getNodeDef, 0, 1, stRef)
BIND_MEMBER_FUNC("getImplementation", mx::Node, getImplementation, 0, 1, stRef)
BIND_MEMBER_FUNC("getUpstreamEdge", mx::Node, getUpstreamEdge, 0, 1, size_t)
.function("getUpstreamEdgeCount", &mx::Node::getUpstreamEdgeCount)
.function("getNodeDefOutput", &mx::Node::getNodeDefOutput)
.function("getDownstreamPorts", &mx::Node::getDownstreamPorts)
BIND_MEMBER_FUNC("getDeclaration", mx::Node, getDeclaration, 0, 1, stRef)
.function("addInputFromNodeDef", &mx::Node::addInputFromNodeDef)
.class_property("CATEGORY", &mx::Node::CATEGORY);

Expand Down Expand Up @@ -59,7 +57,6 @@ EMSCRIPTEN_BINDINGS(node)
.function("setNodeDef", &mx::NodeGraph::setNodeDef)
.function("getNodeDef", &mx::NodeGraph::getNodeDef)
.function("getImplementation", &mx::NodeGraph::getImplementation)
BIND_MEMBER_FUNC("getDeclaration", mx::NodeGraph, getDeclaration, 0, 1, stRef)
.function("addInterfaceName", &mx::NodeGraph::addInterfaceName)
.function("removeInterfaceName", &mx::NodeGraph::removeInterfaceName)
.function("modifyInterfaceName", &mx::NodeGraph::modifyInterfaceName)
Expand Down
2 changes: 1 addition & 1 deletion source/JsMaterialX/JsMaterialXCore/JsUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ EMSCRIPTEN_BINDINGS(util)

ems::function("getVersionIntegers", ems::optional_override([]() {
std::tuple<int, int, int> version = mx::getVersionIntegers();
return std::array<int, 3> { std::get<0>(version), std::get<1>(version), std::get<02>(version) };
return std::array<int, 3> { std::get<0>(version), std::get<1>(version), std::get<2>(version) };
}));

// Emscripten expects to provide a number from JS for a cpp 'char' parameter.
Expand Down
2 changes: 1 addition & 1 deletion source/JsMaterialX/JsMaterialXCore/JsValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ EMSCRIPTEN_BINDINGS(value)
ems::class_<mx::Value>("Value")
.smart_ptr<std::shared_ptr<mx::Value>>("Value")
.smart_ptr<std::shared_ptr<const mx::Value>>("Value")
.function("copy", &mx::Value::copy)
.function("copy", &mx::Value::copy, ems::pure_virtual())
.function("getTypeString", &mx::Value::getTypeString)
.function("getValueString", &mx::Value::getValueString)
.class_function("createValueFromStrings", &mx::Value::createValueFromStrings)
Expand Down

0 comments on commit 1d681e4

Please sign in to comment.