OpenToonz - An open-source full-featured 2D animation creation software
C
Merge branch 'master' into shortplay
Jeremy Bullock40ef9074b3e3
diff --cc toonz/sources/toonz/mainwindow.cppindex dbf77aaaf,ab9761743..b30502be7--- a/toonz/sources/toonz/mainwindow.cpp+++ b/toonz/sources/toonz/mainwindow.cpp@@@ -1870,21 -1904,23 +1904,24 @@@ void MainWindow::defineActions()// createToolOptionsAction("A_ToolOption_Link", tr("Link"), "");createToggle(MI_Link, tr("Link Flipbooks"), "", LinkToggleAction ? 1 : 0,- MenuViewCommandType);+ MenuPlayCommandType);++ createMenuPlayAction(MI_Play, tr("Play"), "P");++ createMenuPlayAction(MI_ShortPlay, tr("Short Play"), "Alt+P");+ createMenuPlayAction(MI_Loop, tr("Loop"), "L");+ createMenuPlayAction(MI_Pause, tr("Pause"), "");+ createMenuPlayAction(MI_FirstFrame, tr("First Frame"), "Alt+,");+ createMenuPlayAction(MI_LastFrame, tr("Last Frame"), "Alt+.");+ createMenuPlayAction(MI_PrevFrame, tr("Previous Frame"), "Shift+,");+ createMenuPlayAction(MI_NextFrame, tr("Next Frame"), "Shift+.");- createPlaybackAction(MI_Play, tr("Play"), "P");- createPlaybackAction(MI_ShortPlay, tr("Short Play"), "Alt+P");- createPlaybackAction(MI_Loop, tr("Loop"), "L");- createPlaybackAction(MI_Pause, tr("Pause"), "");- createPlaybackAction(MI_FirstFrame, tr("First Frame"), "Alt+,");- createPlaybackAction(MI_LastFrame, tr("Last Frame"), "Alt+.");- createPlaybackAction(MI_PrevFrame, tr("Previous Frame"), "Shift+,");- createPlaybackAction(MI_NextFrame, tr("Next Frame"), "Shift+.");+ createMenuPlayAction(MI_NextDrawing, tr("Next Drawing"), ".");+ createMenuPlayAction(MI_PrevDrawing, tr("Prev Drawing"), ",");+ createMenuPlayAction(MI_NextStep, tr("Next Step"), "");+ createMenuPlayAction(MI_PrevStep, tr("Prev Step"), "");- createAction(MI_NextDrawing, tr("Next Drawing"), ".", PlaybackCommandType);- createAction(MI_PrevDrawing, tr("Prev Drawing"), ",", PlaybackCommandType);- createAction(MI_NextStep, tr("Next Step"), "", PlaybackCommandType);- createAction(MI_PrevStep, tr("Prev Step"), "", PlaybackCommandType);+ createMenuPlayAction(MI_NextKeyframe, tr("Next Key"), "Ctrl+.");+ createMenuPlayAction(MI_PrevKeyframe, tr("Prev Key"), "Ctrl+,");createRGBAAction(MI_RedChannel, tr("Red Channel"), "");createRGBAAction(MI_GreenChannel, tr("Green Channel"), "");diff --cc toonz/sources/toonz/preferencespopup.hindex 0e3386849,ff316f80c..3c2a9c4aa--- a/toonz/sources/toonz/preferencespopup.h+++ b/toonz/sources/toonz/preferencespopup.h@@@ -70,7 -71,7 +71,7 @@@ privateDVGui::IntLineEdit *m_minuteFld, *m_chunkSizeFld, *m_iconSizeLx,*m_iconSizeLy, *m_viewShrink, *m_viewStep, *m_blanksCount,*m_onionPaperThickness, *m_animationStepField, *m_undoMemorySize,- *m_xsheetStep, *m_ffmpegTimeout, *m_shortPlayFrameCount;- *m_xsheetStep, *m_ffmpegTimeout, *m_backupKeepCount;++ *m_xsheetStep, *m_ffmpegTimeout, *m_shortPlayFrameCount, *m_backupKeepCount;QPushButton *m_addLevelFormat, *m_removeLevelFormat, *m_editLevelFormat;diff --cc toonz/sources/toonz/vcrcommand.cppindex 87ba6b932,63f3ccfce..ac4dd6463--- a/toonz/sources/toonz/vcrcommand.cpp+++ b/toonz/sources/toonz/vcrcommand.cpp@@@ -129,19 -132,59 +132,83 @@@ public//-----------------------------------------------------------------------------+class ShortPlayCommand final : public MenuItemHandler {+public:+ ShortPlayCommand() : MenuItemHandler(MI_ShortPlay) {}++ void execute() override {+ int row = TApp::instance()->getCurrentFrame()->getFrame();++ int shortPlayFrameCount = Preferences::instance()->getShortPlayFrameCount();+ int count =+ TApp::instance()->getCurrentXsheet()->getXsheet()->getFrameCount();- if (count > 8) {- TApp::instance()->getCurrentFrame()->setFrame(std::max(- 0, count - Preferences::instance()->getShortPlayFrameCount()));++ if (count >= shortPlayFrameCount) {++ int newFrame = std::max(++ 0, count - shortPlayFrameCount);++ // there is a bug in playback.++ // currently playback basically ignores the first frame.++ // it goes on to the 2nd frame in the play range right away.++ if (newFrame > 0) newFrame -= 1;++ TApp::instance()->getCurrentFrame()->setFrame(newFrame);++ CommandManager::instance()->execute(MI_Play);++ }++ }++};++++//-----------------------------------------------------------------------------+++ class NextKeyframeCommand final : public MenuItemHandler {+ public:+ NextKeyframeCommand() : MenuItemHandler(MI_NextKeyframe) {}++ void execute() override {+ QString navControlList[6] = {"LevelPalette", "StudioPalette",+ "FunctionEditor", "FxSettings",+ "ComboViewer", "SceneViewer"};++ QWidget *panel = QApplication::focusWidget();+ if (!panel) panel = TApp::instance()->getActiveViewer();+ while (panel) {+ QString pane = panel->objectName();+ if (panel->windowType() == Qt::WindowType::SubWindow ||+ panel->windowType() == Qt::WindowType::Tool) {+ if (std::find(navControlList, navControlList + 6, pane) !=+ (navControlList + 6)) {+ TApp::instance()->getCurrentFrame()->emitTriggerNextKeyframe(panel);+ break;+ } else+ panel = TApp::instance()->getActiveViewer()->parentWidget();+ } else+ panel = panel->parentWidget();+ }+ }+ };++ //-----------------------------------------------------------------------------++ class PrevKeyframeCommand final : public MenuItemHandler {+ public:+ PrevKeyframeCommand() : MenuItemHandler(MI_PrevKeyframe) {}++ void execute() override {+ QString navControlList[6] = {"LevelPalette", "StudioPalette",+ "FunctionEditor", "FxSettings",+ "ComboViewer", "SceneViewer"};++ QWidget *panel = QApplication::focusWidget();+ if (!panel) panel = TApp::instance()->getActiveViewer();+ while (panel) {+ QString pane = panel->objectName();+ if (panel->windowType() == Qt::WindowType::SubWindow ||+ panel->windowType() == Qt::WindowType::Tool) {+ if (std::find(navControlList, navControlList + 6, pane) !=+ (navControlList + 6)) {+ TApp::instance()->getCurrentFrame()->emitTriggerPrevKeyframe(panel);+ break;+ } else+ panel = TApp::instance()->getActiveViewer()->parentWidget();+ } else+ panel = panel->parentWidget();}- CommandManager::instance()->execute(MI_Play);}};@@@ -172,4 -215,6 +239,7 @@@ NextDrawingCommand nextDrawingCommandPrevDrawingCommand prevDrawingCommand;NextStepCommand nextStepCommand;PrevStepCommand prevStepCommand;+ShortPlayCommand shortPlayCommand;++ NextKeyframeCommand nextKeyframeCommand;+ PrevKeyframeCommand prevKeyframeCommand;diff --cc toonz/sources/toonzlib/preferences.cppindex f9ccdfd92,bcda2ce96..2cbcb01db--- a/toonz/sources/toonzlib/preferences.cpp+++ b/toonz/sources/toonzlib/preferences.cpp@@@ -273,8 -273,7 +273,8 @@@ Preferences::Preferences(, m_generatedMovieViewEnabled(true), m_xsheetAutopanEnabled(true), m_ignoreAlphaonColumn1Enabled(false)- , m_rewindAfterPlaybackEnabled(false)- , m_shortPlayFrameCount(12)+ , m_rewindAfterPlaybackEnabled(true)++ , m_shortPlayFrameCount(8), m_fitToFlipbookEnabled(false), m_previewAlwaysOpenNewFlipEnabled(false), m_autosaveEnabled(false)