Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

fixed fps update

shun_iwasawad77cdf23f379
diff --git a/toonz/sources/include/toonzqt/flipconsole.h b/toonz/sources/include/toonzqt/flipconsole.h
index cf9e4129f..def79e26e 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 6349f47d4..05bd8b790 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 2f28f4bb2..43afba24c 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 7fc8c0d53..6afecf0da 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;
}
//-----------------------------------------------------------------------------