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

Method getOutputPin

source/MaterialXGraphEditor/Graph.cpp:298–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298ed::PinId Graph::getOutputPin(UiNodePtr node, UiNodePtr upNode, UiPinPtr input)
299{
300 if (upNode->getNodeGraph() != nullptr)
301 {
302 // For nodegraph need to get the correct output pin according to the names of the output nodes
303 mx::OutputPtr output;
304 if (input->getUiNode()->getNode())
305 {
306 output = input->getUiNode()->getNode()->getConnectedOutput(input->getName());
307 }
308 else if (input->getUiNode()->getNodeGraph())
309 {
310 output = input->getUiNode()->getNodeGraph()->getConnectedOutput(input->getName());
311 }
312
313 if (output)
314 {
315 std::string outName = output->getName();
316 for (UiPinPtr outputs : upNode->getOutputPins())
317 {
318 if (outputs->getName() == outName)
319 {
320 return outputs->getPinId();
321 }
322 }
323 }
324 return ed::PinId();
325 }
326 else
327 {
328 // For node need to get the correct output pin based on the output attribute
329 if (!upNode->getOutputPins().empty())
330 {
331 std::string outputName = mx::EMPTY_STRING;
332 if (input->getInput())
333 {
334 outputName = input->getInput()->getOutputString();
335 }
336 else if (input->getOutput())
337 {
338 outputName = input->getOutput()->getOutputString();
339 }
340
341 size_t pinIndex = 0;
342 if (!outputName.empty())
343 {
344 for (size_t i = 0; i < upNode->getOutputPins().size(); i++)
345 {
346 if (upNode->getOutputPins()[i]->getName() == outputName)
347 {
348 pinIndex = i;
349 break;
350 }
351 }
352 }
353 return (upNode->getOutputPins()[pinIndex]->getPinId());
354 }
355 return ed::PinId();

Callers

nothing calls this directly

Calls 10

getNodeGraphMethod · 0.80
getUiNodeMethod · 0.80
getConnectedOutputMethod · 0.80
getPinIdMethod · 0.80
getNodeMethod · 0.45
getNameMethod · 0.45
emptyMethod · 0.45
getInputMethod · 0.45
getOutputMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected