OpenToonz - An open-source full-featured 2D animation creation software
C
Correct Preview and Camera toggle for Sound columns (#1472)
manongjohn25e6cfef7205
diff --git a/toonz/sources/toonz/comboviewerpane.cpp b/toonz/sources/toonz/comboviewerpane.cppindex 05bd8b790..480adaf11 100644--- a/toonz/sources/toonz/comboviewerpane.cpp+++ b/toonz/sources/toonz/comboviewerpane.cpp@@ -841,6 +841,7 @@ bool ComboViewerPanel::hasSoundtrack() {}TXsheetHandle *xsheetHandle = TApp::instance()->getCurrentXsheet();TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();+ if(!m_sceneViewer->isPreviewEnabled()) prop->m_isPreview = true;m_sound = xsheetHandle->getXsheet()->makeSound(prop);if (m_sound == NULL) {m_hasSoundtrack = false;diff --git a/toonz/sources/toonz/viewerpane.cpp b/toonz/sources/toonz/viewerpane.cppindex 43afba24c..0cdc9db7a 100644--- a/toonz/sources/toonz/viewerpane.cpp+++ b/toonz/sources/toonz/viewerpane.cpp@@ -716,6 +716,7 @@ bool SceneViewerPanel::hasSoundtrack() {}TXsheetHandle *xsheetHandle = TApp::instance()->getCurrentXsheet();TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();+ if (!m_sceneViewer->isPreviewEnabled()) prop->m_isPreview = true;m_sound = xsheetHandle->getXsheet()->makeSound(prop);if (m_sound == NULL) {m_hasSoundtrack = false;diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cppindex a99a27930..b50f5f01f 100644--- a/toonz/sources/toonz/xshcellviewer.cpp+++ b/toonz/sources/toonz/xshcellviewer.cpp@@ -1000,7 +1000,7 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated) {if (!isColumn) continue;// Cells appearance depending on the type of columnif (isSoundColumn)- drawSoundCell(p, row, col);+ drawSoundCell(p, row, col, isReference);else if (isPaletteColumn)drawPaletteCell(p, row, col, isReference);else if (isSoundTextColumn)@@ -1131,7 +1131,7 @@ void CellArea::drawExtenderHandles(QPainter &p) {//------------------------------------------------------------------------------void CellArea::drawSoundCell(QPainter &p, int row, int col) {+void CellArea::drawSoundCell(QPainter &p, int row, int col, bool isReference) {const Orientation *o = m_viewer->orientation();TXshSoundColumn *soundColumn =m_viewer->getXsheet()->getColumn(col)->getSoundColumn();@@ -1168,8 +1168,14 @@ void CellArea::drawSoundCell(QPainter &p, int row, int col) {// get cell colorsQColor cellColor, sideColor;int levelType;- m_viewer->getCellTypeAndColors(levelType, cellColor, sideColor, cell,- isSelected);+ if (isReference) {+ cellColor = (isSelected) ? m_viewer->getSelectedReferenceColumnColor()+ : m_viewer->getReferenceColumnColor();+ sideColor = m_viewer->getReferenceColumnBorderColor();+ }+ else+ m_viewer->getCellTypeAndColors(levelType, cellColor, sideColor, cell,+ isSelected);// cells backgroundp.fillRect(rect, QBrush(cellColor));diff --git a/toonz/sources/toonz/xshcellviewer.h b/toonz/sources/toonz/xshcellviewer.hindex 677c6e462..ed26fc5ed 100644--- a/toonz/sources/toonz/xshcellviewer.h+++ b/toonz/sources/toonz/xshcellviewer.h@@ -86,7 +86,7 @@ class CellArea final : public QWidget {void drawLevelCell(QPainter &p, int row, int col, bool isReference = false);void drawSoundTextCell(QPainter &p, int row, int col);- void drawSoundCell(QPainter &p, int row, int col);+ void drawSoundCell(QPainter &p, int row, int col, bool isReference = false);void drawPaletteCell(QPainter &p, int row, int col, bool isReference = false);void drawKeyframe(QPainter &p, const QRect toBeUpdated);diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cppindex 383f18661..acf9d4656 100644--- a/toonz/sources/toonz/xshcolumnviewer.cpp+++ b/toonz/sources/toonz/xshcolumnviewer.cpp@@ -618,7 +618,7 @@ void ColumnArea::DrawHeader::levelColors(QColor &columnColor,}void ColumnArea::DrawHeader::soundColors(QColor &columnColor,QColor &dragColor) const {- m_viewer->getColumnColor(columnColor, dragColor, col, xsh);+ m_viewer->getColumnColor(columnColor, dragColor, col, xsh);}void ColumnArea::DrawHeader::paletteColors(QColor &columnColor,QColor &dragColor) const {@@ -1226,7 +1226,8 @@ void ColumnArea::drawSoundColumnHead(QPainter &p, int col) { // AREADrawHeader drawHeader(this, p, col);drawHeader.prepare();QColor columnColor, dragColor;- drawHeader.soundColors(columnColor, dragColor);+// drawHeader.soundColors(columnColor, dragColor);+ drawHeader.levelColors(columnColor, dragColor);drawHeader.drawBaseFill(columnColor, dragColor);drawHeader.drawEye();drawHeader.drawPreviewToggle(255);@@ -1868,7 +1869,7 @@ void ColumnArea::mouseReleaseEvent(QMouseEvent *event) {if (m_doOnRelease == ToggleTransparency &&(!m_columnTransparencyPopup || m_columnTransparencyPopup->isHidden())) {column->setCamstandVisible(!column->isCamstandVisible());- app->getCurrentXsheet()->notifyXsheetSoundChanged();+ if (column->getSoundColumn()) app->getCurrentXsheet()->notifyXsheetSoundChanged();} else if (m_doOnRelease == TogglePreviewVisible)column->setPreviewVisible(!column->isPreviewVisible());else if (m_doOnRelease == ToggleLock)diff --git a/toonz/sources/toonzlib/tframehandle.cpp b/toonz/sources/toonzlib/tframehandle.cppindex a5a2be1a4..6b6738cd3 100644--- a/toonz/sources/toonzlib/tframehandle.cpp+++ b/toonz/sources/toonzlib/tframehandle.cpp@@ -338,7 +338,7 @@ bool TFrameHandle::scrub(int r0, int r1, double framePerSecond) {m_audioColumn->scrub(r0, r1);else if (m_xsheet) {int i;- for (i = r0; i <= r1; i++) m_xsheet->scrub(i);+ for (i = r0; i <= r1; i++) m_xsheet->scrub(i, true);}if (onlyOneFrame) return false;diff --git a/toonz/sources/toonzlib/txshcolumn.cpp b/toonz/sources/toonzlib/txshcolumn.cppindex f9547364c..8f29b2dc0 100644--- a/toonz/sources/toonzlib/txshcolumn.cpp+++ b/toonz/sources/toonzlib/txshcolumn.cpp@@ -475,10 +475,12 @@ TXshColumn::ColumnType TXshColumn::toColumnType(int levelType) {}//------------------------------------------------------------------------------bool TXshColumn::isRendered() const {- if (!getXsheet() || !getFx()) return false;- if (!isPreviewVisible()) return false;+// if (!getXsheet() || !getFx()) return false;+// if (!isPreviewVisible()) return false;+ if (!getXsheet() || !isPreviewVisible()) return false;+ if (getColumnType() == eSoundType) return true;+ if (!getFx()) return false;return getXsheet()->getFxDag()->isRendered(getFx());}diff --git a/toonz/sources/toonzlib/txsheet.cpp b/toonz/sources/toonzlib/txsheet.cppindex 446281251..54ff5b29f 100644--- a/toonz/sources/toonzlib/txsheet.cpp+++ b/toonz/sources/toonzlib/txsheet.cpp@@ -1395,8 +1395,8 @@ void searchAudioColumn(TXsheet *xsh, std::vector<TXshSoundColumn *> &sounds,TXshColumn *column = xsh->getColumn(i);if (column) {TXshSoundColumn *soundCol = column->getSoundColumn();- if (soundCol && ((isPreview && soundCol->isPreviewVisible()) ||- (!isPreview && soundCol->isCamstandVisible()))) {+ if (soundCol && ((isPreview && soundCol->isCamstandVisible()) ||+ (!isPreview && soundCol->isPreviewVisible()))) {sounds.push_back(soundCol);continue;}