From 094d2f98b4b093e53d97725f0fe6b883dec61ce1 Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Tue, 1 Aug 2023 12:26:00 +0200 Subject: [PATCH 01/17] Makes it possible to interpolate keyframes, to optain parallaxe effect --- app/src/actioncommands.cpp | 60 +++++++++++++++++++++++++++++++++++ app/src/actioncommands.h | 1 + app/src/mainwindow2.cpp | 1 + app/ui/mainwindow2.ui | 6 ++++ core_lib/src/util/pencildef.h | 1 + 5 files changed, 69 insertions(+) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 6d1bac1327..8630a5ffe1 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -608,6 +608,66 @@ Status ActionCommands::addNewKey() return Status::OK; } +void ActionCommands::interpolateKeyframes() +{ + bool cont = true; + // must be bitmap layer + if (mEditor->layers()->currentLayer()->type() != Layer::BITMAP) + cont = false; + + LayerBitmap* layer = static_cast(mEditor->layers()->currentLayer()); + QList framePair = layer->selectedKeyFramesPositions(); + + // must be exactly two frames + if (framePair.length() != 2) + cont = false; + + int first = framePair[0]; + int last = layer->getNextKeyFramePosition(first); + // first and last must be adjacent keyframes + if (last != framePair[1]) + cont = false; + + if (!cont) { + QMessageBox::information(mParent, + tr("Information"), + tr("To interpolate keframes, you must select to adjacent frames!"), + QMessageBox::Ok); + return; + } + + BitmapImage* img1 = layer->getBitmapImageAtFrame(first); + mEditor->scrubTo(first); + QRect rect1 = img1->bounds(); + BitmapImage* img2 = layer->getBitmapImageAtFrame(last); + mEditor->scrubTo(last); + QRect rect2 = img2->bounds(); + + QLineF upperLine = QLineF(rect1.topLeft(), rect2.topLeft()); + QLineF bottomLine = QLineF(rect1.bottomRight(), rect2.bottomRight()); + + int counter = 1; + KeyFrame* keyframe = layer->getKeyFrameAt(first); + + qreal percent = 0.0; + qreal interpolations = static_cast(last - first); + + for (int i = first + 1; i < last; i++) + { + KeyFrame* dupKey = keyframe->clone(); + layer->addKeyFrame(i, dupKey); + BitmapImage* image = layer->getBitmapImageAtFrame(i); + percent = counter / interpolations; + QRect transformer = QRect(upperLine.pointAt(percent).toPoint(), + bottomLine.pointAt(percent).toPoint()); + image->transform(transformer, true); + image->modification(); + mEditor->scrubTo(i); + counter++; + } + +} + void ActionCommands::exposeSelectedFrames(int offset) { Layer* currentLayer = mEditor->layers()->currentLayer(); diff --git a/app/src/actioncommands.h b/app/src/actioncommands.h index f55e832c8c..78a423856a 100644 --- a/app/src/actioncommands.h +++ b/app/src/actioncommands.h @@ -63,6 +63,7 @@ class ActionCommands : public QObject void GotoNextKeyFrame(); void GotoPrevKeyFrame(); Status addNewKey(); + void interpolateKeyframes(); /** Will insert a keyframe at the current position and push connected frames to the right */ Status insertKeyFrameAtCurrentPosition(); diff --git a/app/src/mainwindow2.cpp b/app/src/mainwindow2.cpp index bbe92fea03..99fe070208 100644 --- a/app/src/mainwindow2.cpp +++ b/app/src/mainwindow2.cpp @@ -390,6 +390,7 @@ void MainWindow2::createMenus() connect(ui->actionFlip_inbetween, &QAction::triggered, pPlaybackManager, &PlaybackManager::playFlipInBetween); connect(ui->actionFlip_rolling, &QAction::triggered, pPlaybackManager, &PlaybackManager::playFlipRoll); + connect(ui->actionInterpolate_KeyFrames, &QAction::triggered, mCommands, &ActionCommands::interpolateKeyframes); connect(ui->actionAdd_Frame, &QAction::triggered, mCommands, &ActionCommands::insertKeyFrameAtCurrentPosition); connect(ui->actionRemove_Frame, &QAction::triggered, mCommands, &ActionCommands::removeKey); connect(ui->actionAdd_Frame_Exposure, &QAction::triggered, mCommands, &ActionCommands::addExposureToSelectedFrames); diff --git a/app/ui/mainwindow2.ui b/app/ui/mainwindow2.ui index 50b1089978..ae8c041974 100644 --- a/app/ui/mainwindow2.ui +++ b/app/ui/mainwindow2.ui @@ -244,6 +244,7 @@ + @@ -1289,6 +1290,11 @@ 30° + + + Interpolate KeyFrames + + diff --git a/core_lib/src/util/pencildef.h b/core_lib/src/util/pencildef.h index a125b0697a..80dc4fe54d 100644 --- a/core_lib/src/util/pencildef.h +++ b/core_lib/src/util/pencildef.h @@ -178,6 +178,7 @@ const static float RotationHandleOffset = 50; #define CMD_GOTO_NEXT_KEY_FRAME "CmdGotoNextKeyFrame" #define CMD_GOTO_PREV_KEY_FRAME "CmdGotoPreviousKeyFrame" #define CMD_ADD_FRAME "CmdAddFrame" +#define CMD_INTERPOLATE_FRAMES "CmdInterpolateFrames" #define CMD_DUPLICATE_FRAME "CmdDuplicateFrame" #define CMD_REMOVE_FRAME "CmdRemoveFrame" #define CMD_REVERSE_SELECTED_FRAMES "CmdReverseSelectedFrames" From bdc478a62d65df898bfd4823e318240cf7a6b56d Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Tue, 1 Aug 2023 14:24:19 +0200 Subject: [PATCH 02/17] Clean up and refactoring logic. --- app/src/actioncommands.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 8630a5ffe1..e4c9a0bf7d 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -33,8 +33,6 @@ GNU General Public License for more details. #include "soundmanager.h" #include "playbackmanager.h" #include "colormanager.h" -#include "preferencemanager.h" -#include "selectionmanager.h" #include "util.h" #include "app_util.h" @@ -43,7 +41,6 @@ GNU General Public License for more details. #include "layerbitmap.h" #include "layervector.h" #include "bitmapimage.h" -#include "vectorimage.h" #include "soundclip.h" #include "camera.h" @@ -624,14 +621,14 @@ void ActionCommands::interpolateKeyframes() int first = framePair[0]; int last = layer->getNextKeyFramePosition(first); - // first and last must be adjacent keyframes - if (last != framePair[1]) + // first and last must be adjacent keyframes, with minimum 1 keyframe in between + if (last != framePair[1] || first == last - 1) cont = false; if (!cont) { QMessageBox::information(mParent, tr("Information"), - tr("To interpolate keframes, you must select to adjacent frames!"), + tr("To interpolate keyframes, select two adjacent keyframes with space between."), QMessageBox::Ok); return; } @@ -646,10 +643,10 @@ void ActionCommands::interpolateKeyframes() QLineF upperLine = QLineF(rect1.topLeft(), rect2.topLeft()); QLineF bottomLine = QLineF(rect1.bottomRight(), rect2.bottomRight()); - int counter = 1; KeyFrame* keyframe = layer->getKeyFrameAt(first); qreal percent = 0.0; + int counter = 1; qreal interpolations = static_cast(last - first); for (int i = first + 1; i < last; i++) @@ -665,7 +662,7 @@ void ActionCommands::interpolateKeyframes() mEditor->scrubTo(i); counter++; } - + mEditor->scrubTo(last); } void ActionCommands::exposeSelectedFrames(int offset) From 1cd3dd721e12ea510c8921b9e419dde2c1cb44a2 Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Wed, 2 Aug 2023 07:22:56 +0200 Subject: [PATCH 03/17] Fixed problem when keyframe was copied from TEMP dir. --- app/src/actioncommands.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index e4c9a0bf7d..2eca006c36 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -651,6 +651,8 @@ void ActionCommands::interpolateKeyframes() for (int i = first + 1; i < last; i++) { + if (counter > 1) + keyframe = layer->getKeyFrameAt(i - 1); KeyFrame* dupKey = keyframe->clone(); layer->addKeyFrame(i, dupKey); BitmapImage* image = layer->getBitmapImageAtFrame(i); @@ -662,6 +664,7 @@ void ActionCommands::interpolateKeyframes() mEditor->scrubTo(i); counter++; } + emit mEditor->updateTimeLine(); mEditor->scrubTo(last); } From cb2bf37daada8a7257a6da21a260f526c25d792c Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Fri, 4 Aug 2023 20:26:20 +0200 Subject: [PATCH 04/17] Works as expected. Timeline not updating until keypress. Hmmm --- app/src/actioncommands.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 2eca006c36..e3de12435b 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -655,16 +655,17 @@ void ActionCommands::interpolateKeyframes() keyframe = layer->getKeyFrameAt(i - 1); KeyFrame* dupKey = keyframe->clone(); layer->addKeyFrame(i, dupKey); + mEditor->scrubTo(i); BitmapImage* image = layer->getBitmapImageAtFrame(i); percent = counter / interpolations; QRect transformer = QRect(upperLine.pointAt(percent).toPoint(), bottomLine.pointAt(percent).toPoint()); image->transform(transformer, true); image->modification(); - mEditor->scrubTo(i); counter++; + layer->markFrameAsDirty(i); } - emit mEditor->updateTimeLine(); + emit mEditor->framesModified(); mEditor->scrubTo(last); } From c864a83accb8e34dfaa79f82185d8107abb17812 Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Wed, 14 Feb 2024 14:46:42 +0100 Subject: [PATCH 05/17] Refactoring. Update timeline still does not work. --- app/src/actioncommands.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index e3de12435b..3baac54fee 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -655,7 +655,6 @@ void ActionCommands::interpolateKeyframes() keyframe = layer->getKeyFrameAt(i - 1); KeyFrame* dupKey = keyframe->clone(); layer->addKeyFrame(i, dupKey); - mEditor->scrubTo(i); BitmapImage* image = layer->getBitmapImageAtFrame(i); percent = counter / interpolations; QRect transformer = QRect(upperLine.pointAt(percent).toPoint(), @@ -664,7 +663,9 @@ void ActionCommands::interpolateKeyframes() image->modification(); counter++; layer->markFrameAsDirty(i); + mEditor->scrubTo(i); } + emit mEditor->updateTimeLine(); emit mEditor->framesModified(); mEditor->scrubTo(last); } From 399aa9c8bd1814f55ab593c7f230bf7ba7d56570 Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Tue, 20 Feb 2024 11:12:00 +0100 Subject: [PATCH 06/17] Still trying to make update-timeline work... --- app/src/actioncommands.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 3c1076dc75..8228a68b2b 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -704,6 +704,8 @@ void ActionCommands::interpolateKeyframes() keyframe = layer->getKeyFrameAt(i - 1); KeyFrame* dupKey = keyframe->clone(); layer->addKeyFrame(i, dupKey); + mEditor->scrubTo(i); + emit mEditor->frameModified(i); BitmapImage* image = layer->getBitmapImageAtFrame(i); percent = counter / interpolations; QRect transformer = QRect(upperLine.pointAt(percent).toPoint(), @@ -712,7 +714,6 @@ void ActionCommands::interpolateKeyframes() image->modification(); counter++; layer->markFrameAsDirty(i); - mEditor->scrubTo(i); } emit mEditor->updateTimeLine(); emit mEditor->framesModified(); From 865ced5c79d11b3002e88f790879e087295cd1f7 Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Tue, 27 Feb 2024 20:58:49 +0100 Subject: [PATCH 07/17] Finally figured out why timeline was not updated, with help from MrStevns --- app/src/actioncommands.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 8228a68b2b..838ea095e4 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -682,6 +682,7 @@ void ActionCommands::interpolateKeyframes() return; } + layer->deselectAll(); BitmapImage* img1 = layer->getBitmapImageAtFrame(first); mEditor->scrubTo(first); QRect rect1 = img1->bounds(); From 856473943b0d562e9dbeba9284299f0f8a496bb0 Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Tue, 27 Feb 2024 22:01:28 +0100 Subject: [PATCH 08/17] Removed two unnecessary emits --- app/src/actioncommands.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 838ea095e4..babac3b82c 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -716,8 +716,6 @@ void ActionCommands::interpolateKeyframes() counter++; layer->markFrameAsDirty(i); } - emit mEditor->updateTimeLine(); - emit mEditor->framesModified(); mEditor->scrubTo(last); } From a54cfc231ab492be95f1c25b3ad984d73a76b2dd Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Tue, 1 Aug 2023 12:26:00 +0200 Subject: [PATCH 09/17] Makes it possible to interpolate keyframes, to optain parallaxe effect --- app/src/actioncommands.cpp | 60 +++++++++++++++++++++++++++++++++++ app/src/actioncommands.h | 1 + app/src/mainwindow2.cpp | 1 + app/ui/mainwindow2.ui | 6 ++++ core_lib/src/util/pencildef.h | 1 + 5 files changed, 69 insertions(+) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 347779eeb5..070b764066 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -657,6 +657,66 @@ Status ActionCommands::addNewKey() return Status::OK; } +void ActionCommands::interpolateKeyframes() +{ + bool cont = true; + // must be bitmap layer + if (mEditor->layers()->currentLayer()->type() != Layer::BITMAP) + cont = false; + + LayerBitmap* layer = static_cast(mEditor->layers()->currentLayer()); + QList framePair = layer->selectedKeyFramesPositions(); + + // must be exactly two frames + if (framePair.length() != 2) + cont = false; + + int first = framePair[0]; + int last = layer->getNextKeyFramePosition(first); + // first and last must be adjacent keyframes + if (last != framePair[1]) + cont = false; + + if (!cont) { + QMessageBox::information(mParent, + tr("Information"), + tr("To interpolate keframes, you must select to adjacent frames!"), + QMessageBox::Ok); + return; + } + + BitmapImage* img1 = layer->getBitmapImageAtFrame(first); + mEditor->scrubTo(first); + QRect rect1 = img1->bounds(); + BitmapImage* img2 = layer->getBitmapImageAtFrame(last); + mEditor->scrubTo(last); + QRect rect2 = img2->bounds(); + + QLineF upperLine = QLineF(rect1.topLeft(), rect2.topLeft()); + QLineF bottomLine = QLineF(rect1.bottomRight(), rect2.bottomRight()); + + int counter = 1; + KeyFrame* keyframe = layer->getKeyFrameAt(first); + + qreal percent = 0.0; + qreal interpolations = static_cast(last - first); + + for (int i = first + 1; i < last; i++) + { + KeyFrame* dupKey = keyframe->clone(); + layer->addKeyFrame(i, dupKey); + BitmapImage* image = layer->getBitmapImageAtFrame(i); + percent = counter / interpolations; + QRect transformer = QRect(upperLine.pointAt(percent).toPoint(), + bottomLine.pointAt(percent).toPoint()); + image->transform(transformer, true); + image->modification(); + mEditor->scrubTo(i); + counter++; + } + +} + void ActionCommands::exposeSelectedFrames(int offset) { Layer* currentLayer = mEditor->layers()->currentLayer(); diff --git a/app/src/actioncommands.h b/app/src/actioncommands.h index 6d8ac3e340..80632717f5 100644 --- a/app/src/actioncommands.h +++ b/app/src/actioncommands.h @@ -64,6 +64,7 @@ class ActionCommands : public QObject void GotoNextKeyFrame(); void GotoPrevKeyFrame(); Status addNewKey(); + void interpolateKeyframes(); /** Will insert a keyframe at the current position and push connected frames to the right */ Status insertKeyFrameAtCurrentPosition(); diff --git a/app/src/mainwindow2.cpp b/app/src/mainwindow2.cpp index 0426ebe9fd..6eb9c1bcf2 100644 --- a/app/src/mainwindow2.cpp +++ b/app/src/mainwindow2.cpp @@ -393,6 +393,7 @@ void MainWindow2::createMenus() connect(ui->actionFlip_inbetween, &QAction::triggered, pPlaybackManager, &PlaybackManager::playFlipInBetween); connect(ui->actionFlip_rolling, &QAction::triggered, pPlaybackManager, &PlaybackManager::playFlipRoll); + connect(ui->actionInterpolate_KeyFrames, &QAction::triggered, mCommands, &ActionCommands::interpolateKeyframes); connect(ui->actionAdd_Frame, &QAction::triggered, mCommands, &ActionCommands::insertKeyFrameAtCurrentPosition); connect(ui->actionRemove_Frame, &QAction::triggered, mCommands, &ActionCommands::removeKey); connect(ui->actionAdd_Frame_Exposure, &QAction::triggered, mCommands, &ActionCommands::addExposureToSelectedFrames); diff --git a/app/ui/mainwindow2.ui b/app/ui/mainwindow2.ui index ca958065c4..7e07b1befc 100644 --- a/app/ui/mainwindow2.ui +++ b/app/ui/mainwindow2.ui @@ -245,6 +245,7 @@ + @@ -1282,6 +1283,11 @@ 30° + + + Interpolate KeyFrames + + diff --git a/core_lib/src/util/pencildef.h b/core_lib/src/util/pencildef.h index 3ca2c6fddb..4fa36f1605 100644 --- a/core_lib/src/util/pencildef.h +++ b/core_lib/src/util/pencildef.h @@ -174,6 +174,7 @@ const static int MaxFramesBound = 9999; #define CMD_GOTO_NEXT_KEY_FRAME "CmdGotoNextKeyFrame" #define CMD_GOTO_PREV_KEY_FRAME "CmdGotoPreviousKeyFrame" #define CMD_ADD_FRAME "CmdAddFrame" +#define CMD_INTERPOLATE_FRAMES "CmdInterpolateFrames" #define CMD_DUPLICATE_FRAME "CmdDuplicateFrame" #define CMD_REMOVE_FRAME "CmdRemoveFrame" #define CMD_REVERSE_SELECTED_FRAMES "CmdReverseSelectedFrames" From c19fa8363ca18d1e6f791b0a6f2bbf84193b2b57 Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Tue, 1 Aug 2023 14:24:19 +0200 Subject: [PATCH 10/17] Clean up and refactoring logic. --- app/src/actioncommands.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 070b764066..e5bae35d0b 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -33,8 +33,6 @@ GNU General Public License for more details. #include "soundmanager.h" #include "playbackmanager.h" #include "colormanager.h" -#include "preferencemanager.h" -#include "selectionmanager.h" #include "util.h" #include "app_util.h" @@ -43,7 +41,6 @@ GNU General Public License for more details. #include "layerbitmap.h" #include "layervector.h" #include "bitmapimage.h" -#include "vectorimage.h" #include "soundclip.h" #include "camera.h" @@ -673,14 +670,14 @@ void ActionCommands::interpolateKeyframes() int first = framePair[0]; int last = layer->getNextKeyFramePosition(first); - // first and last must be adjacent keyframes - if (last != framePair[1]) + // first and last must be adjacent keyframes, with minimum 1 keyframe in between + if (last != framePair[1] || first == last - 1) cont = false; if (!cont) { QMessageBox::information(mParent, tr("Information"), - tr("To interpolate keframes, you must select to adjacent frames!"), + tr("To interpolate keyframes, select two adjacent keyframes with space between."), QMessageBox::Ok); return; } @@ -695,10 +692,10 @@ void ActionCommands::interpolateKeyframes() QLineF upperLine = QLineF(rect1.topLeft(), rect2.topLeft()); QLineF bottomLine = QLineF(rect1.bottomRight(), rect2.bottomRight()); - int counter = 1; KeyFrame* keyframe = layer->getKeyFrameAt(first); qreal percent = 0.0; + int counter = 1; qreal interpolations = static_cast(last - first); for (int i = first + 1; i < last; i++) @@ -714,7 +711,7 @@ void ActionCommands::interpolateKeyframes() mEditor->scrubTo(i); counter++; } - + mEditor->scrubTo(last); } void ActionCommands::exposeSelectedFrames(int offset) From 6e40bbd3cb280ecc6b4f9cad55faea3ee71d860c Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Wed, 2 Aug 2023 07:22:56 +0200 Subject: [PATCH 11/17] Fixed problem when keyframe was copied from TEMP dir. --- app/src/actioncommands.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index e5bae35d0b..9348ca5ce5 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -700,6 +700,8 @@ void ActionCommands::interpolateKeyframes() for (int i = first + 1; i < last; i++) { + if (counter > 1) + keyframe = layer->getKeyFrameAt(i - 1); KeyFrame* dupKey = keyframe->clone(); layer->addKeyFrame(i, dupKey); BitmapImage* image = layer->getBitmapImageAtFrame(i); @@ -711,6 +713,7 @@ void ActionCommands::interpolateKeyframes() mEditor->scrubTo(i); counter++; } + emit mEditor->updateTimeLine(); mEditor->scrubTo(last); } From bf45b77892a0b2d27940f524dda42f22b15cbf8c Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Fri, 4 Aug 2023 20:26:20 +0200 Subject: [PATCH 12/17] Works as expected. Timeline not updating until keypress. Hmmm --- app/src/actioncommands.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 9348ca5ce5..fba8a2f796 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -704,16 +704,17 @@ void ActionCommands::interpolateKeyframes() keyframe = layer->getKeyFrameAt(i - 1); KeyFrame* dupKey = keyframe->clone(); layer->addKeyFrame(i, dupKey); + mEditor->scrubTo(i); BitmapImage* image = layer->getBitmapImageAtFrame(i); percent = counter / interpolations; QRect transformer = QRect(upperLine.pointAt(percent).toPoint(), bottomLine.pointAt(percent).toPoint()); image->transform(transformer, true); image->modification(); - mEditor->scrubTo(i); counter++; + layer->markFrameAsDirty(i); } - emit mEditor->updateTimeLine(); + emit mEditor->framesModified(); mEditor->scrubTo(last); } From 67e343623fcb073054d01c72fd7360a6b5a06897 Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Wed, 14 Feb 2024 14:46:42 +0100 Subject: [PATCH 13/17] Refactoring. Update timeline still does not work. --- app/src/actioncommands.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index fba8a2f796..3c1076dc75 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -704,7 +704,6 @@ void ActionCommands::interpolateKeyframes() keyframe = layer->getKeyFrameAt(i - 1); KeyFrame* dupKey = keyframe->clone(); layer->addKeyFrame(i, dupKey); - mEditor->scrubTo(i); BitmapImage* image = layer->getBitmapImageAtFrame(i); percent = counter / interpolations; QRect transformer = QRect(upperLine.pointAt(percent).toPoint(), @@ -713,7 +712,9 @@ void ActionCommands::interpolateKeyframes() image->modification(); counter++; layer->markFrameAsDirty(i); + mEditor->scrubTo(i); } + emit mEditor->updateTimeLine(); emit mEditor->framesModified(); mEditor->scrubTo(last); } From 8a724f923ba9a10ed580ebd64eee5ac1f39a21b4 Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Tue, 20 Feb 2024 11:12:00 +0100 Subject: [PATCH 14/17] Still trying to make update-timeline work... --- app/src/actioncommands.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 3c1076dc75..8228a68b2b 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -704,6 +704,8 @@ void ActionCommands::interpolateKeyframes() keyframe = layer->getKeyFrameAt(i - 1); KeyFrame* dupKey = keyframe->clone(); layer->addKeyFrame(i, dupKey); + mEditor->scrubTo(i); + emit mEditor->frameModified(i); BitmapImage* image = layer->getBitmapImageAtFrame(i); percent = counter / interpolations; QRect transformer = QRect(upperLine.pointAt(percent).toPoint(), @@ -712,7 +714,6 @@ void ActionCommands::interpolateKeyframes() image->modification(); counter++; layer->markFrameAsDirty(i); - mEditor->scrubTo(i); } emit mEditor->updateTimeLine(); emit mEditor->framesModified(); From 4974a9753d97501a2335179faff6834c8e63bd9d Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Tue, 27 Feb 2024 20:58:49 +0100 Subject: [PATCH 15/17] Finally figured out why timeline was not updated, with help from MrStevns --- app/src/actioncommands.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 8228a68b2b..838ea095e4 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -682,6 +682,7 @@ void ActionCommands::interpolateKeyframes() return; } + layer->deselectAll(); BitmapImage* img1 = layer->getBitmapImageAtFrame(first); mEditor->scrubTo(first); QRect rect1 = img1->bounds(); From 1060cac7e1890b7174e8fee5e17be51f24ebafb8 Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Tue, 27 Feb 2024 22:01:28 +0100 Subject: [PATCH 16/17] Removed two unnecessary emits --- app/src/actioncommands.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/actioncommands.cpp b/app/src/actioncommands.cpp index 838ea095e4..babac3b82c 100644 --- a/app/src/actioncommands.cpp +++ b/app/src/actioncommands.cpp @@ -716,8 +716,6 @@ void ActionCommands::interpolateKeyframes() counter++; layer->markFrameAsDirty(i); } - emit mEditor->updateTimeLine(); - emit mEditor->framesModified(); mEditor->scrubTo(last); } From 194830391dc6fa2d0edc4e31872483f3bc7669bd Mon Sep 17 00:00:00 2001 From: David Lamhauge Date: Thu, 21 Nov 2024 15:46:44 +0100 Subject: [PATCH 17/17] fixed ui error --- app/ui/mainwindow2.ui | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/ui/mainwindow2.ui b/app/ui/mainwindow2.ui index df5af2a169..2ecb2b5352 100644 --- a/app/ui/mainwindow2.ui +++ b/app/ui/mainwindow2.ui @@ -1277,6 +1277,8 @@ Interpolate KeyFrames + + Remove Last Polyline Segment