MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / InlineGroupCommand

Method InlineGroupCommand

Gui/NodeGraphUndoRedo.cpp:1793–1985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1791}
1792
1793InlineGroupCommand::InlineGroupCommand(NodeGraph* graph,
1794 const std::list<NodeGuiPtr> & groupNodes)
1795 : QUndoCommand()
1796 , _graph(graph)
1797 , _groupNodes()
1798 , _firstRedoCalled(false)
1799{
1800 setText( tr("Inline group(s)") );
1801
1802 for (std::list<NodeGuiPtr> ::const_iterator it = groupNodes.begin(); it != groupNodes.end(); ++it) {
1803 NodeGroup* group = (*it)->getNode()->isEffectGroup();
1804 assert(group);
1805 if (!group) {
1806 continue;
1807 }
1808 InlinedGroup expandedGroup;
1809
1810 /*
1811 * First-off copy all the nodes within the group, except the Inputs and Output nodes
1812 */
1813 NodeClipBoard cb;
1814 NodesList nodes = group->getNodes();
1815 std::vector<NodePtr> groupInputs;
1816 NodePtr groupOutput = group->getOutputNode(true);
1817 group->getInputs(&groupInputs, true);
1818
1819 std::list<NodeGuiPtr> nodesToCopy;
1820 for (NodesList::iterator it2 = nodes.begin(); it2 != nodes.end(); ++it2) {
1821 GroupInput* inp = dynamic_cast<GroupInput*>( (*it2)->getEffectInstance().get() );
1822 GroupOutput* output = dynamic_cast<GroupOutput*>( (*it2)->getEffectInstance().get() );
1823 if ( !inp && !output && !(*it2)->getParentMultiInstance() ) {
1824 NodeGuiIPtr gui_i = (*it2)->getNodeGui();
1825 assert(gui_i);
1826 NodeGuiPtr nodeGui = std::dynamic_pointer_cast<NodeGui>(gui_i);
1827 assert(nodeGui);
1828 nodesToCopy.push_back(nodeGui);
1829 }
1830 }
1831
1832 {
1833 NodeGraphI *graph_i = group->getNodeGraph();
1834 assert(graph_i);
1835 {
1836 NodeGraph* thisGroupGraph = dynamic_cast<NodeGraph*>(graph_i);
1837 assert(thisGroupGraph);
1838 if (thisGroupGraph) {
1839 thisGroupGraph->copyNodes(nodesToCopy, cb);
1840 }
1841 }
1842 }
1843 std::list<std::pair<std::string, NodeGuiPtr> > newNodes;
1844 _graph->pasteCliboard(cb, &newNodes);
1845
1846 NodeGuiIPtr groupGui_i = group->getNode()->getNodeGui();
1847 assert(groupGui_i);
1848 NodeGuiPtr groupGui = std::dynamic_pointer_cast<NodeGui>(groupGui_i);
1849 assert(groupGui);
1850 expandedGroup.group = groupGui;

Callers

nothing calls this directly

Calls 15

setTextFunction · 0.85
maxFunction · 0.85
getNodesMethod · 0.80
getInputsMethod · 0.80
getEffectInstanceMethod · 0.80
copyNodesMethod · 0.80
pasteCliboardMethod · 0.80
getPos_mt_safeMethod · 0.80
setupInfinityMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected