keyframes: implemented deleting keyframes with the delete shortcut

This commit is contained in:
itsmattkc
2020-05-01 17:01:16 +10:00
parent ca323b7bfd
commit e67dabf1ff
12 changed files with 67 additions and 0 deletions
+5
View File
@@ -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) {
+2
View File
@@ -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 &timestamp)
{
rational time = Timecode::timestamp_to_time(timestamp, keyframe_view_->timebase());
+2
View File
@@ -42,6 +42,8 @@ public:
Node* GetTimeTarget() const;
void DeleteSelected();
signals:
void InputDoubleClicked(NodeInput* input);