Skip to content

Commit

Permalink
Support 'Add Key(s)' shortcut (Insert)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Aug 14, 2024
1 parent 0bec97c commit b2c6df2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/GUI/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 10 additions & 0 deletions src/core/canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Animator*>(prop);
if (!asAnim) { continue; }
asAnim->anim_saveCurrentValueAsKey();
}
mDocument.actionFinished();
}

stdsptr<BoxRenderData> Canvas::createRenderData() {
return enve::make_shared<CanvasRenderData>(this);
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ class CORE_EXPORT Canvas : public CanvasBase

void setFrameRange(const FrameRange& range);

void addKeySelectedProperties();

ColorAnimator *getBgColorAnimator()
{
return mBackgroundColor.get();
Expand Down

0 comments on commit b2c6df2

Please sign in to comment.