| 1535 | } |
| 1536 | |
| 1537 | void Graph::copyUiNode(UiNodePtr node) |
| 1538 | { |
| 1539 | UiNodePtr copyNode = std::make_shared<UiNode>(mx::EMPTY_STRING, int(_state.nextUiId + 1)); |
| 1540 | ++_state.nextUiId; |
| 1541 | if (node->getNodeGraph()) |
| 1542 | { |
| 1543 | _graphDoc->addNodeGraph(); |
| 1544 | std::string nodeGraphName = _graphDoc->getNodeGraphs().back()->getName(); |
| 1545 | copyNode->setNodeGraph(_graphDoc->getNodeGraphs().back()); |
| 1546 | copyNode->setName(nodeGraphName); |
| 1547 | copyNodeGraph(node, copyNode); |
| 1548 | } |
| 1549 | else if (node->getElement()) |
| 1550 | { |
| 1551 | std::string newName = _state.graphElem->createValidChildName(node->getName()); |
| 1552 | if (node->getNode()) |
| 1553 | { |
| 1554 | mx::NodePtr mxNode; |
| 1555 | mxNode = _state.graphElem->addNodeInstance(node->getNode()->getNodeDef()); |
| 1556 | mxNode->copyContentFrom(node->getNode()); |
| 1557 | mxNode->setName(newName); |
| 1558 | copyNode->setNode(mxNode); |
| 1559 | } |
| 1560 | else if (node->getInput()) |
| 1561 | { |
| 1562 | mx::InputPtr mxInput; |
| 1563 | mxInput = _state.graphElem->addInput(newName); |
| 1564 | mxInput->copyContentFrom(node->getInput()); |
| 1565 | copyNode->setInput(mxInput); |
| 1566 | } |
| 1567 | else if (node->getOutput()) |
| 1568 | { |
| 1569 | mx::OutputPtr mxOutput; |
| 1570 | mxOutput = _state.graphElem->addOutput(newName); |
| 1571 | mxOutput->copyContentFrom(node->getOutput()); |
| 1572 | mxOutput->setName(newName); |
| 1573 | copyNode->setOutput(mxOutput); |
| 1574 | } |
| 1575 | copyNode->getElement()->setName(newName); |
| 1576 | copyNode->setName(newName); |
| 1577 | } |
| 1578 | _copiedNodes[node] = copyNode; |
| 1579 | setUiNodeInfo(copyNode, node->getType(), node->getCategory()); |
| 1580 | } |
| 1581 | |
| 1582 | void Graph::copyNodeGraph(UiNodePtr origGraph, UiNodePtr copyGraph) |
| 1583 | { |
nothing calls this directly
no test coverage detected