OpenToonz - An open-source full-featured 2D animation creation software
C
hide selected columns in function sheet
shun-iwasawabd3eeae2fdcf
diff --git a/toonz/sources/toonzqt/functionsheet.cpp b/toonz/sources/toonzqt/functionsheet.cppindex f505977c9..4ae54f982 100644--- a/toonz/sources/toonzqt/functionsheet.cpp+++ b/toonz/sources/toonzqt/functionsheet.cpp@@ -462,6 +462,18 @@ void FunctionSheetColumnHeadViewer::mousePressEvent(QMouseEvent *e) {getViewer()->selectCells(rect);}+ // Switch selection before opening the context menu+ // if the clicked column is out of the selection+ else if (e->button() == Qt::RightButton) {+ QRect selectedCell = getViewer()->getSelectedCells();+ if (selectedCell.left() > currentC || selectedCell.right() < currentC) {+ int lastKeyPos = 0;+ std::set<double> frames;+ channel->getParam()->getKeyframes(frames);+ if (!frames.empty()) lastKeyPos = (int)*frames.rbegin();+ getViewer()->selectCells(QRect(currentC, 0, 1, lastKeyPos + 1));+ }+ }}//-----------------------------------------------------------------------------@@ -497,14 +509,14 @@ void FunctionSheetColumnHeadViewer::contextMenuEvent(QContextMenuEvent *ce) {QAction showAnimatedOnly(FunctionTreeView::tr("Show Animated Only"), 0);QAction showAll(FunctionTreeView::tr("Show All"), 0);+ QAction hideSelected(FunctionTreeView::tr("Hide Selected"), 0);menu.addAction(&showAnimatedOnly);menu.addAction(&showAll);+ menu.addAction(&hideSelected);// execute menuQAction *action = menu.exec(globalPos);- if (action != &showAll && action != &showAnimatedOnly) return;-// Process actionif (action == &showAll) {int c, cCount = group->getChildCount();@@ -521,7 +533,18 @@ void FunctionSheetColumnHeadViewer::contextMenuEvent(QContextMenuEvent *ce) {if (channel && !channel->isHidden())channel->setIsActive(channel->isAnimated());}- }+ } else if (action == &hideSelected) {+ QRect selectedCells = getViewer()->getSelectedCells();+ // hide the selected columns from the right to the left+ for (int col = selectedCells.right(); col >= selectedCells.left();+ col--) {+ FunctionTreeModel::Channel *chan = m_sheet->getChannel(col);+ if (chan) chan->setIsActive(false);+ }+ // clear cell selection+ getViewer()->selectCells(QRect());+ } else+ return;fv->update();}