From 8138653b90391ccb5ca763944e57cf54a77b9135 Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Sep 26 2022 10:08:26 +0000 Subject: toggle blank frames menu command --- diff --git a/toonz/sources/include/toonzqt/flipconsole.h b/toonz/sources/include/toonzqt/flipconsole.h index 91340e5..222a667 100644 --- a/toonz/sources/include/toonzqt/flipconsole.h +++ b/toonz/sources/include/toonzqt/flipconsole.h @@ -224,6 +224,7 @@ public: eFlipHorizontal, eFlipVertical, eResetView, + eBlankFrames, // following values are hard-coded in ImagePainter eBlackBg = 0x40000, eWhiteBg = 0x80000, diff --git a/toonz/sources/toonz/icons/dark/actions/16/blankframes.svg b/toonz/sources/toonz/icons/dark/actions/16/blankframes.svg new file mode 100644 index 0000000..01ee339 --- /dev/null +++ b/toonz/sources/toonz/icons/dark/actions/16/blankframes.svg @@ -0,0 +1,130 @@ + +image/svg+xml + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 6381c69..ba2bda2 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -1992,6 +1992,8 @@ void MainWindow::defineActions() { "nextkey"); createMenuPlayAction(MI_PrevKeyframe, QT_TR_NOOP("Previous Key"), "Ctrl+,", "prevkey"); + createMenuPlayAction(MI_ToggleBlankFrames, QT_TR_NOOP("Toggle Blank Frames"), + "", "blankframes"); // Menu - Render diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.h index 4b2b05b..6197228 100644 --- a/toonz/sources/toonz/menubarcommandids.h +++ b/toonz/sources/toonz/menubarcommandids.h @@ -207,6 +207,7 @@ #define MI_PrevStep "MI_PrevStep" #define MI_NextKeyframe "MI_NextKeyframe" #define MI_PrevKeyframe "MI_PrevKeyframe" +#define MI_ToggleBlankFrames "MI_ToggleBlankFrames" #define MI_RedChannel "MI_RedChannel" #define MI_GreenChannel "MI_GreenChannel" diff --git a/toonz/sources/toonz/toonz.qrc b/toonz/sources/toonz/toonz.qrc index 18daa3a..57e7d66 100644 --- a/toonz/sources/toonz/toonz.qrc +++ b/toonz/sources/toonz/toonz.qrc @@ -215,7 +215,8 @@ icons/dark/actions/16/nextstep.svg icons/dark/actions/16/prevstep.svg icons/dark/actions/16/nextkey.svg - icons/dark/actions/16/prevkey.svg + icons/dark/actions/16/prevkey.svg + icons/dark/actions/16/blankframes.svg icons/dark/actions/16/snapshot.svg icons/dark/actions/16/compare.svg diff --git a/toonz/sources/toonz/vcrcommand.cpp b/toonz/sources/toonz/vcrcommand.cpp index b4a5081..ee0a28d 100644 --- a/toonz/sources/toonz/vcrcommand.cpp +++ b/toonz/sources/toonz/vcrcommand.cpp @@ -137,12 +137,11 @@ public: ShortPlayCommand() : MenuItemHandler(MI_ShortPlay) {} void execute() override { - int row = TApp::instance()->getCurrentFrame()->getFrame(); + int row = TApp::instance()->getCurrentFrame()->getFrame(); int shortPlayFrameCount = Preferences::instance()->getShortPlayFrameCount(); int count = TApp::instance()->getCurrentXsheet()->getXsheet()->getFrameCount(); - int newFrame = std::max( - 0, count - shortPlayFrameCount); + int newFrame = std::max(0, count - shortPlayFrameCount); TApp::instance()->getCurrentFrame()->setFrame(newFrame); CommandManager::instance()->execute(MI_Play); } @@ -159,7 +158,7 @@ public: "FunctionEditor", "FxSettings", "ComboViewer", "SceneViewer"}; - QWidget *panel = QApplication::focusWidget(); + QWidget *panel = QApplication::focusWidget(); if (!panel) panel = TApp::instance()->getActiveViewer(); while (panel) { QString pane = panel->objectName(); @@ -188,7 +187,7 @@ public: "FunctionEditor", "FxSettings", "ComboViewer", "SceneViewer"}; - QWidget *panel = QApplication::focusWidget(); + QWidget *panel = QApplication::focusWidget(); if (!panel) panel = TApp::instance()->getActiveViewer(); while (panel) { QString pane = panel->objectName(); @@ -227,7 +226,8 @@ VcrCommand playCommand(MI_Play, FlipConsole::ePlay), greenChannelGComman(MI_GreenChannelGreyscale, FlipConsole::eGGreen), blueChannelGCommand(MI_BlueChannelGreyscale, FlipConsole::eGBlue), - compareCommand(MI_CompareToSnapshot, FlipConsole::eCompare); + compareCommand(MI_CompareToSnapshot, FlipConsole::eCompare), + blankFramesCommand(MI_ToggleBlankFrames, FlipConsole::eBlankFrames); NextDrawingCommand nextDrawingCommand; PrevDrawingCommand prevDrawingCommand; diff --git a/toonz/sources/toonzqt/flipconsole.cpp b/toonz/sources/toonzqt/flipconsole.cpp index 8babe3f..640b721 100644 --- a/toonz/sources/toonzqt/flipconsole.cpp +++ b/toonz/sources/toonzqt/flipconsole.cpp @@ -169,7 +169,7 @@ void PlaybackExecutor::run() { qint64 nextSampleInstant = timeResolution; qint64 lastFrameCounts[4] = {0, 0, 0, - 0}; // Keep the last 4 'played frames' counts. + 0}; // Keep the last 4 'played frames' counts. qint64 lastSampleInstants[4] = {0, 0, 0, 0}; // Same for the last sampling instants @@ -189,7 +189,7 @@ void PlaybackExecutor::run() { qint64 framesCount = playedFramesCount - lastFrameCounts[currSample]; qint64 elapsedTime = emissionInstant - lastSampleInstants[currSample]; fps = troundp((long double)(1000000000 * framesCount) / - (long double)elapsedTime); + (long double)elapsedTime); targetFrameTime = 1000000000 / (qint64)abs(m_fps); // m_fps could have changed... @@ -294,11 +294,10 @@ void FlipSlider::paintEvent(QPaintEvent *ev) { PBMarkerMarginLeft; if (i == pbStatusSize - 1) nextPos += PBMarkerMarginRight; p.fillRect(currPos, PBColorMarginTop, nextPos - currPos, colorHeight, - ((*m_progressBarStatus)[i] == PBFrameStarted) - ? PBStartedColor - : ((*m_progressBarStatus)[i] == PBFrameFinished) - ? PBFinishedColor - : PBNotStartedColor); + ((*m_progressBarStatus)[i] == PBFrameStarted) ? PBStartedColor + : ((*m_progressBarStatus)[i] == PBFrameFinished) + ? PBFinishedColor + : PBNotStartedColor); currPos = nextPos; } @@ -1026,7 +1025,7 @@ void FlipConsole::applyCustomizeMask() { std::find(m_gadgetsMask.begin(), m_gadgetsMask.end(), eDefineLoadBox) == m_gadgetsMask.end(); bool hasUseLoadBox = std::find(m_gadgetsMask.begin(), m_gadgetsMask.end(), - eUseLoadBox) == m_gadgetsMask.end(); + eUseLoadBox) == m_gadgetsMask.end(); bool hasDefineSubCam = std::find(m_gadgetsMask.begin(), m_gadgetsMask.end(), eDefineSubCamera) == m_gadgetsMask.end(); m_subcamSep->setVisible( @@ -1766,6 +1765,8 @@ QFrame *FlipConsole::createFrameSlider() { m_enableBlankFrameButton->setFixedHeight(24); m_enableBlankFrameButton->setFixedWidth(66); m_enableBlankFrameButton->setObjectName("enableBlankFrameButton"); + + m_buttons[eBlankFrames] = m_enableBlankFrameButton; } // layout