From 95b5216848ffe6bccedfb2a2b4a9b3b7e80da6f6 Mon Sep 17 00:00:00 2001 From: Rodney Date: Jun 02 2023 11:27:05 +0000 Subject: Merge pull request #4843 from shun-iwasawa/c/2_unify_visibility_buttons Unify preview and camstand visibility toggles option by Contrail Co., Ltd. --- diff --git a/stuff/config/qss/Blue/Blue.qss b/stuff/config/qss/Blue/Blue.qss index 3e75526..6197f0f 100644 --- a/stuff/config/qss/Blue/Blue.qss +++ b/stuff/config/qss/Blue/Blue.qss @@ -2368,6 +2368,7 @@ XsheetViewer { qproperty-XsheetPreviewButtonOnImage: url('../Default/imgs/white/x_prev_eye_on.svg'); qproperty-XsheetPreviewButtonBgOffColor: transparent; qproperty-XsheetPreviewButtonOffImage: url('../Default/imgs/white/x_prev_eye_off.svg'); + qproperty-XsheetUnifiedButtonTranspImage: url('../Default/imgs/white/x_prev_eye_transp.svg'); qproperty-XsheetCamstandButtonBgOnColor: #eb906b; qproperty-XsheetCamstandButtonOnImage: url('../Default/imgs/white/x_table_view_on.svg'); qproperty-XsheetCamstandButtonTranspImage: url('../Default/imgs/white/x_table_view_transp.svg'); @@ -2385,6 +2386,7 @@ XsheetViewer { qproperty-TimelinePreviewButtonOnImage: url('../Default/imgs/white/preview_small.svg'); qproperty-TimelinePreviewButtonBgOffColor: #414345; qproperty-TimelinePreviewButtonOffImage: url('none'); + qproperty-TimelineUnifiedButtonTranspImage: url('../Default/imgs/white/preview_trans_small.svg'); qproperty-TimelineCamstandButtonBgOnColor: #414345; qproperty-TimelineCamstandButtonOnImage: url('../Default/imgs/white/table_small.svg'); qproperty-TimelineCamstandButtonTranspImage: url('../Default/imgs/white/trans_small.svg'); diff --git a/stuff/config/qss/Dark/Dark.qss b/stuff/config/qss/Dark/Dark.qss index a995fed..3d7b629 100644 --- a/stuff/config/qss/Dark/Dark.qss +++ b/stuff/config/qss/Dark/Dark.qss @@ -2368,6 +2368,7 @@ XsheetViewer { qproperty-XsheetPreviewButtonOnImage: url('../Default/imgs/white/x_prev_eye_on.svg'); qproperty-XsheetPreviewButtonBgOffColor: transparent; qproperty-XsheetPreviewButtonOffImage: url('../Default/imgs/white/x_prev_eye_off.svg'); + qproperty-XsheetUnifiedButtonTranspImage: url('../Default/imgs/white/x_prev_eye_transp.svg'); qproperty-XsheetCamstandButtonBgOnColor: #eb906b; qproperty-XsheetCamstandButtonOnImage: url('../Default/imgs/white/x_table_view_on.svg'); qproperty-XsheetCamstandButtonTranspImage: url('../Default/imgs/white/x_table_view_transp.svg'); @@ -2385,6 +2386,7 @@ XsheetViewer { qproperty-TimelinePreviewButtonOnImage: url('../Default/imgs/white/preview_small.svg'); qproperty-TimelinePreviewButtonBgOffColor: #303030; qproperty-TimelinePreviewButtonOffImage: url('none'); + qproperty-TimelineUnifiedButtonTranspImage: url('../Default/imgs/white/preview_trans_small.svg'); qproperty-TimelineCamstandButtonBgOnColor: #303030; qproperty-TimelineCamstandButtonOnImage: url('../Default/imgs/white/table_small.svg'); qproperty-TimelineCamstandButtonTranspImage: url('../Default/imgs/white/trans_small.svg'); diff --git a/stuff/config/qss/Default/Default.qss b/stuff/config/qss/Default/Default.qss index b1600d9..5908386 100644 --- a/stuff/config/qss/Default/Default.qss +++ b/stuff/config/qss/Default/Default.qss @@ -2368,6 +2368,7 @@ XsheetViewer { qproperty-XsheetPreviewButtonOnImage: url('imgs/white/x_prev_eye_on.svg'); qproperty-XsheetPreviewButtonBgOffColor: transparent; qproperty-XsheetPreviewButtonOffImage: url('imgs/white/x_prev_eye_off.svg'); + qproperty-XsheetUnifiedButtonTranspImage: url('imgs/white/x_prev_eye_transp.svg'); qproperty-XsheetCamstandButtonBgOnColor: #eb906b; qproperty-XsheetCamstandButtonOnImage: url('imgs/white/x_table_view_on.svg'); qproperty-XsheetCamstandButtonTranspImage: url('imgs/white/x_table_view_transp.svg'); @@ -2385,6 +2386,7 @@ XsheetViewer { qproperty-TimelinePreviewButtonOnImage: url('imgs/white/preview_small.svg'); qproperty-TimelinePreviewButtonBgOffColor: #484848; qproperty-TimelinePreviewButtonOffImage: url('none'); + qproperty-TimelineUnifiedButtonTranspImage: url('imgs/white/preview_trans_small.svg'); qproperty-TimelineCamstandButtonBgOnColor: #484848; qproperty-TimelineCamstandButtonOnImage: url('imgs/white/table_small.svg'); qproperty-TimelineCamstandButtonTranspImage: url('imgs/white/trans_small.svg'); diff --git a/stuff/config/qss/Default/imgs/black/preview_trans_small.svg b/stuff/config/qss/Default/imgs/black/preview_trans_small.svg new file mode 100644 index 0000000..99ad099 --- /dev/null +++ b/stuff/config/qss/Default/imgs/black/preview_trans_small.svg @@ -0,0 +1,46 @@ + + + + + + diff --git a/stuff/config/qss/Default/imgs/black/x_prev_eye_transp.svg b/stuff/config/qss/Default/imgs/black/x_prev_eye_transp.svg new file mode 100644 index 0000000..72e7a33 --- /dev/null +++ b/stuff/config/qss/Default/imgs/black/x_prev_eye_transp.svg @@ -0,0 +1,70 @@ + + + + + + + diff --git a/stuff/config/qss/Default/imgs/white/preview_trans_small.svg b/stuff/config/qss/Default/imgs/white/preview_trans_small.svg new file mode 100644 index 0000000..abd0524 --- /dev/null +++ b/stuff/config/qss/Default/imgs/white/preview_trans_small.svg @@ -0,0 +1,46 @@ + + + + + + diff --git a/stuff/config/qss/Default/imgs/white/x_prev_eye_transp.svg b/stuff/config/qss/Default/imgs/white/x_prev_eye_transp.svg new file mode 100644 index 0000000..72e7a33 --- /dev/null +++ b/stuff/config/qss/Default/imgs/white/x_prev_eye_transp.svg @@ -0,0 +1,70 @@ + + + + + + + diff --git a/stuff/config/qss/Default/less/layouts/xsheet.less b/stuff/config/qss/Default/less/layouts/xsheet.less index b7f44a8..5b10940 100644 --- a/stuff/config/qss/Default/less/layouts/xsheet.less +++ b/stuff/config/qss/Default/less/layouts/xsheet.less @@ -166,6 +166,8 @@ XsheetViewer { qproperty-XsheetPreviewButtonBgOffColor: transparent; qproperty-XsheetPreviewButtonOffImage: url('@{img-url}/x_prev_eye_off.svg'); + qproperty-XsheetUnifiedButtonTranspImage: url('@{img-url}/x_prev_eye_transp.svg'); + qproperty-XsheetCamstandButtonBgOnColor: @xsheet-CamstandButtonBgOn-color; qproperty-XsheetCamstandButtonOnImage: url('@{img-url}/x_table_view_on.svg'); qproperty-XsheetCamstandButtonTranspImage: url('@{img-url}/x_table_view_transp.svg'); @@ -188,6 +190,8 @@ XsheetViewer { qproperty-TimelinePreviewButtonOnImage: url('@{img-url}/preview_small.svg'); qproperty-TimelinePreviewButtonBgOffColor: @bg; qproperty-TimelinePreviewButtonOffImage: url('none'); + + qproperty-TimelineUnifiedButtonTranspImage: url('@{img-url}/preview_trans_small.svg'); qproperty-TimelineCamstandButtonBgOnColor: @bg; qproperty-TimelineCamstandButtonOnImage: url('@{img-url}/table_small.svg'); diff --git a/stuff/config/qss/Light/Light.qss b/stuff/config/qss/Light/Light.qss index ac23e20..6adc115 100644 --- a/stuff/config/qss/Light/Light.qss +++ b/stuff/config/qss/Light/Light.qss @@ -2368,6 +2368,7 @@ XsheetViewer { qproperty-XsheetPreviewButtonOnImage: url('../Default/imgs/black/x_prev_eye_on.svg'); qproperty-XsheetPreviewButtonBgOffColor: transparent; qproperty-XsheetPreviewButtonOffImage: url('../Default/imgs/black/x_prev_eye_off.svg'); + qproperty-XsheetUnifiedButtonTranspImage: url('../Default/imgs/black/x_prev_eye_transp.svg'); qproperty-XsheetCamstandButtonBgOnColor: #ffa683; qproperty-XsheetCamstandButtonOnImage: url('../Default/imgs/black/x_table_view_on.svg'); qproperty-XsheetCamstandButtonTranspImage: url('../Default/imgs/black/x_table_view_transp.svg'); @@ -2385,6 +2386,7 @@ XsheetViewer { qproperty-TimelinePreviewButtonOnImage: url('../Default/imgs/black/preview_small.svg'); qproperty-TimelinePreviewButtonBgOffColor: #DBDBDB; qproperty-TimelinePreviewButtonOffImage: url('none'); + qproperty-TimelineUnifiedButtonTranspImage: url('../Default/imgs/black/preview_trans_small.svg'); qproperty-TimelineCamstandButtonBgOnColor: #DBDBDB; qproperty-TimelineCamstandButtonOnImage: url('../Default/imgs/black/table_small.svg'); qproperty-TimelineCamstandButtonTranspImage: url('../Default/imgs/black/trans_small.svg'); diff --git a/stuff/config/qss/Neutral/Neutral.qss b/stuff/config/qss/Neutral/Neutral.qss index 250127d..3b1a3b1 100644 --- a/stuff/config/qss/Neutral/Neutral.qss +++ b/stuff/config/qss/Neutral/Neutral.qss @@ -2368,6 +2368,7 @@ XsheetViewer { qproperty-XsheetPreviewButtonOnImage: url('../Default/imgs/black/x_prev_eye_on.svg'); qproperty-XsheetPreviewButtonBgOffColor: transparent; qproperty-XsheetPreviewButtonOffImage: url('../Default/imgs/black/x_prev_eye_off.svg'); + qproperty-XsheetUnifiedButtonTranspImage: url('../Default/imgs/black/x_prev_eye_transp.svg'); qproperty-XsheetCamstandButtonBgOnColor: #eb906b; qproperty-XsheetCamstandButtonOnImage: url('../Default/imgs/black/x_table_view_on.svg'); qproperty-XsheetCamstandButtonTranspImage: url('../Default/imgs/black/x_table_view_transp.svg'); @@ -2385,6 +2386,7 @@ XsheetViewer { qproperty-TimelinePreviewButtonOnImage: url('../Default/imgs/black/preview_small.svg'); qproperty-TimelinePreviewButtonBgOffColor: #808080; qproperty-TimelinePreviewButtonOffImage: url('none'); + qproperty-TimelineUnifiedButtonTranspImage: url('../Default/imgs/black/preview_trans_small.svg'); qproperty-TimelineCamstandButtonBgOnColor: #808080; qproperty-TimelineCamstandButtonOnImage: url('../Default/imgs/black/table_small.svg'); qproperty-TimelineCamstandButtonTranspImage: url('../Default/imgs/black/trans_small.svg'); diff --git a/toonz/sources/include/orientation.h b/toonz/sources/include/orientation.h index 2c382b8..d758a26 100644 --- a/toonz/sources/include/orientation.h +++ b/toonz/sources/include/orientation.h @@ -93,6 +93,9 @@ enum class PredefinedRect { PREVIEW_LAYER_AREA, //! clickable area larger than preview icon, containing //! it PREVIEW_LAYER, + UNIFIEDVIEW_LAYER_AREA, //! used when unifying the preview and the camstand + //! toggles + UNIFIEDVIEW_LAYER, LOCK_AREA, //! clickable area larger than lock icon, containing it LOCK, //! the lock icon itself CAMERA_LOCK_AREA, //! lock area for the camera column diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index eac1ace..5278b51 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -396,6 +396,9 @@ public: bool isShowColumnNumbersEnabled() const { return getBoolValue(showColumnNumbers); } + bool isUnifyColumnVisibilityTogglesEnabled() const { + return getBoolValue(unifyColumnVisibilityToggles); + } bool isParentColorsInXsheetColumnEnabled() const { return getBoolValue(parentColorsInXsheetColumn); } diff --git a/toonz/sources/include/toonz/preferencesitemids.h b/toonz/sources/include/toonz/preferencesitemids.h index 4174fc3..70ce829 100644 --- a/toonz/sources/include/toonz/preferencesitemids.h +++ b/toonz/sources/include/toonz/preferencesitemids.h @@ -132,6 +132,7 @@ enum PreferencesItemId { showXSheetToolbar, expandFunctionHeader, showColumnNumbers, + unifyColumnVisibilityToggles, parentColorsInXsheetColumn, highlightLineEverySecond, syncLevelRenumberWithXsheet, diff --git a/toonz/sources/toonz/columncommand.cpp b/toonz/sources/toonz/columncommand.cpp index ad06f47..40329ce 100644 --- a/toonz/sources/toonz/columncommand.cpp +++ b/toonz/sources/toonz/columncommand.cpp @@ -658,6 +658,48 @@ public: int getHistoryType() override { return HistoryType::Xsheet; } }; +//--------------------------------------------------------------------------- + +void doUnifyColumnVisibilityToggles_Recursive(const TXsheet *xsh, + QStringList &modifiedColumnNames, + QList doneList, + QStringList &parentXshStack) { + for (int c = 0; c < xsh->getColumnCount(); c++) { + TXshColumn *column = xsh->getColumn(c); + if (!column || column->isEmpty()) continue; + int colType = column->getColumnType(); + if (colType == TXshColumn::ePaletteType || + colType == TXshColumn::eSoundType || + colType == TXshColumn::eSoundTextType) + continue; + // visibility check + if (column->isPreviewVisible() != column->isCamstandVisible()) { + column->setCamstandVisible(column->isPreviewVisible()); + QString colName = QString::fromStdString( + xsh->getStageObject(TStageObjectId::ColumnId(c))->getName()); + modifiedColumnNames.append(parentXshStack.join(" > ") + colName); + } + + // check subxsheet recursively + TXshCellColumn *cellCol = column->getCellColumn(); + if (!cellCol) continue; + int r0, r1; + column->getRange(r0, r1); + TXshCell cell = cellCol->getCell(r0); + TXshChildLevel *childLevel = cell.m_level->getChildLevel(); + if (childLevel) { + TXsheet *subSheet = childLevel->getXsheet(); + if (!doneList.contains(subSheet)) { + doneList.append(subSheet); + parentXshStack.append(QString::fromStdWString(childLevel->getName())); + doUnifyColumnVisibilityToggles_Recursive(xsh, modifiedColumnNames, + doneList, parentXshStack); + parentXshStack.pop_back(); + } + } + } +} + } // namespace //************************************************************************* @@ -1394,6 +1436,28 @@ bool ColumnCmd::checkExpressionReferences( colIdsToBeDeleted, fxsToBeDeleted, objIdsToBeDuplicated, true); } +//--------------------------------------------------------------------------- +// Check if any column has visibility toggles with different states and the +// "unify visibility toggles" option is enabled +void ColumnCmd::unifyColumnVisibilityToggles() { + TApp *app = TApp::instance(); + ToonzScene *scene = app->getCurrentScene()->getScene(); + QStringList modifiedColumnNames; + QList doneList; + QStringList parentStack; + doUnifyColumnVisibilityToggles_Recursive( + scene->getTopXsheet(), modifiedColumnNames, doneList, parentStack); + if (!modifiedColumnNames.isEmpty()) { + DVGui::warning( + QObject::tr( + "The visibility toggles of following columns are modified \n" + "due to \"Unify Preview and Camstand Visibility Toggles\" " + "preference option : \n %1") + .arg(modifiedColumnNames.join("\n "))); + app->getCurrentScene()->setDirtyFlag(true); + } +} + //============================================================================= namespace { @@ -1482,6 +1546,10 @@ public: column->setPreviewVisible(negate); else column->setPreviewVisible(!column->isPreviewVisible()); + + // sync camstand visibility + if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + column->setCamstandVisible(column->isPreviewVisible()); } if (cmd & (CMD_ENABLE_CAMSTAND | CMD_DISABLE_CAMSTAND | CMD_TOGGLE_CAMSTAND)) { diff --git a/toonz/sources/toonz/columncommand.h b/toonz/sources/toonz/columncommand.h index a0754c5..1526067 100644 --- a/toonz/sources/toonz/columncommand.h +++ b/toonz/sources/toonz/columncommand.h @@ -54,6 +54,10 @@ bool checkExpressionReferences(const std::set &indices, // checkInvert is always true for collapsing in stage schematic bool checkExpressionReferences(const QList &objects); +// Check if any column has visibility toggles with different states and the +// "unify visibility toggles" option is enabled +void unifyColumnVisibilityToggles(); + } // namespace ColumnCmd #endif diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp index 14cfb28..d6c8744 100644 --- a/toonz/sources/toonz/iocommand.cpp +++ b/toonz/sources/toonz/iocommand.cpp @@ -22,6 +22,7 @@ #include "xdtsio.h" #include "expressionreferencemanager.h" #include "levelcommand.h" +#include "columncommand.h" // TnzTools includes #include "tools/toolhandle.h" @@ -1200,7 +1201,6 @@ inline TPaletteP dirtyWhite(const TPaletteP &plt) { return out; } -//--------------------------------------------------------------------------- } // namespace //--------------------------------------------------------------------------- @@ -2088,6 +2088,11 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile, } } + // Check if any column has visibility toggles with different states and the + // "unify visibility toggles" option is enabled + if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + ColumnCmd::unifyColumnVisibilityToggles(); + // caching raster levels int cacheRasterBehavior = Preferences::instance()->getRasterLevelCachingBehavior(); diff --git a/toonz/sources/toonz/layerheaderpanel.cpp b/toonz/sources/toonz/layerheaderpanel.cpp index d7b922c..b188fb6 100644 --- a/toonz/sources/toonz/layerheaderpanel.cpp +++ b/toonz/sources/toonz/layerheaderpanel.cpp @@ -66,7 +66,8 @@ void LayerHeaderPanel::paintEvent(QPaintEvent *event) { : m_viewer->getLayerHeaderLockImage()); drawIcon(p, PredefinedRect::PANEL_EYE, boost::none, preview); - drawIcon(p, PredefinedRect::PANEL_PREVIEW_LAYER, boost::none, camstand); + if (!Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + drawIcon(p, PredefinedRect::PANEL_PREVIEW_LAYER, boost::none, camstand); drawIcon(p, PredefinedRect::PANEL_LOCK, boost::none, lock); } diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index e0199df..f9103db 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -9,6 +9,7 @@ #include "tapp.h" #include "cleanupsettingsmodel.h" #include "formatsettingspopups.h" +#include "columncommand.h" // TnzQt includes #include "toonzqt/tabbar.h" @@ -679,6 +680,18 @@ void PreferencesPopup::onShowXSheetToolbarClicked() { //----------------------------------------------------------------------------- +void PreferencesPopup::onUnifyColumnVisibilityTogglesChanged() { + // Check if any column has visibility toggles with different states and the + // "unify visibility toggles" option is enabled + if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + ColumnCmd::unifyColumnVisibilityToggles(); + + TApp::instance()->getCurrentScene()->notifyPreferenceChanged( + "unifyColumnVisibilityToggles"); +} + +//----------------------------------------------------------------------------- + void PreferencesPopup::onModifyExpressionOnMovingReferencesChanged() { TApp::instance()->getCurrentScene()->notifyPreferenceChanged( "modifyExpressionOnMovingReferences"); @@ -1279,6 +1292,8 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) { {expandFunctionHeader, tr("Expand Function Editor Header to Match Xsheet Toolbar Height*")}, {showColumnNumbers, tr("Show Column Numbers in Column Headers")}, + {unifyColumnVisibilityToggles, + tr("Unify Preview and Camstand Visibility Toggles")}, {parentColorsInXsheetColumn, tr("Show Column Parent's Color in the Xsheet")}, {highlightLineEverySecond, tr("Highlight Line Every Second")}, @@ -2013,6 +2028,7 @@ QWidget* PreferencesPopup::createXsheetPage() { QGridLayout* xshToolbarLay = insertGroupBoxUI(showXSheetToolbar, lay); { insertUI(expandFunctionHeader, xshToolbarLay); } insertUI(showColumnNumbers, lay); + insertUI(unifyColumnVisibilityToggles, lay); insertUI(parentColorsInXsheetColumn, lay); insertUI(highlightLineEverySecond, lay); insertUI(syncLevelRenumberWithXsheet, lay); @@ -2028,6 +2044,9 @@ QWidget* PreferencesPopup::createXsheetPage() { &PreferencesPopup::onShowKeyframesOnCellAreaChanged); m_onEditedFuncMap.insert(showXsheetCameraColumn, &PreferencesPopup::onShowKeyframesOnCellAreaChanged); + m_onEditedFuncMap.insert( + unifyColumnVisibilityToggles, + &PreferencesPopup::onUnifyColumnVisibilityTogglesChanged); return widget; } diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.h index c1e1e1e..de08a94 100644 --- a/toonz/sources/toonz/preferencespopup.h +++ b/toonz/sources/toonz/preferencespopup.h @@ -139,6 +139,7 @@ private: // Xsheet void onShowKeyframesOnCellAreaChanged(); void onShowXSheetToolbarClicked(); + void onUnifyColumnVisibilityTogglesChanged(); // Animation void onModifyExpressionOnMovingReferencesChanged(); // Preview diff --git a/toonz/sources/toonz/tpanels.cpp b/toonz/sources/toonz/tpanels.cpp index 00889eb..bf8e406 100644 --- a/toonz/sources/toonz/tpanels.cpp +++ b/toonz/sources/toonz/tpanels.cpp @@ -266,6 +266,13 @@ void SchematicScenePanel::onColumnPaste(const QList &columns) { //----------------------------------------------------------------------------- +void SchematicScenePanel::onPreferenceChanged(const QString &prefName) { + if (prefName == "unifyColumnVisibilityToggles") + m_schematicViewer->updateSchematic(); +} + +//----------------------------------------------------------------------------- + void SchematicScenePanel::showEvent(QShowEvent *e) { if (m_schematicViewer->isStageSchematicViewed()) setWindowTitle(QObject::tr("Stage Schematic")); @@ -299,6 +306,8 @@ void SchematicScenePanel::showEvent(QShowEvent *e) { SLOT(updateSchematic())); connect(app->getCurrentScene(), SIGNAL(sceneSwitched()), m_schematicViewer, SLOT(onSceneSwitched())); + connect(app->getCurrentScene(), SIGNAL(preferenceChanged(const QString &)), + this, SLOT(onPreferenceChanged(const QString &))); connect(m_schematicViewer, SIGNAL(columnPasted(const QList &)), this, SLOT(onColumnPaste(const QList &))); m_schematicViewer->updateSchematic(); @@ -330,6 +339,8 @@ void SchematicScenePanel::hideEvent(QHideEvent *e) { m_schematicViewer, SLOT(updateSchematic())); disconnect(app->getCurrentScene(), SIGNAL(sceneSwitched()), m_schematicViewer, SLOT(onSceneSwitched())); + disconnect(app->getCurrentScene(), SIGNAL(preferenceChanged(const QString &)), + this, SLOT(onPreferenceChanged(const QString &))); disconnect(m_schematicViewer, SIGNAL(columnPasted(const QList &)), this, SLOT(onColumnPaste(const QList &))); diff --git a/toonz/sources/toonz/tpanels.h b/toonz/sources/toonz/tpanels.h index c06bc53..1102944 100644 --- a/toonz/sources/toonz/tpanels.h +++ b/toonz/sources/toonz/tpanels.h @@ -193,6 +193,7 @@ protected slots: void onDeleteFxs(const FxSelection *); void onDeleteStageObjects(const StageObjectSelection *); void onColumnPaste(const QList &); + void onPreferenceChanged(const QString &); }; //========================================================= diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cpp index d9e38f3..bc153fa 100644 --- a/toonz/sources/toonz/xshcolumnviewer.cpp +++ b/toonz/sources/toonz/xshcolumnviewer.cpp @@ -976,6 +976,43 @@ void ColumnArea::DrawHeader::drawPreviewToggle(int opacity) const { p.drawImage(tableViewImgRect, icon); } +// shows united visibility toggle, which has the same state as the camstand +// toggle (preview toggle should synchonize with the camstand toggle) +void ColumnArea::DrawHeader::drawUnifiedViewToggle(int opacity) const { + if (isEmpty || !o->flag(PredefinedFlag::PREVIEW_LAYER_AREA_VISIBLE)) return; + if (col < 0 && o->isVerticalTimeline()) + return; // no camstand toggle in the camera column + // camstand visible toggle + QColor bgColor; + QImage icon; + int buttonType = !column->isCamstandVisible() ? PREVIEW_OFF_XSHBUTTON + : opacity < 255 ? UNIFIED_TRANSP_XSHBUTTON + : PREVIEW_ON_XSHBUTTON; + m_viewer->getButton(buttonType, bgColor, icon, !o->isVerticalTimeline()); + + QRect unifiedViewRect = + o->rect(PredefinedRect::UNIFIEDVIEW_LAYER_AREA).translated(orig); + QRect unifiedViewImgRect = + o->rect(PredefinedRect::UNIFIEDVIEW_LAYER).translated(orig); + + if (o->isVerticalTimeline()) + p.setPen(m_viewer->getColumnIconLineColor()); // border color + else + p.setPen(m_viewer->getTimelineIconLineColor()); // border color + + if (col < 0 || column->getPaletteColumn() || column->getSoundTextColumn()) { + if (o->flag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER)) + p.drawRect(unifiedViewRect); + return; + } + + p.fillRect(unifiedViewRect, bgColor); + if (o->flag(PredefinedFlag::PREVIEW_LAYER_AREA_BORDER)) + p.drawRect(unifiedViewRect); + + p.drawImage(unifiedViewImgRect, icon); +} + void ColumnArea::DrawHeader::drawLock() const { if (isEmpty || !o->flag(PredefinedFlag::LOCK_AREA_VISIBLE)) return; QColor bgColor; @@ -1582,65 +1619,19 @@ void ColumnArea::drawFoldedColumnHead(QPainter &p, int col) { } void ColumnArea::drawLevelColumnHead(QPainter &p, int col) { - TColumnSelection *selection = m_viewer->getColumnSelection(); - const Orientation *o = m_viewer->orientation(); - - // Preparing painter - QString fontName = Preferences::instance()->getInterfaceFont(); - if (fontName == "") { -#ifdef _WIN32 - fontName = "Arial"; -#else - fontName = "Helvetica"; -#endif - } - static QFont font(fontName, -1, QFont::Normal); - font.setPixelSize(XSHEET_FONT_PX_SIZE); - - p.setFont(font); - p.setRenderHint(QPainter::SmoothPixmapTransform, true); - - // Retrieve reference coordinates - int currentColumnIndex = m_viewer->getCurrentColumn(); - int layerAxis = m_viewer->columnToLayerAxis(col); - - QPoint orig = m_viewer->positionToXY(CellPosition(0, col)); - QRect rect = o->rect(PredefinedRect::LAYER_HEADER).translated(orig); - - TApp *app = TApp::instance(); - TXsheet *xsh = m_viewer->getXsheet(); - - TStageObjectId columnId = m_viewer->getObjectId(col); - TStageObjectId currentColumnId = app->getCurrentObject()->getObjectId(); - TStageObjectId parentId = xsh->getStageObjectParent(columnId); - - // Retrieve column properties - // Check if the column is empty - bool isEmpty = col >= 0 && xsh->isColumnEmpty(col); - TXshColumn *column = col >= 0 ? xsh->getColumn(col) : 0; - - bool isEditingSpline = app->getCurrentObject()->isSpline(); - - // check if the column is current - bool isCurrent = false; - if (currentColumnId == - TStageObjectId::CameraId(xsh->getCameraColumnIndex())) // CAMERA - isCurrent = col == -1; - else - isCurrent = m_viewer->getCurrentColumn() == col; - - bool isSelected = - m_viewer->getColumnSelection()->isColumnSelected(col) && !isEditingSpline; - // bool isCameraSelected = col == -1 && isCurrent && !isEditingSpline; - + TXshColumn *column = col >= 0 ? m_viewer->getXsheet()->getColumn(col) : 0; // Draw column DrawHeader drawHeader(this, p, col); drawHeader.prepare(); QColor columnColor, dragColor; drawHeader.levelColors(columnColor, dragColor); drawHeader.drawBaseFill(columnColor, dragColor); - drawHeader.drawEye(); - drawHeader.drawPreviewToggle(column ? column->getOpacity() : 0); + if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + drawHeader.drawUnifiedViewToggle(column ? column->getOpacity() : 0); + else { + drawHeader.drawEye(); + drawHeader.drawPreviewToggle(column ? column->getOpacity() : 0); + } drawHeader.drawLock(); drawHeader.drawColumnName(); drawHeader.drawColumnNumber(); @@ -1655,37 +1646,10 @@ void ColumnArea::drawLevelColumnHead(QPainter &p, int col) { //----------------------------------------------------------------------------- void ColumnArea::drawSoundColumnHead(QPainter &p, int col) { // AREA - TColumnSelection *selection = m_viewer->getColumnSelection(); - const Orientation *o = m_viewer->orientation(); - - int x = m_viewer->columnToLayerAxis(col); - - p.setRenderHint(QPainter::SmoothPixmapTransform, true); - QString fontName = Preferences::instance()->getInterfaceFont(); - if (fontName == "") { -#ifdef _WIN32 - fontName = "Arial"; -#else - fontName = "Helvetica"; -#endif - } - static QFont font(fontName, -1, QFont::Normal); - font.setPixelSize(XSHEET_FONT_PX_SIZE); - p.setFont(font); - TXsheet *xsh = m_viewer->getXsheet(); TXshSoundColumn *sc = xsh->getColumn(col) ? xsh->getColumn(col)->getSoundColumn() : 0; - QPoint orig = m_viewer->positionToXY(CellPosition(0, col)); - QRect rect = m_viewer->orientation() - ->rect(PredefinedRect::LAYER_HEADER) - .translated(orig); - - QPoint columnNamePos = orig + QPoint(12, o->cellHeight()); - - bool isCurrent = m_viewer->getCurrentColumn() == col; - DrawHeader drawHeader(this, p, col); drawHeader.prepare(); QColor columnColor, dragColor; @@ -1710,36 +1674,6 @@ void ColumnArea::drawSoundColumnHead(QPainter &p, int col) { // AREA //----------------------------------------------------------------------------- void ColumnArea::drawPaletteColumnHead(QPainter &p, int col) { // AREA - TColumnSelection *selection = m_viewer->getColumnSelection(); - const Orientation *o = m_viewer->orientation(); - - QPoint orig = m_viewer->positionToXY(CellPosition(0, std::max(col, -1))); - - QString fontName = Preferences::instance()->getInterfaceFont(); - if (fontName == "") { -#ifdef _WIN32 - fontName = "Arial"; -#else - fontName = "Helvetica"; -#endif - } - static QFont font(fontName, -1, QFont::Normal); - font.setPixelSize(XSHEET_FONT_PX_SIZE); - - p.setFont(font); - p.setRenderHint(QPainter::SmoothPixmapTransform, true); - - int currentColumnIndex = m_viewer->getCurrentColumn(); - int x = m_viewer->columnToLayerAxis(col); - - QRect rect(x, 0, o->cellWidth(), height()); - - TXsheet *xsh = m_viewer->getXsheet(); - - bool isEmpty = false; - if (col >= 0) // Verifico se la colonna e' vuota - isEmpty = xsh->isColumnEmpty(col); - DrawHeader drawHeader(this, p, col); drawHeader.prepare(); QColor columnColor, dragColor; @@ -2417,8 +2351,27 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) { if (event->button() != Qt::LeftButton) return; m_doOnRelease = isCtrlPressed ? ToggleAllLock : ToggleLock; } - // preview button - else if (o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell)) { + // unified view button + else if (Preferences::instance() + ->isUnifyColumnVisibilityTogglesEnabled() && + o->rect(PredefinedRect::UNIFIEDVIEW_LAYER_AREA) + .contains(mouseInCell)) { + if (event->button() != Qt::LeftButton) return; + if (column->getSoundTextColumn()) { + // do nothing + } else { + // sync eye button on release + m_doOnRelease = + isCtrlPressed ? ToggleAllTransparency : ToggleTransparency; + if (!o->flag(PredefinedFlag::CONFIG_AREA_VISIBLE) && + !column->getSoundColumn()) + startTransparencyPopupTimer(event); + } + } + // separated view - preview button + else if (!Preferences::instance() + ->isUnifyColumnVisibilityTogglesEnabled() && + o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell)) { if (event->button() != Qt::LeftButton) return; if (column->getSoundTextColumn()) { // do nothing @@ -2429,8 +2382,10 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) { TApp::instance()->getCurrentXsheet()->notifyXsheetSoundChanged(); } } - // camstand button - else if (o->rect(PredefinedRect::PREVIEW_LAYER_AREA) + // separated view - camstand button + else if (!Preferences::instance() + ->isUnifyColumnVisibilityTogglesEnabled() && + o->rect(PredefinedRect::PREVIEW_LAYER_AREA) .contains(mouseInCell)) { if (event->button() != Qt::LeftButton) return; if (column->getPaletteColumn() || column->getSoundTextColumn()) { @@ -2683,6 +2638,10 @@ void ColumnArea::mouseReleaseEvent(QMouseEvent *event) { TXshColumn *column = xsh->getColumn(m_col); if (m_doOnRelease == ToggleTransparency) { column->setCamstandVisible(!column->isCamstandVisible()); + // sync eye button + if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + column->setPreviewVisible(column->isCamstandVisible()); + if (column->getSoundColumn()) app->getCurrentXsheet()->notifyXsheetSoundChanged(); } else if (m_doOnRelease == TogglePreviewVisible) @@ -2757,6 +2716,9 @@ void ColumnArea::mouseReleaseEvent(QMouseEvent *event) { if (!xsh->isColumnEmpty(col) && !column->getPaletteColumn() && !column->getSoundTextColumn()) { column->setCamstandVisible(!column->isCamstandVisible()); + // sync eye button + if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + column->setPreviewVisible(column->isCamstandVisible()); if (column->getSoundColumn()) sound_changed = true; } } @@ -2781,10 +2743,12 @@ void ColumnArea::mouseReleaseEvent(QMouseEvent *event) { // if necessary. it causes slowness when opening preview flipbook of large // scene. // KNOWN BUG: Side effect, transparency doesn't sync in schematic if false. - bool isTransparencyRendered = app->getCurrentScene() - ->getScene() - ->getProperties() - ->isColumnColorFilterOnRenderEnabled(); + bool isTransparencyRendered = + app->getCurrentScene() + ->getScene() + ->getProperties() + ->isColumnColorFilterOnRenderEnabled() || + Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled(); bool isStateChanged = m_doOnRelease == TogglePreviewVisible || m_doOnRelease == ToggleAllPreviewVisible || m_doOnRelease == ToggleLock || @@ -2858,9 +2822,10 @@ void ColumnArea::contextMenuEvent(QContextMenuEvent *event) { QMenu menu(this); CommandManager *cmdManager = CommandManager::instance(); - //---- Preview + //---- Unified if (((isCamera && !o->isVerticalTimeline()) || !xsh->isColumnEmpty(col)) && - o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell)) { + o->rect(PredefinedRect::UNIFIEDVIEW_LAYER_AREA).contains(mouseInCell) && + Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) { menu.setObjectName("xsheetColumnAreaMenu_Preview"); menu.addAction(cmdManager->getAction("MI_EnableThisColumnOnly")); @@ -2870,24 +2835,25 @@ void ColumnArea::contextMenuEvent(QContextMenuEvent *event) { menu.addAction(cmdManager->getAction("MI_DisableSelectedColumns")); menu.addAction(cmdManager->getAction("MI_SwapEnabledColumns")); } - //---- Lock - else if ((isCamera || !xsh->isColumnEmpty(col)) && - o->rect((isCamera) ? PredefinedRect::CAMERA_LOCK_AREA - : PredefinedRect::LOCK_AREA) - .contains(mouseInCell)) { - menu.setObjectName("xsheetColumnAreaMenu_Lock"); + //---- Preview + else if (((isCamera && !o->isVerticalTimeline()) || + !xsh->isColumnEmpty(col)) && + o->rect(PredefinedRect::EYE_AREA).contains(mouseInCell) && + !Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) { + menu.setObjectName("xsheetColumnAreaMenu_Preview"); - menu.addAction(cmdManager->getAction("MI_LockThisColumnOnly")); - menu.addAction(cmdManager->getAction("MI_LockSelectedColumns")); - menu.addAction(cmdManager->getAction("MI_LockAllColumns")); - menu.addAction(cmdManager->getAction("MI_UnlockSelectedColumns")); - menu.addAction(cmdManager->getAction("MI_UnlockAllColumns")); - menu.addAction(cmdManager->getAction("MI_ToggleColumnLocks")); + menu.addAction(cmdManager->getAction("MI_EnableThisColumnOnly")); + menu.addAction(cmdManager->getAction("MI_EnableSelectedColumns")); + menu.addAction(cmdManager->getAction("MI_EnableAllColumns")); + menu.addAction(cmdManager->getAction("MI_DisableAllColumns")); + menu.addAction(cmdManager->getAction("MI_DisableSelectedColumns")); + menu.addAction(cmdManager->getAction("MI_SwapEnabledColumns")); } //---- Camstand else if (((isCamera && !o->isVerticalTimeline()) || !xsh->isColumnEmpty(col)) && - o->rect(PredefinedRect::PREVIEW_LAYER_AREA).contains(mouseInCell)) { + o->rect(PredefinedRect::PREVIEW_LAYER_AREA).contains(mouseInCell) && + !Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) { menu.setObjectName("xsheetColumnAreaMenu_Camstand"); menu.addAction(cmdManager->getAction("MI_ActivateThisColumnOnly")); @@ -2899,6 +2865,20 @@ void ColumnArea::contextMenuEvent(QContextMenuEvent *event) { // hide all columns placed on the left menu.addAction(cmdManager->getAction("MI_DeactivateUpperColumns")); } + //---- Lock + else if ((isCamera || !xsh->isColumnEmpty(col)) && + o->rect((isCamera) ? PredefinedRect::CAMERA_LOCK_AREA + : PredefinedRect::LOCK_AREA) + .contains(mouseInCell)) { + menu.setObjectName("xsheetColumnAreaMenu_Lock"); + + menu.addAction(cmdManager->getAction("MI_LockThisColumnOnly")); + menu.addAction(cmdManager->getAction("MI_LockSelectedColumns")); + menu.addAction(cmdManager->getAction("MI_LockAllColumns")); + menu.addAction(cmdManager->getAction("MI_UnlockSelectedColumns")); + menu.addAction(cmdManager->getAction("MI_UnlockAllColumns")); + menu.addAction(cmdManager->getAction("MI_ToggleColumnLocks")); + } // right clicking another area / right clicking empty column head else { if (!isCamera) { diff --git a/toonz/sources/toonz/xshcolumnviewer.h b/toonz/sources/toonz/xshcolumnviewer.h index bad711f..cde5a22 100644 --- a/toonz/sources/toonz/xshcolumnviewer.h +++ b/toonz/sources/toonz/xshcolumnviewer.h @@ -334,6 +334,7 @@ class ColumnArea final : public QWidget { void drawBaseFill(const QColor &columnColor, const QColor &dragColor) const; void drawEye() const; void drawPreviewToggle(int opacity) const; + void drawUnifiedViewToggle(int opacity) const; void drawLock() const; void drawConfig() const; void drawColumnNumber() const; diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp index 70e02dd..33eb34d 100644 --- a/toonz/sources/toonz/xsheetviewer.cpp +++ b/toonz/sources/toonz/xsheetviewer.cpp @@ -203,6 +203,12 @@ void XsheetViewer::getButton(const int &btype, QColor &bgColor, iconImage = (isTimeline) ? getTimelineConfigButtonImage() : getXsheetConfigButtonImage(); break; + case UNIFIED_TRANSP_XSHBUTTON: + bgColor = (isTimeline) ? getTimelinePreviewButtonBgOnColor() + : getXsheetPreviewButtonBgOnColor(); + iconImage = (isTimeline) ? getTimelineUnifiedButtonTranspImage() + : getXsheetUnifiedButtonTranspImage(); + break; default: bgColor = grey210; static QImage iconignored; diff --git a/toonz/sources/toonz/xsheetviewer.h b/toonz/sources/toonz/xsheetviewer.h index 8368433..25e9fc0 100644 --- a/toonz/sources/toonz/xsheetviewer.h +++ b/toonz/sources/toonz/xsheetviewer.h @@ -40,7 +40,8 @@ enum TXshButtonType { CAMSTAND_TRANSP_XSHBUTTON, LOCK_ON_XSHBUTTON, LOCK_OFF_XSHBUTTON, - CONFIG_XSHBUTTON + CONFIG_XSHBUTTON, + UNIFIED_TRANSP_XSHBUTTON }; namespace XsheetGUI { @@ -435,6 +436,7 @@ class XsheetViewer final : public QFrame, public SaveLoadQSettings { QImage m_xsheetPreviewButtonOnImage; QColor m_xsheetPreviewButtonBgOffColor; QImage m_xsheetPreviewButtonOffImage; + QImage m_xsheetUnifiedButtonTranspImage; Q_PROPERTY( QColor XsheetPreviewButtonBgOnColor READ getXsheetPreviewButtonBgOnColor WRITE setXsheetPreviewButtonBgOnColor) @@ -447,6 +449,9 @@ class XsheetViewer final : public QFrame, public SaveLoadQSettings { Q_PROPERTY( QImage XsheetPreviewButtonOffImage READ getXsheetPreviewButtonOffImage WRITE setXsheetPreviewButtonOffImage) + Q_PROPERTY(QImage XsheetUnifiedButtonTranspImage READ + getXsheetUnifiedButtonTranspImage WRITE + setXsheetUnifiedButtonTranspImage) // Xsheet Camstand Button QColor m_xsheetCamstandButtonBgOnColor; QImage m_xsheetCamstandButtonOnImage; @@ -494,6 +499,7 @@ class XsheetViewer final : public QFrame, public SaveLoadQSettings { QImage m_timelinePreviewButtonOnImage; QColor m_timelinePreviewButtonBgOffColor; QImage m_timelinePreviewButtonOffImage; + QImage m_timelineUnifiedButtonTranspImage; Q_PROPERTY(QColor TimelinePreviewButtonBgOnColor READ getTimelinePreviewButtonBgOnColor WRITE setTimelinePreviewButtonBgOnColor) @@ -506,6 +512,9 @@ class XsheetViewer final : public QFrame, public SaveLoadQSettings { Q_PROPERTY( QImage TimelinePreviewButtonOffImage READ getTimelinePreviewButtonOffImage WRITE setTimelinePreviewButtonOffImage) + Q_PROPERTY(QImage TimelineUnifiedButtonTranspImage READ + getTimelineUnifiedButtonTranspImage WRITE + setTimelineUnifiedButtonTranspImage) // Timeline Camstand Button QColor m_timelineCamstandButtonBgOnColor; QImage m_timelineCamstandButtonOnImage; @@ -1071,6 +1080,9 @@ public: void setXsheetPreviewButtonOffImage(const QImage &image) { m_xsheetPreviewButtonOffImage = image; } + void setXsheetUnifiedButtonTranspImage(const QImage &image) { + m_xsheetUnifiedButtonTranspImage = image; + } QColor getXsheetPreviewButtonBgOnColor() const { return m_xsheetPreviewButtonBgOnColor; } @@ -1083,6 +1095,9 @@ public: QImage getXsheetPreviewButtonOffImage() const { return m_xsheetPreviewButtonOffImage; } + QImage getXsheetUnifiedButtonTranspImage() const { + return m_xsheetUnifiedButtonTranspImage; + } // Xsheet Camstand Button void setXsheetCamstandButtonBgOnColor(const QColor &color) { m_xsheetCamstandButtonBgOnColor = color; @@ -1165,6 +1180,9 @@ public: void setTimelinePreviewButtonOffImage(const QImage &image) { m_timelinePreviewButtonOffImage = image; } + void setTimelineUnifiedButtonTranspImage(const QImage &image) { + m_timelineUnifiedButtonTranspImage = image; + } QColor getTimelinePreviewButtonBgOnColor() const { return m_timelinePreviewButtonBgOnColor; } @@ -1177,6 +1195,9 @@ public: QImage getTimelinePreviewButtonOffImage() const { return m_timelinePreviewButtonOffImage; } + QImage getTimelineUnifiedButtonTranspImage() const { + return m_timelineUnifiedButtonTranspImage; + } // Timeline Camstand Button void setTimelineCamstandButtonBgOnColor(const QColor &color) { m_timelineCamstandButtonBgOnColor = color; diff --git a/toonz/sources/toonzlib/orientation.cpp b/toonz/sources/toonzlib/orientation.cpp index c7dea3c..4b9a203 100644 --- a/toonz/sources/toonzlib/orientation.cpp +++ b/toonz/sources/toonzlib/orientation.cpp @@ -438,9 +438,9 @@ TopToBottomOrientation::TopToBottomOrientation() { static int HDRROW3; static int HDRROW4; static int HDRROW5; - QRect layername, eyeArea, previewArea, lockArea, cameraLockArea, configArea, - cameraConfigArea, thumbnailArea, thumbnail, cameraIconArea, pegbarname, - volumeArea; + QRect layername, eyeArea, previewArea, unifiedViewArea, lockArea, + cameraLockArea, configArea, cameraConfigArea, thumbnailArea, thumbnail, + cameraIconArea, pegbarname, volumeArea; QPoint soundTopLeft; if (layout == QString("Minimum")) { @@ -473,6 +473,12 @@ TopToBottomOrientation::TopToBottomOrientation() { addRect(PredefinedRect::PREVIEW_LAYER, iconRect(previewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1)); + unifiedViewArea = QRect( + INDENT, HDRROW2, eyeArea.width() + previewArea.width(), HDRROW_HEIGHT); + addRect(PredefinedRect::UNIFIEDVIEW_LAYER_AREA, unifiedViewArea); + addRect(PredefinedRect::UNIFIEDVIEW_LAYER, + iconRect(unifiedViewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1)); + addRect(PredefinedRect::LOCK_AREA, QRect(0, 0, -1, -1)); addRect(PredefinedRect::LOCK, QRect(0, 0, -1, -1)); addRect(PredefinedRect::CAMERA_LOCK_AREA, QRect(0, 0, -1, -1)); @@ -559,6 +565,12 @@ TopToBottomOrientation::TopToBottomOrientation() { addRect(PredefinedRect::PREVIEW_LAYER, iconRect(previewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1)); + unifiedViewArea = QRect( + INDENT, HDRROW2, eyeArea.width() + previewArea.width(), HDRROW_HEIGHT); + addRect(PredefinedRect::UNIFIEDVIEW_LAYER_AREA, unifiedViewArea); + addRect(PredefinedRect::UNIFIEDVIEW_LAYER, + iconRect(unifiedViewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1)); + lockArea = QRect(INDENT + eyeArea.width() + previewArea.width(), HDRROW2, ICON_WIDTH, HDRROW_HEIGHT); addRect(PredefinedRect::LOCK_AREA, lockArea); @@ -670,6 +682,12 @@ TopToBottomOrientation::TopToBottomOrientation() { addRect(PredefinedRect::PREVIEW_LAYER, iconRect(previewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1)); + unifiedViewArea = + QRect(INDENT, HDRROW2, CELL_WIDTH - ICON_WIDTH, HDRROW_HEIGHT * 2); + addRect(PredefinedRect::UNIFIEDVIEW_LAYER_AREA, unifiedViewArea); + addRect(PredefinedRect::UNIFIEDVIEW_LAYER, + iconRect(unifiedViewArea, ICON_WIDTH, ICON_HEIGHT - 1, 1)); + lockArea = QRect(INDENT + eyeArea.width(), HDRROW2, ICON_WIDTH, HDRROW_HEIGHT); addRect(PredefinedRect::LOCK_AREA, lockArea); @@ -781,6 +799,13 @@ TopToBottomOrientation::TopToBottomOrientation() { addRect(PredefinedRect::PREVIEW_LAYER, previewArea.adjusted(previewArea.width() - ICON_WIDTH, 0, 0, 0)); + unifiedViewArea = + QRect(INDENT, HDRROW2, CELL_WIDTH - INDENT - 2, HDRROW_HEIGHT - 1); + addRect(PredefinedRect::UNIFIEDVIEW_LAYER_AREA, unifiedViewArea); + addRect(PredefinedRect::UNIFIEDVIEW_LAYER, + unifiedViewArea.adjusted(unifiedViewArea.width() - ICON_WIDTH, 0, 0, + 0)); + lockArea = QRect(INDENT, HDRROW2, ICON_WIDTH - 1, HDRROW_HEIGHT - 1); addRect(PredefinedRect::LOCK_AREA, lockArea); addRect(PredefinedRect::LOCK, lockArea); @@ -1216,7 +1241,6 @@ LeftToRightOrientation::LeftToRightOrientation() { (FRAME_HEADER_HEIGHT - NAV_TAG_HEIGHT) / 2, NAV_TAG_WIDTH, NAV_TAG_HEIGHT)); - // Column viewer addRect(PredefinedRect::LAYER_HEADER, QRect(1, 0, LAYER_HEADER_WIDTH - 2, CELL_HEIGHT)); @@ -1238,6 +1262,10 @@ LeftToRightOrientation::LeftToRightOrientation() { eyeArea.translated(ICON_OFFSET, 0)); addRect(PredefinedRect::PREVIEW_LAYER, eye.translated(ICON_OFFSET, 0).adjusted(1, 1, -1, -1)); + + addRect(PredefinedRect::UNIFIEDVIEW_LAYER_AREA, eyeArea); + addRect(PredefinedRect::UNIFIEDVIEW_LAYER, eye.adjusted(1, 1, -1, -1)); + addRect(PredefinedRect::LOCK_AREA, eyeArea.translated(2 * ICON_OFFSET, 0)); addRect(PredefinedRect::LOCK, eye.translated(2 * ICON_OFFSET, 0).adjusted(1, 1, -1, -1)); diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 288a26c..cef5eae 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -586,6 +586,8 @@ void Preferences::definePreferenceItems() { define(showXSheetToolbar, "showXSheetToolbar", QMetaType::Bool, true); define(expandFunctionHeader, "expandFunctionHeader", QMetaType::Bool, false); define(showColumnNumbers, "showColumnNumbers", QMetaType::Bool, false); + define(unifyColumnVisibilityToggles, "unifyColumnVisibilityToggles", + QMetaType::Bool, false); define(parentColorsInXsheetColumn, "parentColorsInXsheetColumn", QMetaType::Bool, false); define(highlightLineEverySecond, "highlightLineEverySecond", QMetaType::Bool, diff --git a/toonz/sources/toonzqt/fxschematicnode.cpp b/toonz/sources/toonzqt/fxschematicnode.cpp index e3b9707..f757fc2 100644 --- a/toonz/sources/toonzqt/fxschematicnode.cpp +++ b/toonz/sources/toonzqt/fxschematicnode.cpp @@ -2821,8 +2821,11 @@ FxSchematicZeraryNode::FxSchematicZeraryNode(FxSchematicScene *scene, connect(m_nameItem, SIGNAL(focusOut()), this, SLOT(onNameChanged())); connect(m_renderToggle, SIGNAL(toggled(bool)), this, SLOT(onRenderToggleClicked(bool))); - connect(m_cameraStandToggle, SIGNAL(stateChanged(int)), this, - SLOT(onCameraStandToggleClicked(int))); + if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + m_cameraStandToggle->hide(); + else + connect(m_cameraStandToggle, SIGNAL(stateChanged(int)), this, + SLOT(onCameraStandToggleClicked(int))); if (zeraryFx) { int i, inputPorts = zeraryFx->getInputPortCount(); @@ -3085,8 +3088,11 @@ FxSchematicColumnNode::FxSchematicColumnNode(FxSchematicScene *scene, connect(m_nameItem, SIGNAL(focusOut()), this, SLOT(onNameChanged())); ret = ret && connect(m_renderToggle, SIGNAL(toggled(bool)), this, SLOT(onRenderToggleClicked(bool))); - ret = ret && connect(m_cameraStandToggle, SIGNAL(stateChanged(int)), this, - SLOT(onCameraStandToggleClicked(int))); + if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + m_cameraStandToggle->hide(); + else + ret = ret && connect(m_cameraStandToggle, SIGNAL(stateChanged(int)), this, + SLOT(onCameraStandToggleClicked(int))); assert(ret); @@ -3122,6 +3128,8 @@ void FxSchematicColumnNode::onRenderToggleClicked(bool toggled) { TXshColumn *column = fxScene->getXsheet()->getColumn(m_columnIndex); if (column) { column->setPreviewVisible(toggled); + if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + column->setCamstandVisible(toggled); emit sceneChanged(); emit xsheetChanged(); } diff --git a/toonz/sources/toonzqt/stageschematicnode.cpp b/toonz/sources/toonzqt/stageschematicnode.cpp index 92336be..3eb1a5a 100644 --- a/toonz/sources/toonzqt/stageschematicnode.cpp +++ b/toonz/sources/toonzqt/stageschematicnode.cpp @@ -1753,7 +1753,8 @@ StageSchematicColumnNode::StageSchematicColumnNode(StageSchematicScene *scene, if (levelType == PLT_XSHLEVEL) { m_resizeItem->hide(); m_cameraStandToggle->hide(); - } + } else if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + m_cameraStandToggle->hide(); } //-------------------------------------------------------- @@ -1961,6 +1962,8 @@ void StageSchematicColumnNode::onRenderToggleClicked(bool isActive) { stageScene->getXsheet()->getColumn(m_stageObject->getId().getIndex()); if (column) { column->setPreviewVisible(isActive); + if (Preferences::instance()->isUnifyColumnVisibilityTogglesEnabled()) + column->setCamstandVisible(isActive); emit sceneChanged(); emit xsheetChanged(); }