timeline: avoid duplicate items or item dependencies when pasting

God damn this was a big oof. Pasting was inadvertently making duplicates of the footage node(s) every single time. Worst case was if the clip was connected to a nested sequence. Every time someone copy/pasted in my large-scale project, it would add another 1000 nodes to the project. It's about fucking time this was fixed.
This commit is contained in:
itsmattkc
2023-02-28 22:28:32 -08:00
parent 43e4e78378
commit 066a10e6a0
5 changed files with 108 additions and 13 deletions
+8 -1
View File
@@ -1938,7 +1938,7 @@ bool TimelineWidget::PasteInternal(bool insert)
return false;
}
ProjectSerializer::Result res = ProjectSerializer::Paste(ProjectSerializer::kOnlyNodes);
ProjectSerializer::Result res = ProjectSerializer::Paste(ProjectSerializer::kOnlyNodes, GetConnectedNode()->project());
if (res.GetLoadData().nodes.isEmpty()) {
return false;
}
@@ -1953,6 +1953,13 @@ bool TimelineWidget::PasteInternal(bool insert)
}
}
qDebug() << "pasing" << res.GetLoadData().nodes.size() << "nodes";
for (auto it = res.GetLoadData().promised_connections.cbegin(); it != res.GetLoadData().promised_connections.cend(); it++) {
auto oc = *it;
command->add_child(new NodeEdgeAddCommand(oc.first, oc.second));
}
rational paste_start = GetConnectedNode()->GetPlayhead();
if (insert) {