diff --git a/toonz/sources/toonz/comboviewerpane.cpp b/toonz/sources/toonz/comboviewerpane.cpp index cbf7282..f85084e 100644 --- a/toonz/sources/toonz/comboviewerpane.cpp +++ b/toonz/sources/toonz/comboviewerpane.cpp @@ -381,7 +381,8 @@ void ComboViewerPanel::showEvent(QShowEvent *event) { // onXshLevelSwitched(TXshLevel*): changeWindowTitle() + updateFrameRange() ret = ret && connect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onXshLevelSwitched(TXshLevel *))); - + ret = ret && connect(levelHandle, SIGNAL(xshLevelTitleChanged()), this, + SLOT(changeWindowTitle())); // updateFrameRange(): update the frame slider's range ret = ret && connect(levelHandle, SIGNAL(xshLevelChanged()), this, SLOT(updateFrameRange())); @@ -410,13 +411,38 @@ void ComboViewerPanel::showEvent(QShowEvent *event) { void ComboViewerPanel::hideEvent(QHideEvent *event) { StyleShortcutSwitchablePanel::hideEvent(event); - TApp *app = TApp::instance(); - disconnect(app->getCurrentScene()); - disconnect(app->getCurrentLevel()); - disconnect(app->getCurrentFrame()); - disconnect(app->getCurrentObject()); - disconnect(app->getCurrentXsheet()); - disconnect(app->getCurrentTool()); + TApp *app = TApp::instance(); + TFrameHandle *frameHandle = app->getCurrentFrame(); + TSceneHandle *sceneHandle = app->getCurrentScene(); + TXshLevelHandle *levelHandle = app->getCurrentLevel(); + TObjectHandle *objectHandle = app->getCurrentObject(); + TXsheetHandle *xshHandle = app->getCurrentXsheet(); + + disconnect(xshHandle, SIGNAL(xsheetChanged()), this, SLOT(onSceneChanged())); + + disconnect(sceneHandle, SIGNAL(sceneChanged()), this, SLOT(onSceneChanged())); + disconnect(sceneHandle, SIGNAL(nameSceneChanged()), this, + SLOT(changeWindowTitle())); + disconnect(sceneHandle, SIGNAL(sceneSwitched()), this, + SLOT(onSceneChanged())); + disconnect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this, + SLOT(onXshLevelSwitched(TXshLevel *))); + disconnect(levelHandle, SIGNAL(xshLevelChanged()), this, + SLOT(changeWindowTitle())); + disconnect(levelHandle, SIGNAL(xshLevelTitleChanged()), this, + SLOT(changeWindowTitle())); + disconnect(levelHandle, SIGNAL(xshLevelChanged()), this, + SLOT(updateFrameRange())); + + disconnect(frameHandle, SIGNAL(frameSwitched()), this, + SLOT(changeWindowTitle())); + disconnect(frameHandle, SIGNAL(frameSwitched()), this, + SLOT(onFrameChanged())); + disconnect(frameHandle, SIGNAL(frameTypeChanged()), this, + SLOT(onFrameTypeChanged())); + + disconnect(app->getCurrentTool(), SIGNAL(toolSwitched()), m_sceneViewer, + SLOT(onToolSwitched())); m_flipConsole->setActive(false); } diff --git a/toonz/sources/toonz/viewerpane.cpp b/toonz/sources/toonz/viewerpane.cpp index f2b3f5a..55d882a 100644 --- a/toonz/sources/toonz/viewerpane.cpp +++ b/toonz/sources/toonz/viewerpane.cpp @@ -241,9 +241,11 @@ void SceneViewerPanel::showEvent(QShowEvent *event) { ret = ret && connect(xshHandle, SIGNAL(xsheetChanged()), this, SLOT(onSceneChanged())); - + ret = ret && connect(sceneHandle, SIGNAL(sceneSwitched()), this, + SLOT(onSceneChanged())); ret = ret && connect(sceneHandle, SIGNAL(sceneChanged()), this, SLOT(onSceneChanged())); + ret = ret && connect(sceneHandle, SIGNAL(nameSceneChanged()), this, SLOT(changeWindowTitle())); @@ -289,7 +291,8 @@ void SceneViewerPanel::hideEvent(QHideEvent *event) { disconnect(sceneHandle, SIGNAL(sceneChanged()), this, SLOT(onSceneChanged())); disconnect(sceneHandle, SIGNAL(nameSceneChanged()), this, SLOT(changeWindowTitle())); - + disconnect(sceneHandle, SIGNAL(sceneSwitched()), this, + SLOT(onSceneChanged())); disconnect(levelHandle, SIGNAL(xshLevelSwitched(TXshLevel *)), this, SLOT(onXshLevelSwitched(TXshLevel *))); disconnect(levelHandle, SIGNAL(xshLevelChanged()), this, @@ -665,6 +668,16 @@ void SceneViewerPanel::onFrameTypeChanged() { //----------------------------------------------------------------------------- +bool SceneViewerPanel::isFrameAlreadyCached(int frame) { + if (m_sceneViewer->isPreviewEnabled()) { + class Previewer *pr = Previewer::instance(); + return pr->isFrameReady(frame - 1); + } else + return true; +} + +//----------------------------------------------------------------------------- + void SceneViewerPanel::onPreferenceChanged(const QString &prefName) { m_flipConsole->onPreferenceChanged(prefName); StyleShortcutSwitchablePanel::onPreferenceChanged(prefName); diff --git a/toonz/sources/toonz/viewerpane.h b/toonz/sources/toonz/viewerpane.h index 327c130..62c8af2 100644 --- a/toonz/sources/toonz/viewerpane.h +++ b/toonz/sources/toonz/viewerpane.h @@ -60,6 +60,8 @@ public: bool widgetInThisPanelIsFocused() override { return m_sceneViewer->hasFocus(); } + // reimplementation of FlipConsoleOwner::isFrameAlreadyCached + bool isFrameAlreadyCached(int frame) override; protected: void showEvent(QShowEvent *) override;