From b7b3862194687939d3ed9efa49d7d1fff560692f Mon Sep 17 00:00:00 2001 From: Jeremy Bullock Date: Jun 08 2017 20:24:50 +0000 Subject: Sound Scrubbing in Combo Viewer and Missing Updates in Scene Viewer --- diff --git a/toonz/sources/toonz/comboviewerpane.cpp b/toonz/sources/toonz/comboviewerpane.cpp index 5caadc5..cbf7282 100644 --- a/toonz/sources/toonz/comboviewerpane.cpp +++ b/toonz/sources/toonz/comboviewerpane.cpp @@ -321,16 +321,13 @@ void ComboViewerPanel::onDrawFrame( assert(frame >= 0); if (frame != frameHandle->getFrameIndex() + 1) { - if (frameHandle->isEditingScene()) { - TXshColumn *column = app->getCurrentXsheet()->getXsheet()->getColumn( - app->getCurrentColumn()->getColumnIndex()); - if (column) { - TXshSoundColumn *soundColumn = column->getSoundColumn(); - if (soundColumn && !soundColumn->isPlaying()) - app->getCurrentFrame()->scrubColumn(frame, frame, soundColumn); - } - } + int oldFrame = frameHandle->getFrame(); frameHandle->setCurrentFrame(frame); + if (!frameHandle->isPlaying() && !frameHandle->isEditingLevel() && + oldFrame != frameHandle->getFrame()) + frameHandle->scrubXsheet( + frame - 1, frame - 1, + TApp::instance()->getCurrentXsheet()->getXsheet()); } else if (settings.m_blankColor != TPixel::Transparent) @@ -811,6 +808,8 @@ void ComboViewerPanel::onPreferenceChanged(const QString &prefName) { StyleShortcutSwitchablePanel::onPreferenceChanged(prefName); } +//----------------------------------------------------------------------------- + void ComboViewerPanel::playAudioFrame(int frame) { if (m_first) { m_first = false; @@ -833,6 +832,8 @@ void ComboViewerPanel::playAudioFrame(int frame) { false); } +//----------------------------------------------------------------------------- + bool ComboViewerPanel::hasSoundtrack() { if (m_sound != NULL) { m_sound = NULL; diff --git a/toonz/sources/toonz/viewerpane.cpp b/toonz/sources/toonz/viewerpane.cpp index 5c79951..f2b3f5a 100644 --- a/toonz/sources/toonz/viewerpane.cpp +++ b/toonz/sources/toonz/viewerpane.cpp @@ -470,7 +470,16 @@ void SceneViewerPanel::enableFlipConsoleForCamerastand(bool on) { //----------------------------------------------------------------------------- -void SceneViewerPanel::onXshLevelSwitched(TXshLevel *) { changeWindowTitle(); } +void SceneViewerPanel::onXshLevelSwitched(TXshLevel *) { + changeWindowTitle(); + m_sceneViewer->update(); + // If the level switched by using the level choose combo box in the film + // strip, + // the current level switches without change in the frame type (level or + // scene). + // For such case, update the frame range of the console here. + if (TApp::instance()->getCurrentFrame()->isEditingLevel()) updateFrameRange(); +} //----------------------------------------------------------------------------- @@ -588,6 +597,12 @@ void SceneViewerPanel::onSceneChanged() { TApp *app = TApp::instance(); ToonzScene *scene = app->getCurrentScene()->getScene(); assert(scene); + m_flipConsole->setFrameRate(TApp::instance() + ->getCurrentScene() + ->getScene() + ->getProperties() + ->getOutputProperties() + ->getFrameRate()); // vinz: perche veniva fatto? // m_flipConsole->updateCurrentFPS(scene->getProperties()->getOutputProperties()->getFrameRate()); @@ -605,12 +620,6 @@ void SceneViewerPanel::onSceneSwitched() { enableFlipConsoleForCamerastand(false); m_sceneViewer->enablePreview(SceneViewer::NO_PREVIEW); m_flipConsole->setChecked(FlipConsole::eDefineSubCamera, false); - m_flipConsole->setFrameRate(TApp::instance() - ->getCurrentScene() - ->getScene() - ->getProperties() - ->getOutputProperties() - ->getFrameRate()); m_sceneViewer->setEditPreviewSubcamera(false); onSceneChanged(); } @@ -686,6 +695,8 @@ void SceneViewerPanel::playAudioFrame(int frame) { false); } +//----------------------------------------------------------------------------- + bool SceneViewerPanel::hasSoundtrack() { if (m_sound != NULL) { m_sound = NULL; diff --git a/toonz/sources/toonz/viewerpane.h b/toonz/sources/toonz/viewerpane.h index 48e5c11..327c130 100644 --- a/toonz/sources/toonz/viewerpane.h +++ b/toonz/sources/toonz/viewerpane.h @@ -57,6 +57,9 @@ public: void onDrawFrame(int frame, const ImagePainter::VisualSettings &settings) override; + bool widgetInThisPanelIsFocused() override { + return m_sceneViewer->hasFocus(); + } protected: void showEvent(QShowEvent *) override; @@ -66,6 +69,13 @@ protected: void createFrameToolBar(); void createPlayToolBar(); void addColorMaskButton(QWidget *parent, const char *iconSVGName, int id); + // reimplementation of TPanel::widgetFocusOnEnter + void widgetFocusOnEnter() override { + m_sceneViewer->setFocus(Qt::OtherFocusReason); + // activate shortcut key for this flipconsole + m_flipConsole->makeCurrent(); + }; + void widgetClearFocusOnLeave() override { m_sceneViewer->clearFocus(); }; void enableFlipConsoleForCamerastand(bool on); void playAudioFrame(int frame); bool hasSoundtrack();