diff --git a/src/app/GUI/mainwindow.cpp b/src/app/GUI/mainwindow.cpp index cbf0cde40..d5b6fb98a 100644 --- a/src/app/GUI/mainwindow.cpp +++ b/src/app/GUI/mainwindow.cpp @@ -630,6 +630,15 @@ void MainWindow::setupMenuBar() &mActions, &Actions::clearSelectionAction, Qt::ALT + Qt::Key_A, mEditMenu)); mEditMenu->addSeparator(); + + const auto addKeyAct = mEditMenu->addAction(tr("Add Key(s)"), [this]() { + const auto scene = *mDocument.fActiveScene; + if (!scene) { return; } + scene->addKeySelectedProperties(); + }, QKeySequence(tr("Insert"))); + + mEditMenu->addSeparator(); + mEditMenu->addAction(tr("Clear Cache", "MenuBar_Edit"), [this]() { const auto m = MemoryHandler::sInstance; m->clearMemory(); diff --git a/src/core/canvas.cpp b/src/core/canvas.cpp index 645c716cc..3e2a27457 100644 --- a/src/core/canvas.cpp +++ b/src/core/canvas.cpp @@ -425,6 +425,16 @@ void Canvas::setFrameRange(const FrameRange &range) { emit newFrameRange(range); } +void Canvas::addKeySelectedProperties() +{ + for (const auto &prop : mSelectedProps.getList()) { + const auto asAnim = enve_cast(prop); + if (!asAnim) { continue; } + asAnim->anim_saveCurrentValueAsKey(); + } + mDocument.actionFinished(); +} + stdsptr Canvas::createRenderData() { return enve::make_shared(this); } diff --git a/src/core/canvas.h b/src/core/canvas.h index a9afcde45..604658f39 100644 --- a/src/core/canvas.h +++ b/src/core/canvas.h @@ -353,6 +353,8 @@ class CORE_EXPORT Canvas : public CanvasBase void setFrameRange(const FrameRange& range); + void addKeySelectedProperties(); + ColorAnimator *getBgColorAnimator() { return mBackgroundColor.get();