From 43e4e783784972bcd6ae8aeb917d96f8d9246e86 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Tue, 28 Feb 2023 20:51:33 -0800 Subject: [PATCH] nodes: if an item is pasted without a folder, ensure it is added to a folder --- app/widget/nodeview/nodeview.cpp | 3 +++ app/widget/timelinewidget/timelinewidget.cpp | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/widget/nodeview/nodeview.cpp b/app/widget/nodeview/nodeview.cpp index 5500f1bba..17ab4fd45 100644 --- a/app/widget/nodeview/nodeview.cpp +++ b/app/widget/nodeview/nodeview.cpp @@ -1092,6 +1092,9 @@ QVector NodeView::ProcessDroppingAttachedNodes(MultiUndoCommand *command, // Add node to the same graph that the context is in if (ai.node->parent() != select_context->parent()) { add_command->add_child(new NodeAddCommand(select_context->parent(), ai.node)); + if (ai.node->IsItem() && !ai.node->folder()) { + add_command->add_child(new FolderAddChild(select_context->parent()->root(), ai.node)); + } } // Add node to the context diff --git a/app/widget/timelinewidget/timelinewidget.cpp b/app/widget/timelinewidget/timelinewidget.cpp index 450561be3..5aa06ebe5 100644 --- a/app/widget/timelinewidget/timelinewidget.cpp +++ b/app/widget/timelinewidget/timelinewidget.cpp @@ -1945,8 +1945,12 @@ bool TimelineWidget::PasteInternal(bool insert) MultiUndoCommand *command = new MultiUndoCommand(); + Project *project = GetConnectedNode()->project(); foreach (Node *n, res.GetLoadData().nodes) { - command->add_child(new NodeAddCommand(GetConnectedNode()->project(), n)); + command->add_child(new NodeAddCommand(project, n)); + if (n->IsItem() && !n->folder()) { + command->add_child(new FolderAddChild(project->root(), n)); + } } rational paste_start = GetConnectedNode()->GetPlayhead();