Skip to content

Commit

Permalink
nodes: if an item is pasted without a folder, ensure it is added to a…
Browse files Browse the repository at this point in the history
… folder
  • Loading branch information
itsmattkc committed Mar 1, 2023
1 parent 9824760 commit 43e4e78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/widget/nodeview/nodeview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,9 @@ QVector<Node*> 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
Expand Down
6 changes: 5 additions & 1 deletion app/widget/timelinewidget/timelinewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 43e4e78

Please sign in to comment.