OpenToonz - An open-source full-featured 2D animation creation software
C
Current time timeline indicator (#1522)
manongjohn1be2644c8d16
diff --git a/toonz/sources/include/orientation.h b/toonz/sources/include/orientation.hindex 55d11859a..2b51735da 100644--- a/toonz/sources/include/orientation.h+++ b/toonz/sources/include/orientation.h@@ -134,7 +134,8 @@ enum class PredefinedPath {BEGIN_PLAY_RANGE, //! play range markersEND_PLAY_RANGE,VOLUME_SLIDER_TRACK, //! slider track- VOLUME_SLIDER_HEAD //! slider head+ VOLUME_SLIDER_HEAD, //! slider head+ TIME_INDICATOR_HEAD //! current time indicator head};enum class PredefinedPoint {KEY_HIDDEN, //! move extender handle that much if key icons are disableddiff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.hindex d0b2f76b9..2dcd002c3 100644--- a/toonz/sources/include/toonz/preferences.h+++ b/toonz/sources/include/toonz/preferences.h@@ -460,6 +460,11 @@ public:paint = m_transpCheckPaint;}+ void enableCurrentTimelineIndicator(bool on);+ bool isCurrentTimelineIndicatorEnabled() const {+ return m_currentTimelineEnabled;+ }+// Version Control tabvoid enableSVN(bool on);@@ -614,6 +619,9 @@ private:QString m_xsheetLayoutPreference,m_loadedXsheetLayout; // Classic, Classic-revised, compact++ bool m_currentTimelineEnabled;+private:Preferences();~Preferences();diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cppindex ebb1dc6b2..94665ef44 100644--- a/toonz/sources/toonz/mainwindow.cpp+++ b/toonz/sources/toonz/mainwindow.cpp@@ -2021,6 +2021,9 @@ void MainWindow::defineActions() {createToggle(MI_ZeroThick, tr("Zero Thick Lines"), "Shift+/", false,RightClickMenuCommandType);+ createRightClickMenuAction(MI_ToggleCurrentTimeIndicator,+ tr("Toggle Current Time Indicator"), "");+// createRightClickMenuAction(MI_LoadSubSceneFile, tr("Load As// Sub-xsheet"), "");// createRightClickMenuAction(MI_LoadResourceFile, tr("Load"),diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.hindex 45c6edca7..5cdc5abad 100644--- a/toonz/sources/toonz/menubarcommandids.h+++ b/toonz/sources/toonz/menubarcommandids.h@@ -288,6 +288,7 @@#define MI_ToggleColumnLocks "MI_ToggleColumnLocks"#define MI_ToggleXSheetToolbar "MI_ToggleXSheetToolbar"#define MI_FoldColumns "MI_FoldColumns"+#define MI_ToggleCurrentTimeIndicator "MI_ToggleCurrentTimeIndicator"#define MI_LoadIntoCurrentPalette "MI_LoadIntoCurrentPalette"#define MI_AdjustCurrentLevelToPalette "MI_AdjustCurrentLevelToPalette"diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cppindex 594a59789..6c032020a 100644--- a/toonz/sources/toonz/preferencespopup.cpp+++ b/toonz/sources/toonz/preferencespopup.cpp@@ -1092,6 +1092,12 @@ void PreferencesPopup::onWatchFileSystemClicked(int on) {"WatchFileSystem");}+//-----------------------------------------------------------------------------++void PreferencesPopup::onShowCurrentTimelineChanged(int index) {+ m_pref->enableCurrentTimelineIndicator(index == Qt::Checked);+}+//**********************************************************************************// PrefencesPopup's constructor//**********************************************************************************@@ -1321,6 +1327,8 @@ PreferencesPopup::PreferencesPopup()xsheetLayoutOptions->addItems(xsheetLayouts);xsheetLayoutOptions->setCurrentIndex(xsheetLayoutOptions->findText(m_pref->getXsheetLayoutPreference()));+ CheckBox *showCurrentTimelineCB = new CheckBox(+ tr("Show Current Time Indicator (Timeline Mode only)"), this);QLabel *note_xsheet =new QLabel(tr("* Changes will take effect the next time you run Toonz"));@@ -1641,6 +1649,8 @@ PreferencesPopup::PreferencesPopup()m_showXSheetToolbar->setChecked(m_pref->isShowXSheetToolbarEnabled());m_expandFunctionHeader->setChecked(m_pref->isExpandFunctionHeaderEnabled());showColumnNumbersCB->setChecked(m_pref->isShowColumnNumbersEnabled());+ showCurrentTimelineCB->setChecked(+ m_pref->isCurrentTimelineIndicatorEnabled());//--- Animation ------------------------------QStringList list;@@ -2154,11 +2164,12 @@ PreferencesPopup::PreferencesPopup()xsheetFrameLay->addWidget(m_showXSheetToolbar, 9, 0, 3, 3);xsheetFrameLay->addWidget(showColumnNumbersCB, 12, 0, 1, 2);+ xsheetFrameLay->addWidget(showCurrentTimelineCB, 13, 0, 1, 2);}xsheetFrameLay->setColumnStretch(0, 0);xsheetFrameLay->setColumnStretch(1, 0);xsheetFrameLay->setColumnStretch(2, 1);- xsheetFrameLay->setRowStretch(13, 1);+ xsheetFrameLay->setRowStretch(14, 1);xsheetBoxFrameLay->addLayout(xsheetFrameLay);@@ -2585,6 +2596,9 @@ PreferencesPopup::PreferencesPopup()SLOT(onOnionPaperThicknessChanged()));ret = ret && connect(m_guidedDrawingStyle, SIGNAL(currentIndexChanged(int)),SLOT(onGuidedDrawingStyleChanged(int)));+ ret = ret && connect(showCurrentTimelineCB, SIGNAL(stateChanged(int)), this,+ SLOT(onShowCurrentTimelineChanged(int)));+//--- Transparency Check ----------------------ret = ret && connect(m_transpCheckBgColor,SIGNAL(colorChanged(const TPixel32 &, bool)),diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.hindex 31182eb42..472707a80 100644--- a/toonz/sources/toonz/preferencespopup.h+++ b/toonz/sources/toonz/preferencespopup.h@@ -191,6 +191,7 @@ private slots:void onInterfaceFontChanged(int index);void onInterfaceFontWeightChanged(int index);void onXsheetLayoutChanged(const QString &text);+ void onShowCurrentTimelineChanged(int);};//**********************************************************************************diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cppindex 18091acb5..313536cea 100644--- a/toonz/sources/toonz/xshcellviewer.cpp+++ b/toonz/sources/toonz/xshcellviewer.cpp@@ -951,6 +951,21 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated) {if (!columnFan->isActive(col)) { // folded columndrawFoldedColumns(p, layerAxis, frameSide);++ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled()) {+ QPoint xy = m_viewer->positionToXY(CellPosition(row, col));+ int x = xy.x();+ int y = xy.y();+ if (row == 0) {+ if (m_viewer->orientation()->isVerticalTimeline())+ xy.setY(xy.y() + 1);+ else+ xy.setX(xy.x() + 1);+ }+ drawCurrentTimeIndicator(p, xy);+ }continue;}@@ -997,7 +1012,24 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated) {m_viewer->orientation()->horizontalLine(frameAxis, layerAxisRange);p.drawLine(horizontalLine);- if (!isColumn) continue;+ if (!isColumn) {+ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled()) {+ QPoint xy = m_viewer->positionToXY(CellPosition(row, col));+ int x = xy.x();+ int y = xy.y();+ if (row == 0) {+ if (m_viewer->orientation()->isVerticalTimeline())+ xy.setY(xy.y() + 1);+ else+ xy.setX(xy.x() + 1);+ }+ drawCurrentTimeIndicator(p, xy);+ }+ continue;+ }// Cells appearance depending on the type of columnif (isSoundColumn)drawSoundCell(p, row, col, isReference);@@ -1150,8 +1182,14 @@ void CellArea::drawSoundCell(QPainter &p, int row, int col, bool isReference) {int startFrame = soundColumn->getFirstRow();TXshCell cell = soundColumn->getCell(row);if (soundColumn->isCellEmpty(row) || cell.isEmpty() || row > maxNumFrame ||- row < startFrame)+ row < startFrame) {+ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);return;+ }TXshSoundLevelP soundLevel = cell.getSoundLevel();@@ -1179,6 +1217,12 @@ void CellArea::drawSoundCell(QPainter &p, int row, int col, bool isReference) {// cells backgroundp.fillRect(rect, QBrush(cellColor));+ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);+drawDragHandle(p, xy, sideColor);drawEndOfDragHandle(p, isLastRow, xy, cellColor);drawLockedDottedLine(p, soundColumn->isLocked(), xy, cellColor);@@ -1305,6 +1349,18 @@ void CellArea::drawLockedDottedLine(QPainter &p, bool isLocked,p.drawLine(dottedLine);}+void CellArea::drawCurrentTimeIndicator(QPainter &p, const QPoint &xy) {+ QRect cell =+ m_viewer->orientation()->rect(PredefinedRect::CELL).translated(xy);++ int cellMid = cell.left() + (cell.width() / 2);+ int cellTop = cell.top();+ int cellBottom = cell.bottom();++ p.setPen(Qt::red);+ p.drawLine(cellMid, cellTop, cellMid, cellBottom);+}+//-----------------------------------------------------------------------------void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {@@ -1320,10 +1376,6 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {columnSelection->isColumnSelected(col);if (row > 0) prevCell = xsh->getCell(row - 1, col); // cell in previous frame- // nothing to draw- if (cell.isEmpty() && prevCell.isEmpty()) return;- TXshCell nextCell;- nextCell = xsh->getCell(row + 1, col); // cell in next frameQPoint xy = m_viewer->positionToXY(CellPosition(row, col));int x = xy.x();@@ -1334,6 +1386,19 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {elsexy.setX(xy.x() + 1);}++ // nothing to draw+ if (cell.isEmpty() && prevCell.isEmpty()) {+ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);+ return;+ }+ TXshCell nextCell;+ nextCell = xsh->getCell(row + 1, col); // cell in next frame+QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y));QRect rect = cellRect.adjusted(1, 1, 0, 0);if (cell.isEmpty()) { // it means previous is not empty@@ -1343,6 +1408,13 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {p.setPen(levelEndColor);p.drawLine(rect.topLeft(), rect.bottomRight());p.drawLine(rect.topRight(), rect.bottomLeft());++ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);+return;}@@ -1370,6 +1442,12 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {// paint cellp.fillRect(rect, QBrush(cellColor));+ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);+drawDragHandle(p, xy, sideColor);if (yetToCleanupCell) // ORIENTATION: what's this?@@ -1507,10 +1585,6 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {if (row > 0) prevCell = xsh->getCell(row - 1, col); // cell in previous frame// nothing to draw- if (cell.isEmpty() && prevCell.isEmpty()) return;- TXshCell nextCell;- nextCell = xsh->getCell(row + 1, col);-QPoint xy = m_viewer->positionToXY(CellPosition(row, col));int x = xy.x();int y = xy.y();@@ -1520,6 +1594,19 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {elsexy.setX(xy.x() + 1);}++ if (cell.isEmpty() && prevCell.isEmpty()) {+ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);++ return;+ }+ TXshCell nextCell;+ nextCell = xsh->getCell(row + 1, col);+QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y));QRect rect = cellRect.adjusted(1, 1, 0, 0);if (cell.isEmpty()) { // diagonal cross meaning end of level@@ -1528,6 +1615,13 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {p.setPen(levelEndColor);p.drawLine(rect.topLeft(), rect.bottomRight());p.drawLine(rect.topRight(), rect.bottomLeft());++ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);+return;}@@ -1539,6 +1633,12 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {// paint cellp.fillRect(rect, QBrush(cellColor));+ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);+drawDragHandle(p, xy, sideColor);bool isLastRow = nextCell.isEmpty() ||@@ -1619,7 +1719,6 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,if (row > 0) prevCell = xsh->getCell(row - 1, col);TXshCell nextCell = xsh->getCell(row + 1, col);- if (cell.isEmpty() && prevCell.isEmpty()) return;QPoint xy = m_viewer->positionToXY(CellPosition(row, col));int x = xy.x();int y = xy.y();@@ -1629,6 +1728,15 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,elsexy.setX(xy.x() + 1);}+ if (cell.isEmpty() && prevCell.isEmpty()) {+ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);++ return;+ }QRect cellRect = o->rect(PredefinedRect::CELL).translated(QPoint(x, y));QRect rect = cellRect.adjusted(1, 1, 0, 0);if (cell.isEmpty()) { // this means the former is not empty@@ -1637,6 +1745,13 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,p.setPen(levelEndColor);p.drawLine(rect.topLeft(), rect.bottomRight());p.drawLine(rect.topRight(), rect.bottomLeft());++ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);+return;}@@ -1653,6 +1768,12 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,p.fillRect(rect, QBrush(cellColor));+ if (TApp::instance()->getCurrentFrame()->isEditingScene() &&+ !m_viewer->orientation()->isVerticalTimeline() &&+ row == m_viewer->getCurrentRow() &&+ Preferences::instance()->isCurrentTimelineIndicatorEnabled())+ drawCurrentTimeIndicator(p, xy);+drawDragHandle(p, xy, sideColor);bool isLastRow = nextCell.isEmpty() ||cell.m_level.getPointer() != nextCell.m_level.getPointer();diff --git a/toonz/sources/toonz/xshcellviewer.h b/toonz/sources/toonz/xshcellviewer.hindex ed26fc5ed..417151500 100644--- a/toonz/sources/toonz/xshcellviewer.h+++ b/toonz/sources/toonz/xshcellviewer.h@@ -94,6 +94,8 @@ class CellArea final : public QWidget {void drawNotes(QPainter &p, const QRect toBeUpdated);+ void drawCurrentTimeIndicator(QPainter &p, const QPoint &xy);+// Restistusce truebool getEaseHandles(int r0, int r1, double e0, double e1, int &rh0, int &rh1);diff --git a/toonz/sources/toonz/xsheetcmd.cpp b/toonz/sources/toonz/xsheetcmd.cppindex 491f258aa..3f912efd1 100644--- a/toonz/sources/toonz/xsheetcmd.cpp+++ b/toonz/sources/toonz/xsheetcmd.cpp@@ -40,6 +40,7 @@#include "toonz/fxcommand.h"#include "toonz/tfxhandle.h"#include "toonz/scenefx.h"+#include "toonz/preferences.h"// TnzQt includes#include "toonzqt/tselectionhandle.h"@@ -213,6 +214,20 @@ static void insertSceneFrame(int frame) {//=============================================================================+class ToggleCurrentTimeIndicatorCommand final : public MenuItemHandler {+public:+ ToggleCurrentTimeIndicatorCommand()+ : MenuItemHandler(MI_ToggleCurrentTimeIndicator) {}+ void execute() override {+ bool currentTimeIndEnabled =+ Preferences::instance()->isCurrentTimelineIndicatorEnabled();+ Preferences::instance()->enableCurrentTimelineIndicator(+ !currentTimeIndEnabled);+ }+} toggleCurrentTimeIndicatorComman;++//=============================================================================+class InsertSceneFrameCommand final : public MenuItemHandler {public:InsertSceneFrameCommand() : MenuItemHandler(MI_InsertSceneFrame) {}diff --git a/toonz/sources/toonz/xshrowviewer.cpp b/toonz/sources/toonz/xshrowviewer.cppindex 4bf724bb9..14ac76e3f 100644--- a/toonz/sources/toonz/xshrowviewer.cpp+++ b/toonz/sources/toonz/xshrowviewer.cpp@@ -326,11 +326,11 @@ void RowArea::drawOnionSkinSelection(QPainter &p) {QLine verticalLine = m_viewer->orientation()->verticalLine(layerAxis, NumberRange(fromFrameAxis, toFrameAxis));if (m_viewer->orientation()->isVerticalTimeline())- p.drawLine(verticalLine.x1() + 1, verticalLine.y1() + 4,- verticalLine.x2() + 1, verticalLine.y2() - 10);+ p.drawLine(verticalLine.x1(), verticalLine.y1() + 5, verticalLine.x2(),+ verticalLine.y2() - 9);else- p.drawLine(verticalLine.x1() + 4, verticalLine.y1() + 1,- verticalLine.x2() - 10, verticalLine.y2() + 1);+ p.drawLine(verticalLine.x1() + 5, verticalLine.y1(),+ verticalLine.x2() - 10, verticalLine.y2());}if (maxMos > 0) // forward frames{@@ -342,13 +342,12 @@ void RowArea::drawOnionSkinSelection(QPainter &p) {QLine verticalLine = m_viewer->orientation()->verticalLine(layerAxis, NumberRange(fromFrameAxis, toFrameAxis));if (m_viewer->orientation()->isVerticalTimeline())- p.drawLine(verticalLine.x1() + 1, verticalLine.y1() + 10,- verticalLine.x2() + 1, verticalLine.y2() - 4);+ p.drawLine(verticalLine.x1(), verticalLine.y1() + 10, verticalLine.x2(),+ verticalLine.y2() - 5);else- p.drawLine(verticalLine.x1() + 10, verticalLine.y1() + 1,- verticalLine.x2() - 4, verticalLine.y2() + 1);+ p.drawLine(verticalLine.x1() + 10, verticalLine.y1(),+ verticalLine.x2() - 5, verticalLine.y2());}-// Draw onion skin main handleQPoint handleTopLeft = m_viewer->positionToXY(CellPosition(currentRow, 0));QRect handleRect = onionRect.translated(handleTopLeft);@@ -413,6 +412,45 @@ void RowArea::drawOnionSkinSelection(QPainter &p) {//-----------------------------------------------------------------------------+void RowArea::drawCurrentTimeIndicator(QPainter &p) {+ int currentRow = m_viewer->getCurrentRow();++ QPoint topLeft = m_viewer->positionToXY(CellPosition(currentRow, 0));+ QRect header = m_viewer->orientation()+ ->rect(PredefinedRect::FRAME_HEADER)+ .translated(topLeft);++ int frameMid = header.left() + (header.width() / 2);+ int frameTop = header.top() + 22;++ QPainterPath markerHead = m_viewer->orientation()+ ->path(PredefinedPath::TIME_INDICATOR_HEAD)+ .translated(QPoint(frameMid, frameTop));++ p.setBrush(QColor(0, 162, 232));+ p.setPen(Qt::red);+ p.drawPath(markerHead);+ p.setBrush(Qt::NoBrush);+}++void RowArea::drawCurrentTimeLine(QPainter &p) {+ int currentRow = m_viewer->getCurrentRow();++ QPoint topLeft = m_viewer->positionToXY(CellPosition(currentRow, 0));+ QRect header = m_viewer->orientation()+ ->rect(PredefinedRect::FRAME_HEADER)+ .translated(topLeft);++ int frameMid = header.left() + (header.width() / 2);+ int frameTop = header.top();+ int frameBottom = header.bottom();++ p.setPen(Qt::red);+ p.drawLine(frameMid, frameTop + 23, frameMid, frameBottom);+}++//-----------------------------------------------------------------------------+namespace {TStageObjectId getAncestor(TXsheet *xsh, TStageObjectId id) {@@ -511,11 +549,19 @@ void RowArea::paintEvent(QPaintEvent *event) {// current framedrawCurrentRowGadget(p, r0, r1);- drawRows(p, r0, r1);+ if (TApp::instance()->getCurrentFrame()->isEditingScene()) {+ if (Preferences::instance()->isOnionSkinEnabled())+ drawOnionSkinSelection(p);+ else if (Preferences::instance()->isCurrentTimelineIndicatorEnabled() &&+ !m_viewer->orientation()->isVerticalTimeline())+ drawCurrentTimeIndicator(p);- if (TApp::instance()->getCurrentFrame()->isEditingScene() &&- Preferences::instance()->isOnionSkinEnabled())- drawOnionSkinSelection(p);+ if (Preferences::instance()->isCurrentTimelineIndicatorEnabled() &&+ !m_viewer->orientation()->isVerticalTimeline())+ drawCurrentTimeLine(p);+ }++ drawRows(p, r0, r1);if (TApp::instance()->getCurrentTool()->getTool()->getName() == T_Skeleton)drawPinnedCenterKeys(p, r0, r1);@@ -772,6 +818,12 @@ void RowArea::contextMenuEvent(QContextMenuEvent *event) {}CommandManager *cmdManager = CommandManager::instance();++ if (!m_viewer->orientation()->isVerticalTimeline()) {+ menu->addAction(cmdManager->getAction(MI_ToggleCurrentTimeIndicator));+ menu->addSeparator();+ }+menu->addAction(cmdManager->getAction(MI_InsertSceneFrame));menu->addAction(cmdManager->getAction(MI_RemoveSceneFrame));menu->addAction(cmdManager->getAction(MI_InsertGlobalKeyframe));diff --git a/toonz/sources/toonz/xshrowviewer.h b/toonz/sources/toonz/xshrowviewer.hindex 404c64d18..507d4085b 100644--- a/toonz/sources/toonz/xshrowviewer.h+++ b/toonz/sources/toonz/xshrowviewer.h@@ -48,6 +48,8 @@ class RowArea final : public QWidget {void drawCurrentRowGadget(QPainter &p, int r0, int r1);void drawOnionSkinSelection(QPainter &p);void drawPinnedCenterKeys(QPainter &p, int r0, int r1);+ void drawCurrentTimeIndicator(QPainter &p);+ void drawCurrentTimeLine(QPainter &p);DragTool *getDragTool() const;void setDragTool(DragTool *dragTool);diff --git a/toonz/sources/toonzlib/orientation.cpp b/toonz/sources/toonzlib/orientation.cppindex 9a15bf1af..4db5531b5 100644--- a/toonz/sources/toonzlib/orientation.cpp+++ b/toonz/sources/toonzlib/orientation.cpp@@ -318,14 +318,16 @@ TopToBottomOrientation::TopToBottomOrientation() {QRect(PLAY_RANGE_X, 0, PLAY_MARKER_SIZE, CELL_HEIGHT));addRect(PredefinedRect::ONION,QRect(ONION_X + (3 * ONION_DOT_SIZE - ONION_SIZE) / 2, ONION_Y,- ONION_SIZE, ONION_SIZE));+ ONION_SIZE, ONION_SIZE)+ .adjusted(2, 1, 2, 1));int adjustOnion = (ONION_SIZE - ONION_DOT_SIZE) / 2;addRect(PredefinedRect::ONION_DOT,QRect(ONION_X + ONION_DOT_SIZE, ONION_Y + adjustOnion, ONION_DOT_SIZE,- ONION_DOT_SIZE));- addRect(- PredefinedRect::ONION_DOT_FIXED,- QRect(ONION_X, ONION_Y + adjustOnion, ONION_DOT_SIZE, ONION_DOT_SIZE));+ ONION_DOT_SIZE)+ .adjusted(1, 1, 1, 1));+ addRect(PredefinedRect::ONION_DOT_FIXED,+ QRect(ONION_X, ONION_Y + adjustOnion, ONION_DOT_SIZE, ONION_DOT_SIZE)+ .adjusted(1, 1, 1, 1));addRect(PredefinedRect::ONION_AREA,QRect(ONION_X, ONION_Y, PLAY_RANGE_X, CELL_HEIGHT));addRect(PredefinedRect::ONION_FIXED_DOT_AREA,@@ -907,14 +909,16 @@ LeftToRightOrientation::LeftToRightOrientation() {QRect(0, PLAY_RANGE_Y, CELL_WIDTH, PLAY_MARKER_SIZE));addRect(PredefinedRect::ONION,QRect(ONION_X, ONION_Y + (3 * ONION_DOT_SIZE - ONION_SIZE) / 2,- ONION_SIZE, ONION_SIZE));+ ONION_SIZE, ONION_SIZE)+ .adjusted(1, 2, 1, 2));int adjustOnion = (ONION_SIZE - ONION_DOT_SIZE) / 2;addRect(PredefinedRect::ONION_DOT,QRect(ONION_X + adjustOnion, ONION_Y + ONION_DOT_SIZE, ONION_DOT_SIZE,- ONION_DOT_SIZE));- addRect(- PredefinedRect::ONION_DOT_FIXED,- QRect(ONION_X + adjustOnion, ONION_Y, ONION_DOT_SIZE, ONION_DOT_SIZE));+ ONION_DOT_SIZE)+ .adjusted(1, 1, 1, 1));+ addRect(PredefinedRect::ONION_DOT_FIXED,+ QRect(ONION_X + adjustOnion, ONION_Y, ONION_DOT_SIZE, ONION_DOT_SIZE)+ .adjusted(1, 1, 1, 1));addRect(PredefinedRect::ONION_AREA,QRect(ONION_X, ONION_Y, CELL_WIDTH, ONION_SIZE));addRect(PredefinedRect::ONION_FIXED_DOT_AREA,@@ -1076,6 +1080,14 @@ LeftToRightOrientation::LeftToRightOrientation() {head.lineTo(QPointF(0, 0));addPath(PredefinedPath::VOLUME_SLIDER_HEAD, head);+ QPainterPath timeIndicator(QPointF(0, 0));+ timeIndicator.lineTo(QPointF(-9, -5));+ timeIndicator.lineTo(QPointF(-9, -18));+ timeIndicator.lineTo(QPointF(9, -18));+ timeIndicator.lineTo(QPointF(9, -4));+ timeIndicator.lineTo(QPointF(0, 0));+ addPath(PredefinedPath::TIME_INDICATOR_HEAD, timeIndicator);+//// Points//diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cppindex 745920302..65dc0b004 100644--- a/toonz/sources/toonzlib/preferences.cpp+++ b/toonz/sources/toonzlib/preferences.cpp@@ -329,7 +329,8 @@ Preferences::Preferences(), m_watchFileSystem(true), m_shortcutCommandsWhileRenamingCellEnabled(false), m_xsheetLayoutPreference("Classic-revised")- , m_loadedXsheetLayout("Classic-revised") {+ , m_loadedXsheetLayout("Classic-revised")+ , m_currentTimelineEnabled(true) {TCamera camera;m_defLevelType = PLI_XSHLEVEL;m_defLevelWidth = camera.getSize().lx;@@ -649,6 +650,8 @@ Preferences::Preferences()m_xsheetLayoutPreference = QString("Classic");setXsheetLayoutPreference(m_xsheetLayoutPreference.toStdString());m_loadedXsheetLayout = m_xsheetLayoutPreference;++ getValue(*m_settings, "currentTimelineEnabled", m_currentTimelineEnabled);}//-----------------------------------------------------------------@@ -1556,4 +1559,11 @@ void Preferences::enableShortcutCommandsWhileRenamingCell(bool on) {m_shortcutCommandsWhileRenamingCellEnabled = on;m_settings->setValue("shortcutCommandsWhileRenamingCellEnabled",on ? "1" : "0");-}\ No newline at end of file+}++//-----------------------------------------------------------------++void Preferences::enableCurrentTimelineIndicator(bool on) {+ m_currentTimelineEnabled = on;+ m_settings->setValue("currentTimelineEnabled", on ? "1" : "0");+}