work towards finishing nodeview copy/paste refactor

This commit is contained in:
itsmattkc
2021-12-29 18:44:14 -08:00
parent a4934f1d47
commit 8daa83b682
7 changed files with 103 additions and 60 deletions
+10 -2
View File
@@ -201,7 +201,11 @@ QVector<Node *> NodeCopyPasteService::PasteNodesFromClipboard(NodeGraph *graph,
// Add all nodes to graph
foreach (Node* n, pasted_nodes) {
command->add_child(new NodeAddCommand(graph, n));
if (command) {
command->add_child(new NodeAddCommand(graph, n));
} else {
n->setParent(graph);
}
}
// Make connections
@@ -215,7 +219,11 @@ QVector<Node *> NodeCopyPasteService::PasteNodesFromClipboard(NodeGraph *graph,
for (auto jt=map.cbegin(); jt!=map.cend(); jt++) {
Node *subnode = xml_node_data.node_ptrs.value(jt.key());
if (subnode) {
command->add_child(new NodeSetPositionCommand(subnode, context, jt.value()));
if (command) {
command->add_child(new NodeSetPositionCommand(subnode, context, jt.value()));
} else {
context->SetNodePositionInContext(subnode, jt.value());
}
}
}
}