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 3, 2024
1 parent b12f310 commit 53d07d8
Show file tree
Hide file tree
Showing 3 changed files with 20 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 @@ -676,6 +676,15 @@ void MainWindow::setupMenuBar()

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")));
cmdAddAction(addKeyAct);

mEditMenu->addSeparator();

const auto clearCacheAct = 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 @@ -504,6 +504,16 @@ void Canvas::clearMarkers()
emit requestUpdate();
}

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
1 change: 1 addition & 0 deletions src/core/canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ class CORE_EXPORT Canvas : public CanvasBase
const std::vector<FrameMarker> getMarkers();
void clearMarkers();

void addKeySelectedProperties();

ColorAnimator *getBgColorAnimator()
{
Expand Down

0 comments on commit 53d07d8

Please sign in to comment.