Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Timeline bug fixes and tweeks (#1669)

manongjohndff49a7e3977
diff --git a/toonz/sources/toonz/keyframemover.cpp b/toonz/sources/toonz/keyframemover.cpp
index 114aec446..12913ec8f 100644
--- a/toonz/sources/toonz/keyframemover.cpp
+++ b/toonz/sources/toonz/keyframemover.cpp
@@ -330,10 +330,18 @@ void KeyframeMoverTool::rectSelect(int row, int col) {
//-----------------------------------------------------------------------------
bool KeyframeMoverTool::canMove(const TPoint &pos) {
- TXsheet *xsh = getViewer()->getXsheet();
- if (pos.x < 0) return false;
+ const Orientation *o = getViewer()->orientation();
+ TXsheet *xsh = getViewer()->getXsheet();
+
+ TPoint usePos = pos;
+ if (!o->isVerticalTimeline()) {
+ usePos.x = pos.y;
+ usePos.y = pos.x;
+ }
+
+ if (usePos.x < 0) return false;
- int col = pos.x;
+ int col = usePos.x;
int startCol = getViewer()->xyToPosition(m_startPos).layer();
if (col != startCol) return false;
diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp
index 171078a7d..9a8a69081 100644
--- a/toonz/sources/toonz/xshcellviewer.cpp
+++ b/toonz/sources/toonz/xshcellviewer.cpp
@@ -1101,6 +1101,7 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated) {
if (TApp::instance()->getCurrentFrame()->isEditingScene() &&
!m_viewer->orientation()->isVerticalTimeline() &&
Preferences::instance()->isCurrentTimelineIndicatorEnabled()) {
+ row = m_viewer->getCurrentRow();
QPoint xy = m_viewer->positionToXY(CellPosition(row, col));
int x = xy.x();
int y = xy.y();
@@ -1110,7 +1111,7 @@ void CellArea::drawCells(QPainter &p, const QRect toBeUpdated) {
else
xy.setX(xy.x() + 1);
}
- drawCurrentTimeIndicator(p, xy);
+ drawCurrentTimeIndicator(p, xy, true);
}
continue;
}
@@ -1558,7 +1559,8 @@ void CellArea::drawLockedDottedLine(QPainter &p, bool isLocked,
p.drawLine(dottedLine);
}
-void CellArea::drawCurrentTimeIndicator(QPainter &p, const QPoint &xy) {
+void CellArea::drawCurrentTimeIndicator(QPainter &p, const QPoint &xy,
+ bool isFolded) {
int frameAdj = m_viewer->getFrameZoomAdjustment();
QRect cell =
m_viewer->orientation()->rect(PredefinedRect::CELL).translated(xy);
@@ -1568,6 +1570,12 @@ void CellArea::drawCurrentTimeIndicator(QPainter &p, const QPoint &xy) {
int cellTop = cell.top();
int cellBottom = cell.bottom();
+ // Adjust left for 1st row
+ if (xy.x() <= 1) cellMid -= 1;
+
+ if (isFolded)
+ cellBottom = cell.top() + m_viewer->orientation()->foldedCellSize() - 1;
+
p.setPen(Qt::red);
p.drawLine(cellMid, cellTop, cellMid, cellBottom);
}
diff --git a/toonz/sources/toonz/xshcellviewer.h b/toonz/sources/toonz/xshcellviewer.h
index 67c65240e..1d3e3c3ec 100644
--- a/toonz/sources/toonz/xshcellviewer.h
+++ b/toonz/sources/toonz/xshcellviewer.h
@@ -96,7 +96,8 @@ class CellArea final : public QWidget {
void drawNotes(QPainter &p, const QRect toBeUpdated);
- void drawCurrentTimeIndicator(QPainter &p, const QPoint &xy);
+ void drawCurrentTimeIndicator(QPainter &p, const QPoint &xy,
+ bool isFolded = false);
void drawFrameDot(QPainter &p, const QPoint &xy, bool isValid);
diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp
index f7b1e6757..b972452d5 100644
--- a/toonz/sources/toonz/xsheetviewer.cpp
+++ b/toonz/sources/toonz/xsheetviewer.cpp
@@ -675,9 +675,9 @@ bool XsheetViewer::refreshContentSize(int dx, int dy) {
contentSize = positionToXY(CellPosition(frameCount + 1, 0));
ColumnFan *fan = xsh->getColumnFan(m_orientation);
- contentSize.setY(contentSize.y() + (fan->isActive(0)
- ? m_orientation->cellHeight()
- : m_orientation->foldedCellSize()));
+ contentSize.setY(contentSize.y() + 1 +
+ (fan->isActive(0) ? m_orientation->cellHeight()
+ : m_orientation->foldedCellSize()));
}
QSize actualSize(contentSize.x(), contentSize.y());
@@ -726,9 +726,9 @@ void XsheetViewer::updateAreeSize() {
areaFilled = positionToXY(CellPosition(xsh->getFrameCount() + 1, 0));
ColumnFan *fan = xsh->getColumnFan(m_orientation);
- areaFilled.setY(areaFilled.y() + (fan->isActive(0)
- ? o->cellHeight()
- : o->foldedCellSize()));
+ areaFilled.setY(areaFilled.y() + 1 + (fan->isActive(0)
+ ? o->cellHeight()
+ : o->foldedCellSize()));
}
}
if (viewArea.right() < areaFilled.x()) viewArea.setRight(areaFilled.x());
@@ -757,8 +757,9 @@ int XsheetViewer::colToTimelineLayerAxis(int layer) const {
int yBottom = o->colToLayerAxis(layer, fan) +
(fan->isActive(layer) ? o->cellHeight() : o->foldedCellSize()) -
1;
- int columnCount = qMax(1, xsh->getColumnCount());
- int layerHeightActual = o->colToLayerAxis(columnCount, fan) - 1;
+ int columnCount = qMax(1, xsh->getColumnCount());
+ int layerHeightActual =
+ m_columnArea->height() - 2; // o->colToLayerAxis(columnCount, fan) - 1;
return layerHeightActual - yBottom;
}
diff --git a/toonz/sources/toonzlib/orientation.cpp b/toonz/sources/toonzlib/orientation.cpp
index 6c3ab0aeb..70bfe5c0f 100644
--- a/toonz/sources/toonzlib/orientation.cpp
+++ b/toonz/sources/toonzlib/orientation.cpp
@@ -949,10 +949,10 @@ LeftToRightOrientation::LeftToRightOrientation() {
// Column viewer
addRect(PredefinedRect::LAYER_HEADER,
- QRect(1, 0, LAYER_HEADER_WIDTH - 3, CELL_HEIGHT));
+ QRect(1, 0, LAYER_HEADER_WIDTH - 2, CELL_HEIGHT));
addRect(
PredefinedRect::FOLDED_LAYER_HEADER,
- QRect(1, 0, FOLDED_LAYER_HEADER_WIDTH - 3, FOLDED_LAYER_HEADER_HEIGHT));
+ QRect(1, 0, FOLDED_LAYER_HEADER_WIDTH - 2, FOLDED_LAYER_HEADER_HEIGHT));
QRect columnName(ICONS_WIDTH + 2, 1,
LAYER_NAME_WIDTH + LAYER_NUMBER_WIDTH - 4, CELL_HEIGHT - 1);
addRect(PredefinedRect::RENAME_COLUMN, columnName);