Skip to content

Commit

Permalink
Change API name to final name. Add in JS binding.
Browse files Browse the repository at this point in the history
  • Loading branch information
kwokcb committed May 13, 2024
1 parent f5ca3ae commit 46eaf21
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions source/JsMaterialX/JsMaterialXCore/JsInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ EMSCRIPTEN_BINDINGS(interface)
.function("setConnectedOutput", &mx::Input::setConnectedOutput)
.function("getConnectedOutput", &mx::Input::getConnectedOutput)
.function("getInterfaceInput", &mx::Input::getInterfaceInput)
.function("setConnectedInterfaceName", &mx::Input::setConnectedInterfaceName)
.class_property("CATEGORY", &mx::Input::CATEGORY)
.class_property("DEFAULT_GEOM_PROP_ATTRIBUTE", &mx::Input::DEFAULT_GEOM_PROP_ATTRIBUTE);

Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXCore/Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ NodePtr Input::getConnectedNode() const
return PortElement::getConnectedNode();
}

void Input::setConnectedInterface(const string& interfaceName)
void Input::setConnectedInterfaceName(const string& interfaceName)
{
if (!interfaceName.empty())
{
Expand Down
2 changes: 1 addition & 1 deletion source/MaterialXCore/Interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class MX_CORE_API Input : public PortElement

/// Connects this input to a corresponding interface with the given name.
/// If the interface name specified is an empty string then any existing connection is removed.
void setConnectedInterface(const string& interfaceName);
void setConnectedInterfaceName(const string& interfaceName);

/// Return the input on the parent graph corresponding to the interface name
/// for this input.
Expand Down
20 changes: 10 additions & 10 deletions source/MaterialXGraphEditor/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,7 @@ void Graph::copyInputs()
else if (upNode->getInput())
{

copyNode->inputPins[count]->_input->setConnectedInterface(upNode->getName());
copyNode->inputPins[count]->_input->setConnectedInterfaceName(upNode->getName());
}
else
{
Expand All @@ -1860,7 +1860,7 @@ void Graph::copyInputs()
{
if (upNode->getInput())
{
copyNode->inputPins[count]->_input->setConnectedInterface(upNode->getName());
copyNode->inputPins[count]->_input->setConnectedInterfaceName(upNode->getName());
}
else
{
Expand All @@ -1884,7 +1884,7 @@ void Graph::copyInputs()
{
if (pin->_input->getInterfaceInput())
{
copyNode->inputPins[count]->_input->setConnectedInterface(mx::EMPTY_STRING);
copyNode->inputPins[count]->_input->setConnectedInterfaceName(mx::EMPTY_STRING);
}
copyNode->inputPins[count]->setConnected(false);
setDefaults(copyNode->inputPins[count]->_input);
Expand Down Expand Up @@ -2624,7 +2624,7 @@ void Graph::addLink(ed::PinId startPinId, ed::PinId endPinId)
}
else if (uiUpNode->getInput() != nullptr)
{
pin->_input->setConnectedInterface(uiUpNode->getName());
pin->_input->setConnectedInterfaceName(uiUpNode->getName());
}
else
{
Expand All @@ -2650,7 +2650,7 @@ void Graph::addLink(ed::PinId startPinId, ed::PinId endPinId)
{
if (uiUpNode->getInput())
{
pin->_input->setConnectedInterface(uiUpNode->getName());
pin->_input->setConnectedInterfaceName(uiUpNode->getName());
}
else
{
Expand Down Expand Up @@ -2775,7 +2775,7 @@ void Graph::deleteLinkInfo(int startAttr, int endAttr)
if (_graphNodes[upNode]->getInput())
{
// Remove interface value in order to set the default of the input
pin->_input->setConnectedInterface(mx::EMPTY_STRING);
pin->_input->setConnectedInterfaceName(mx::EMPTY_STRING);
setDefaults(pin->_input);
setDefaults(_graphNodes[upNode]->getInput());
}
Expand Down Expand Up @@ -2808,7 +2808,7 @@ void Graph::deleteLinkInfo(int startAttr, int endAttr)
removeEdge(downNode, upNode, pin);
if (_graphNodes[upNode]->getInput())
{
_graphNodes[downNode]->getNodeGraph()->getInput(pin->_name)->setConnectedInterface(mx::EMPTY_STRING);
_graphNodes[downNode]->getNodeGraph()->getInput(pin->_name)->setConnectedInterfaceName(mx::EMPTY_STRING);
setDefaults(_graphNodes[upNode]->getInput());
}
for (UiPinPtr connect : pin->_connections)
Expand Down Expand Up @@ -2905,7 +2905,7 @@ void Graph::deleteNode(UiNodePtr node)
if (node->getInput())
{
// Remove interface in order to set the default of the input
pin->_input->setConnectedInterface(mx::EMPTY_STRING);
pin->_input->setConnectedInterfaceName(mx::EMPTY_STRING);
setDefaults(pin->_input);
setDefaults(node->getInput());
}
Expand All @@ -2914,7 +2914,7 @@ void Graph::deleteNode(UiNodePtr node)
{
if (node->getInput())
{
pin->_pinNode->getNodeGraph()->getInput(pin->_name)->setConnectedInterface(mx::EMPTY_STRING);
pin->_pinNode->getNodeGraph()->getInput(pin->_name)->setConnectedInterfaceName(mx::EMPTY_STRING);
setDefaults(node->getInput());
}
pin->_input->setConnectedNode(nullptr);
Expand Down Expand Up @@ -3318,7 +3318,7 @@ void Graph::propertyEditor()
{
_currUiNode->getInput()->setName(name);
mx::ValuePtr val = _currUiNode->getInput()->getValue();
input->setConnectedInterface(name);
input->setConnectedInterfaceName(name);
mx::InputPtr pt = input->getInterfaceInput();
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/MaterialXTest/MaterialXCore/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TEST_CASE("Interface Input Validation", "[node]")
}
REQUIRE(!valid);

addInput->setConnectedInterface(graphInput->getName());
addInput->setConnectedInterfaceName(graphInput->getName());
mx::InputPtr interfaceInput = addInput->getInterfaceInput();
REQUIRE((interfaceInput && interfaceInput->getNamePath() == graphInput->getNamePath()));
REQUIRE(!addInput->getValue());
Expand All @@ -70,7 +70,7 @@ TEST_CASE("Interface Input Validation", "[node]")
}
REQUIRE(valid);

addInput->setConnectedInterface(mx::EMPTY_STRING);
addInput->setConnectedInterfaceName(mx::EMPTY_STRING);
addInput->setValueString("2, 2, 2");
interfaceInput = addInput->getInterfaceInput();
REQUIRE(!interfaceInput);
Expand Down
2 changes: 1 addition & 1 deletion source/PyMaterialX/PyMaterialXCore/PyInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void bindPyInterface(py::module& mod)
.def("getDefaultGeomPropString", &mx::Input::getDefaultGeomPropString)
.def("getDefaultGeomProp", &mx::Input::getDefaultGeomProp)
.def("getConnectedNode", &mx::Input::getConnectedNode)
.def("setConnectedInterface", &mx::Input::setConnectedInterface)
.def("setConnectedInterfaceName", &mx::Input::setConnectedInterfaceName)
.def("getInterfaceInput", &mx::Input::getInterfaceInput)
.def_readonly_static("CATEGORY", &mx::Input::CATEGORY);

Expand Down

0 comments on commit 46eaf21

Please sign in to comment.