keyframes: implemented deleting keyframes with the delete shortcut
This commit is contained in:
@@ -168,6 +168,11 @@ void CurveWidget::SetVerticalScale(const double &vscale)
|
||||
view_->SetYScale(vscale);
|
||||
}
|
||||
|
||||
void CurveWidget::DeleteSelected()
|
||||
{
|
||||
view_->DeleteSelected();
|
||||
}
|
||||
|
||||
void CurveWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
const double& GetVerticalScale();
|
||||
void SetVerticalScale(const double& vscale);
|
||||
|
||||
void DeleteSelected();
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent *) override;
|
||||
|
||||
|
||||
@@ -73,6 +73,25 @@ void KeyframeViewBase::SetYScale(const double &y_scale)
|
||||
}
|
||||
}
|
||||
|
||||
void KeyframeViewBase::DeleteSelected()
|
||||
{
|
||||
QUndoCommand* command = new QUndoCommand();
|
||||
|
||||
QMap<NodeKeyframe*, KeyframeViewItem*>::const_iterator i;
|
||||
|
||||
for (i=item_map_.constBegin(); i!=item_map_.constEnd(); i++) {
|
||||
if (i.value()->isSelected()) {
|
||||
NodeInput* input_parent = i.key()->parent();
|
||||
|
||||
new NodeParamRemoveKeyframeCommand(input_parent,
|
||||
input_parent->get_keyframe_shared_ptr_from_raw(i.key()),
|
||||
command);
|
||||
}
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
void KeyframeViewBase::RemoveKeyframe(NodeKeyframePtr key)
|
||||
{
|
||||
KeyframeAboutToBeRemoved(key.get());
|
||||
|
||||
@@ -40,6 +40,8 @@ public:
|
||||
const double& GetYScale() const;
|
||||
void SetYScale(const double& y_scale);
|
||||
|
||||
void DeleteSelected();
|
||||
|
||||
public slots:
|
||||
void RemoveKeyframe(NodeKeyframePtr key);
|
||||
|
||||
|
||||
@@ -225,6 +225,11 @@ Node *NodeParamView::GetTimeTarget() const
|
||||
return keyframe_view_->GetTimeTarget();
|
||||
}
|
||||
|
||||
void NodeParamView::DeleteSelected()
|
||||
{
|
||||
keyframe_view_->DeleteSelected();
|
||||
}
|
||||
|
||||
void NodeParamView::UpdateItemTime(const int64_t ×tamp)
|
||||
{
|
||||
rational time = Timecode::timestamp_to_time(timestamp, keyframe_view_->timebase());
|
||||
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
|
||||
Node* GetTimeTarget() const;
|
||||
|
||||
void DeleteSelected();
|
||||
|
||||
signals:
|
||||
void InputDoubleClicked(NodeInput* input);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user