MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/MaterialX / addNodeGraphPins

Method addNodeGraphPins

source/MaterialXGraphEditor/Graph.cpp:2802–2846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2800}
2801
2802void Graph::addNodeGraphPins()
2803{
2804 for (UiNodePtr node : _state.nodes)
2805 {
2806 if (node->getNodeGraph())
2807 {
2808 if (node->getInputPins().size() != node->getNodeGraph()->getInputs().size())
2809 {
2810 for (mx::InputPtr input : node->getNodeGraph()->getInputs())
2811 {
2812 std::string name = input->getName();
2813 auto result = std::find_if(node->getInputPins().begin(), node->getInputPins().end(), [name](UiPinPtr x)
2814 {
2815 return x->getName() == name;
2816 });
2817 if (result == node->getInputPins().end())
2818 {
2819 UiPinPtr inPin = std::make_shared<UiPin>(++_state.nextUiId, node, ax::NodeEditor::PinKind::Input, input);
2820 node->getInputPins().push_back(inPin);
2821 _state.pins.push_back(inPin);
2822 ++_state.nextUiId;
2823 }
2824 }
2825 }
2826 if (node->getOutputPins().size() != node->getNodeGraph()->getOutputs().size())
2827 {
2828 for (mx::OutputPtr output : node->getNodeGraph()->getOutputs())
2829 {
2830 std::string name = output->getName();
2831 auto result = std::find_if(node->getOutputPins().begin(), node->getOutputPins().end(), [name](UiPinPtr x)
2832 {
2833 return x->getName() == name;
2834 });
2835 if (result == node->getOutputPins().end())
2836 {
2837 UiPinPtr outPin = std::make_shared<UiPin>(++_state.nextUiId, node, ax::NodeEditor::PinKind::Output, output);
2838 ++_state.nextUiId;
2839 node->getOutputPins().push_back(outPin);
2840 _state.pins.push_back(outPin);
2841 }
2842 }
2843 }
2844 }
2845 }
2846}
2847
2848void Graph::upNodeGraph()
2849{

Callers

nothing calls this directly

Calls 6

getNodeGraphMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45
getNameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected