diff --git a/app/widget/nodeparamview/nodeparamview.cpp b/app/widget/nodeparamview/nodeparamview.cpp index 2aba90ed7..c299b882b 100644 --- a/app/widget/nodeparamview/nodeparamview.cpp +++ b/app/widget/nodeparamview/nodeparamview.cpp @@ -283,6 +283,16 @@ void NodeParamView::UpdateContexts() void NodeParamView::ItemAboutToBeRemoved(NodeParamViewItem *item) { + if (keyframe_view_) { + for (auto it=item->GetKeyframeConnections().begin(); it!=item->GetKeyframeConnections().end(); it++) { + for (auto jt=it->begin(); jt!=it->end(); jt++) { + for (auto kt=jt->begin(); kt!=jt->end(); kt++) { + keyframe_view_->RemoveKeyframesOfTrack(*kt); + } + } + } + } + if (focused_node_ == item) { focused_node_ = nullptr; emit FocusedNodeChanged(nullptr); @@ -455,27 +465,6 @@ void NodeParamView::AddNode(Node *n, Node *ctx, NodeParamViewContext *context) } } -void NodeParamView::RemoveNode(Node *n, Node *ctx) -{ - foreach (NodeParamViewContext *ctx_item, context_items_) { - NodeParamViewItem *item = ctx_item->GetItem(n, ctx); - - if (item) { - if (keyframe_view_) { - for (auto it=item->GetKeyframeConnections().begin(); it!=item->GetKeyframeConnections().end(); it++) { - for (auto jt=it->begin(); jt!=it->end(); jt++) { - for (auto kt=jt->begin(); kt!=jt->end(); kt++) { - keyframe_view_->RemoveKeyframesOfTrack(*kt); - } - } - } - } - } - - ctx_item->RemoveNode(n, ctx); - } -} - int GetDistanceBetweenNodes(Node *start, Node *end) { if (start == end) { @@ -675,7 +664,9 @@ void NodeParamView::NodeRemovedFromContext(Node *n) { Node *ctx = static_cast(sender()); - RemoveNode(n, ctx); + foreach (NodeParamViewContext *ctx_item, context_items_) { + ctx_item->RemoveNode(n, ctx); + } if (keyframe_view_) { QueueKeyframePositionUpdate(); diff --git a/app/widget/nodeparamview/nodeparamview.h b/app/widget/nodeparamview/nodeparamview.h index 9a9207cb7..8061d5b1a 100644 --- a/app/widget/nodeparamview/nodeparamview.h +++ b/app/widget/nodeparamview/nodeparamview.h @@ -99,8 +99,6 @@ private: void AddNode(Node* n, Node *ctx, NodeParamViewContext *context); - void RemoveNode(Node *n, Node *ctx); - void SortItemsInContext(NodeParamViewContext *context); NodeParamViewContext *GetContextItemFromContext(Node *context);