Skip to content

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

C

Enable to type Frame ID directly with number on the keyboard

Abel You2115b1519661
diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp
index d17c27bab..351a8949d 100644
--- a/toonz/sources/toonz/xshcellviewer.cpp
+++ b/toonz/sources/toonz/xshcellviewer.cpp
@@ -3766,6 +3766,20 @@ void CellArea::onControlPressed(bool pressed) {
const bool CellArea::isControlPressed() { return isCtrlPressed; }
//-----------------------------------------------------------------------------
+
+void CellArea::onNumberPressed(int number) {
+ TCellSelection *cellSelection = m_viewer->getCellSelection();
+ if (cellSelection->isEmpty()) return;
+ int r0, c0, r1, c1;
+ cellSelection->getSelectedCells(r0, c0, r1, c1);
+ TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
+ TXshColumnP column = xsh->getColumn(r0);
+ m_renameCell->showInRowCol(r0, c0);
+ m_renameCell->setText(QString::number(number));
+}
+
+//-----------------------------------------------------------------------------
+
void CellArea::createCellMenu(QMenu &menu, bool isCellSelected, TXshCell cell,
int row, int col) {
CommandManager *cmdManager = CommandManager::instance();
diff --git a/toonz/sources/toonz/xshcellviewer.h b/toonz/sources/toonz/xshcellviewer.h
index 7c10c32ea..0cf54af42 100644
--- a/toonz/sources/toonz/xshcellviewer.h
+++ b/toonz/sources/toonz/xshcellviewer.h
@@ -146,6 +146,9 @@ public:
void onControlPressed(bool pressed);
const bool isControlPressed();
+ // edit current cell's ID
+ void onNumberPressed(int number);
+
// void keyUpDownPressed(int newRow);
void showRenameField(int row, int col, bool multiColumnSelected = false) {
diff --git a/toonz/sources/toonz/xsheetviewer.cpp b/toonz/sources/toonz/xsheetviewer.cpp
index 9b3bcad49..996ac151a 100644
--- a/toonz/sources/toonz/xsheetviewer.cpp
+++ b/toonz/sources/toonz/xsheetviewer.cpp
@@ -1397,9 +1397,15 @@ void XsheetViewer::keyPressEvent(QKeyEvent *event) {
locals.scrollHorizTo(x, visibleRect);
}
break;
+ default:
+ if ((key >= Qt::Key_1 && key <= Qt::Key_9)) {
+ int number = key - Qt::Key_1 + 1;
+ m_cellArea->onNumberPressed(number);
+ }
+ break;
+ }
+ break;
}
- break;
- }
}
}