From 67afa2d804e03e3a2945d2659b616beb632deebb Mon Sep 17 00:00:00 2001 From: Frederic Devernay Date: Sun, 4 Apr 2021 11:01:25 -0700 Subject: [PATCH] oldNewScriptNamesMapping: more consistent naming --- Gui/NodeGraph40.cpp | 12 ++++++------ Gui/NodeGraphPrivate.h | 2 +- Gui/NodeGraphPrivate10.cpp | 26 +++++++++++++------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Gui/NodeGraph40.cpp b/Gui/NodeGraph40.cpp index b08b669abe..475d85277e 100644 --- a/Gui/NodeGraph40.cpp +++ b/Gui/NodeGraph40.cpp @@ -299,25 +299,25 @@ NodeGraph::cloneSelectedNodes(const QPointF& scenePos) std::list > newNodes; std::list serializations; std::list newNodesList; - std::map oldNewScriptNameMapping; + std::map oldNewScriptNamesMapping; for (NodesGuiList::iterator it = nodesToCopy.begin(); it != nodesToCopy.end(); ++it) { NodeSerializationPtr internalSerialization( new NodeSerialization( (*it)->getNode() ) ); NodeGuiSerializationPtr guiSerialization = boost::make_shared(); (*it)->serialize( guiSerialization.get() ); NodeGuiPtr clone = _imp->pasteNode(internalSerialization, guiSerialization, offset, - _imp->group.lock(), std::string(), true, &oldNewScriptNameMapping ); + _imp->group.lock(), std::string(), true, &oldNewScriptNamesMapping); newNodes.push_back( std::make_pair(internalSerialization->getNodeScriptName(), clone) ); newNodesList.push_back(clone); serializations.push_back(internalSerialization); - oldNewScriptNameMapping[internalSerialization->getNodeScriptName()] = clone->getNode()->getScriptName(); + oldNewScriptNamesMapping[internalSerialization->getNodeScriptName()] = clone->getNode()->getScriptName(); } assert( serializations.size() == newNodes.size() ); ///restore connections - _imp->restoreConnections(serializations, newNodes, oldNewScriptNameMapping); + _imp->restoreConnections(serializations, newNodes, oldNewScriptNamesMapping); NodesList allNodes; @@ -326,8 +326,8 @@ NodeGraph::cloneSelectedNodes(const QPointF& scenePos) //Restore links once all children are created for alias knobs/expressions std::list::iterator itS = serializations.begin(); for (std::list ::iterator it = newNodesList.begin(); it != newNodesList.end(); ++it, ++itS) { - (*it)->getNode()->storeKnobsLinks(**itS, oldNewScriptNameMapping); - (*it)->getNode()->restoreKnobsLinks(allNodes, oldNewScriptNameMapping, true); // clone should never fail + (*it)->getNode()->storeKnobsLinks(**itS, oldNewScriptNamesMapping); + (*it)->getNode()->restoreKnobsLinks(allNodes, oldNewScriptNamesMapping, true); // clone should never fail } diff --git a/Gui/NodeGraphPrivate.h b/Gui/NodeGraphPrivate.h index d53fa4f15d..b75ed258e8 100644 --- a/Gui/NodeGraphPrivate.h +++ b/Gui/NodeGraphPrivate.h @@ -238,7 +238,7 @@ class NodeGraphPrivate const NodeCollectionPtr& group, const std::string& parentName, bool clone, - std::map* oldNewScriptNameMapping); + std::map* oldNewScriptNamesMapping); /** diff --git a/Gui/NodeGraphPrivate10.cpp b/Gui/NodeGraphPrivate10.cpp index 6ab3746af5..d272718625 100644 --- a/Gui/NodeGraphPrivate10.cpp +++ b/Gui/NodeGraphPrivate10.cpp @@ -93,7 +93,7 @@ NodeGraphPrivate::pasteNodesInternal(const NodeClipBoard & clipboard, ///The script-name of the copy node is different than the one of the original one ///We store the mapping so we can restore node links correctly - std::map oldNewScriptNamesMap; + std::map oldNewScriptNamesMapping; { CreatingNodeTreeFlag_RAII createNodeTree( _publicInterface->getGui()->getApp() ); const std::list& internalNodesClipBoard = clipboard.nodes; @@ -101,7 +101,7 @@ NodeGraphPrivate::pasteNodesInternal(const NodeClipBoard & clipboard, for (std::list::const_iterator it = clipboard.nodesUI.begin(); it != clipboard.nodesUI.end(); ++it, ++itOther) { const std::string& oldScriptName = (*itOther)->getNodeScriptName(); - NodeGuiPtr node = pasteNode( *itOther, *it, offset, group.lock(), std::string(), false, &oldNewScriptNamesMap); + NodeGuiPtr node = pasteNode( *itOther, *it, offset, group.lock(), std::string(), false, &oldNewScriptNamesMapping); if (!node) { continue; @@ -111,20 +111,20 @@ NodeGraphPrivate::pasteNodesInternal(const NodeClipBoard & clipboard, newNodesMap.push_back( std::make_pair( *itOther, node->getNode() ) ); const std::string& newScriptName = node->getNode()->getScriptName(); - oldNewScriptNamesMap[oldScriptName] = newScriptName; + oldNewScriptNamesMapping[oldScriptName] = newScriptName; } assert( internalNodesClipBoard.size() == newNodes->size() ); ///Now that all nodes have been duplicated, try to restore nodes connections - restoreConnections(internalNodesClipBoard, *newNodes, oldNewScriptNamesMap); + restoreConnections(internalNodesClipBoard, *newNodes, oldNewScriptNamesMapping); NodesList allNodes; _publicInterface->getGui()->getApp()->getProject()->getActiveNodesExpandGroups(&allNodes); //Restore links once all children are created for alias knobs/expressions for (std::list > ::iterator it = newNodesMap.begin(); it != newNodesMap.end(); ++it) { - it->second->storeKnobsLinks(*(it->first), oldNewScriptNamesMap); - it->second->restoreKnobsLinks(allNodes, oldNewScriptNamesMap, false); // may fail + it->second->storeKnobsLinks(*(it->first), oldNewScriptNamesMapping); + it->second->restoreKnobsLinks(allNodes, oldNewScriptNamesMapping, false); // may fail } } @@ -153,7 +153,7 @@ NodeGraphPrivate::pasteNode(const NodeSerializationPtr & internalSerialization, const NodeCollectionPtr& grp, const std::string& parentName, bool clone, - std::map* oldNewScriptNameMapping) + std::map* oldNewScriptNamesMapping) { CreateNodeArgs args(internalSerialization->getPluginID(), grp); args.setProperty(kCreateNodeArgsPropNodeSerialization, internalSerialization); @@ -240,7 +240,7 @@ NodeGraphPrivate::pasteNode(const NodeSerializationPtr & internalSerialization, assert( nodes.size() == nodesUi.size() || nodesUi.empty() ); if ( internalSerialization->getNodeScriptName() != n->getScriptName() ) { - (*oldNewScriptNameMapping)[internalSerialization->getNodeScriptName()] = n->getScriptName(); + (*oldNewScriptNamesMapping)[internalSerialization->getNodeScriptName()] = n->getScriptName(); } // For PyPlugs, don't recurse otherwise we would recreate all nodes on top of the ones created by the python script @@ -259,11 +259,11 @@ NodeGraphPrivate::pasteNode(const NodeSerializationPtr & internalSerialization, std::list::const_iterator itUi = nodesUi.begin(); for (std::list::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { NodeGuiSerializationPtr guiS = nodesUi.empty() ? NodeGuiSerializationPtr() : *itUi; - NodeGuiPtr newChild = pasteNode(*it, guiS, QPointF(0, 0), collection, parentName, clone, oldNewScriptNameMapping); + NodeGuiPtr newChild = pasteNode(*it, guiS, QPointF(0, 0), collection, parentName, clone, oldNewScriptNamesMapping); if (newChild) { newNodes.push_back( std::make_pair( (*it)->getNodeScriptName(), newChild ) ); if ( (*it)->getNodeScriptName() != newChild->getNode()->getScriptName() ) { - (*oldNewScriptNameMapping)[(*it)->getNodeScriptName()] = newChild->getNode()->getScriptName(); + (*oldNewScriptNamesMapping)[(*it)->getNodeScriptName()] = newChild->getNode()->getScriptName(); } allNodes.push_back( newChild->getNode() ); newNodesMap.push_back(std::make_pair(*it,newChild->getNode())); @@ -272,12 +272,12 @@ NodeGraphPrivate::pasteNode(const NodeSerializationPtr & internalSerialization, ++itUi; } } - restoreConnections(nodes, newNodes, *oldNewScriptNameMapping); + restoreConnections(nodes, newNodes, *oldNewScriptNamesMapping); //Restore links once all children are created for alias knobs/expressions for (std::list > ::iterator it = newNodesMap.begin(); it != newNodesMap.end(); ++it) { - it->second->storeKnobsLinks(*(it->first), *oldNewScriptNameMapping); - it->second->restoreKnobsLinks(allNodes, *oldNewScriptNameMapping, false); // may fail + it->second->storeKnobsLinks(*(it->first), *oldNewScriptNamesMapping); + it->second->restoreKnobsLinks(allNodes, *oldNewScriptNamesMapping, false); // may fail } }