From d77cdf23f379f3b537ed129a89bf987d051965e0 Mon Sep 17 00:00:00 2001 From: shun_iwasawa Date: Jul 26 2017 05:05:17 +0000 Subject: fixed fps update --- diff --git a/toonz/sources/include/toonzqt/flipconsole.h b/toonz/sources/include/toonzqt/flipconsole.h index cf9e412..def79e2 100644 --- a/toonz/sources/include/toonzqt/flipconsole.h +++ b/toonz/sources/include/toonzqt/flipconsole.h @@ -245,7 +245,7 @@ public: void getFrameRange(int &from, int &to, int &step) const { from = m_from, to = m_to, step = m_step; } - void setFrameRate(int rate); + void setFrameRate(int rate, bool forceUpdate = true); // if doShowHide==true, applies set visible, otherwise applies setEnabled void enableButton(UINT button, bool enable, bool doShowHide = true); void showCurrentFrame(); @@ -331,7 +331,7 @@ private: ImagePainter::VisualSettings m_settings; bool m_isPlay; - int m_fps; + int m_fps, m_sceneFps; bool m_reverse; int m_markerFrom, m_markerTo; bool m_drawBlanksEnabled; diff --git a/toonz/sources/toonz/comboviewerpane.cpp b/toonz/sources/toonz/comboviewerpane.cpp index 6349f47..05bd8b7 100644 --- a/toonz/sources/toonz/comboviewerpane.cpp +++ b/toonz/sources/toonz/comboviewerpane.cpp @@ -714,6 +714,14 @@ void ComboViewerPanel::onSceneChanged() { int frameIndex = fh->getFrameIndex(); int maxFrameIndex = fh->getMaxFrameIndex(); if (frameIndex > maxFrameIndex) maxFrameIndex = frameIndex; + // update fps only when the scene settings is changed + m_flipConsole->setFrameRate(TApp::instance() + ->getCurrentScene() + ->getScene() + ->getProperties() + ->getOutputProperties() + ->getFrameRate(), + false); // update the frame slider's range with new frameHandle m_flipConsole->setFrameRange(1, maxFrameIndex + 1, 1, frameIndex + 1); @@ -736,7 +744,6 @@ void ComboViewerPanel::onSceneSwitched() { enableFlipConsoleForCamerastand(false); m_sceneViewer->enablePreview(SceneViewer::NO_PREVIEW); m_flipConsole->setChecked(FlipConsole::eDefineSubCamera, false); - // set the FPS for new scene m_flipConsole->setFrameRate(TApp::instance() ->getCurrentScene() ->getScene() diff --git a/toonz/sources/toonz/viewerpane.cpp b/toonz/sources/toonz/viewerpane.cpp index 2f28f4b..43afba2 100644 --- a/toonz/sources/toonz/viewerpane.cpp +++ b/toonz/sources/toonz/viewerpane.cpp @@ -600,6 +600,14 @@ void SceneViewerPanel::onSceneChanged() { TApp *app = TApp::instance(); ToonzScene *scene = app->getCurrentScene()->getScene(); assert(scene); + // update fps only when the scene settings is changed + m_flipConsole->setFrameRate(TApp::instance() + ->getCurrentScene() + ->getScene() + ->getProperties() + ->getOutputProperties() + ->getFrameRate(), + false); // vinz: perche veniva fatto? // m_flipConsole->updateCurrentFPS(scene->getProperties()->getOutputProperties()->getFrameRate()); diff --git a/toonz/sources/toonzqt/flipconsole.cpp b/toonz/sources/toonzqt/flipconsole.cpp index 7fc8c0d..6afecf0 100644 --- a/toonz/sources/toonzqt/flipconsole.cpp +++ b/toonz/sources/toonzqt/flipconsole.cpp @@ -443,6 +443,7 @@ FlipConsole::FlipConsole(QVBoxLayout *mainLayout, UINT gadgetsMask, , m_framesCount(1) , m_settings() , m_fps(24) + , m_sceneFps(24) , m_isPlay(false) , m_reverse(false) , m_doubleRed(0) @@ -841,10 +842,13 @@ void FlipConsole::updateCurrentFPS(int val) { //----------------------------------------------------------------------------- -void FlipConsole::setFrameRate(int val) { - if (!m_fpsSlider) return; - m_fpsSlider->setValue(val); - setCurrentFPS(val); +void FlipConsole::setFrameRate(int val, bool forceUpdate) { + if (m_sceneFps != val || forceUpdate) { + if (!m_fpsSlider) return; + m_fpsSlider->setValue(val); + setCurrentFPS(val); + } + m_sceneFps = val; } //-----------------------------------------------------------------------------