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

Method InlineGroupCommand

Gui/NodeGraphUndoRedo.cpp:1800–1992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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