OpenToonz - An open-source full-featured 2D animation creation software
C
input cell with non-existent level (#2670)
shun-iwasawace0b4469bada
diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cppindex 745e96fc7..f0b3b009f 100644--- a/toonz/sources/toonz/xshcellviewer.cpp+++ b/toonz/sources/toonz/xshcellviewer.cpp@@ -318,46 +318,36 @@ bool isGlobalKeyFrameWithSameTypeDiffFromLinear(TStageObject *stageObject,TDoubleKeyframe::Type type =stageObject->getParam(TStageObject::T_Angle)->getKeyframeAt(frame).m_type;if (type == TDoubleKeyframe::Linear) return false;- if (type !=- stageObject->getParam(TStageObject::T_X)- ->getKeyframeAt(frame)- .m_type ||- type !=- stageObject->getParam(TStageObject::T_Y)- ->getKeyframeAt(frame)- .m_type ||- type !=- stageObject->getParam(TStageObject::T_Z)- ->getKeyframeAt(frame)- .m_type ||- type !=- stageObject->getParam(TStageObject::T_SO)- ->getKeyframeAt(frame)- .m_type ||- type !=- stageObject->getParam(TStageObject::T_ScaleX)- ->getKeyframeAt(frame)- .m_type ||- type !=- stageObject->getParam(TStageObject::T_ScaleY)- ->getKeyframeAt(frame)- .m_type ||- type !=- stageObject->getParam(TStageObject::T_Scale)- ->getKeyframeAt(frame)- .m_type ||- type !=- stageObject->getParam(TStageObject::T_Path)- ->getKeyframeAt(frame)- .m_type ||- type !=- stageObject->getParam(TStageObject::T_ShearX)- ->getKeyframeAt(frame)- .m_type ||- type !=- stageObject->getParam(TStageObject::T_ShearY)- ->getKeyframeAt(frame)- .m_type)+ if (type != stageObject->getParam(TStageObject::T_X)+ ->getKeyframeAt(frame)+ .m_type ||+ type != stageObject->getParam(TStageObject::T_Y)+ ->getKeyframeAt(frame)+ .m_type ||+ type != stageObject->getParam(TStageObject::T_Z)+ ->getKeyframeAt(frame)+ .m_type ||+ type != stageObject->getParam(TStageObject::T_SO)+ ->getKeyframeAt(frame)+ .m_type ||+ type != stageObject->getParam(TStageObject::T_ScaleX)+ ->getKeyframeAt(frame)+ .m_type ||+ type != stageObject->getParam(TStageObject::T_ScaleY)+ ->getKeyframeAt(frame)+ .m_type ||+ type != stageObject->getParam(TStageObject::T_Scale)+ ->getKeyframeAt(frame)+ .m_type ||+ type != stageObject->getParam(TStageObject::T_Path)+ ->getKeyframeAt(frame)+ .m_type ||+ type != stageObject->getParam(TStageObject::T_ShearX)+ ->getKeyframeAt(frame)+ .m_type ||+ type != stageObject->getParam(TStageObject::T_ShearY)+ ->getKeyframeAt(frame)+ .m_type)return false;return true;}@@ -380,46 +370,36 @@ bool isGlobalKeyFrameWithSamePrevTypeDiffFromLinear(TStageObject *stageObject,->getKeyframeAt(frame).m_prevType;if (type == TDoubleKeyframe::Linear) return false;- if (type !=- stageObject->getParam(TStageObject::T_X)- ->getKeyframeAt(frame)- .m_prevType ||- type !=- stageObject->getParam(TStageObject::T_Y)- ->getKeyframeAt(frame)- .m_prevType ||- type !=- stageObject->getParam(TStageObject::T_Z)- ->getKeyframeAt(frame)- .m_prevType ||- type !=- stageObject->getParam(TStageObject::T_SO)- ->getKeyframeAt(frame)- .m_prevType ||- type !=- stageObject->getParam(TStageObject::T_ScaleX)- ->getKeyframeAt(frame)- .m_prevType ||- type !=- stageObject->getParam(TStageObject::T_ScaleY)- ->getKeyframeAt(frame)- .m_prevType ||- type !=- stageObject->getParam(TStageObject::T_Scale)- ->getKeyframeAt(frame)- .m_prevType ||- type !=- stageObject->getParam(TStageObject::T_Path)- ->getKeyframeAt(frame)- .m_prevType ||- type !=- stageObject->getParam(TStageObject::T_ShearX)- ->getKeyframeAt(frame)- .m_prevType ||- type !=- stageObject->getParam(TStageObject::T_ShearY)- ->getKeyframeAt(frame)- .m_prevType)+ if (type != stageObject->getParam(TStageObject::T_X)+ ->getKeyframeAt(frame)+ .m_prevType ||+ type != stageObject->getParam(TStageObject::T_Y)+ ->getKeyframeAt(frame)+ .m_prevType ||+ type != stageObject->getParam(TStageObject::T_Z)+ ->getKeyframeAt(frame)+ .m_prevType ||+ type != stageObject->getParam(TStageObject::T_SO)+ ->getKeyframeAt(frame)+ .m_prevType ||+ type != stageObject->getParam(TStageObject::T_ScaleX)+ ->getKeyframeAt(frame)+ .m_prevType ||+ type != stageObject->getParam(TStageObject::T_ScaleY)+ ->getKeyframeAt(frame)+ .m_prevType ||+ type != stageObject->getParam(TStageObject::T_Scale)+ ->getKeyframeAt(frame)+ .m_prevType ||+ type != stageObject->getParam(TStageObject::T_Path)+ ->getKeyframeAt(frame)+ .m_prevType ||+ type != stageObject->getParam(TStageObject::T_ShearX)+ ->getKeyframeAt(frame)+ .m_prevType ||+ type != stageObject->getParam(TStageObject::T_ShearY)+ ->getKeyframeAt(frame)+ .m_prevType)return false;return true;}@@ -778,7 +758,7 @@ void RenameCellField::renameCell() {fid = TFrameId(fidRe.cap(1).toInt(),fidRe.cap(2) == "" ? 0 : fidRe.cap(2).toLatin1()[0]);#else- fid = TFrameId(fidRe.cap(1).toInt(),+ fid = TFrameId(fidRe.cap(1).toInt(),fidRe.cap(2) == "" ? 0 : fidRe.cap(2).toAscii()[0]);#endifFilmstripCmd::renumberDrawing(sl, cell.m_frameId, fid);@@ -828,7 +808,7 @@ void RenameCellField::renameCell() {}TXshLevel *xl = cell.m_level.getPointer();- if (!xl || (xl->getSimpleLevel() &&+ if (!xl || (xl->getSimpleLevel() && !xl->getSimpleLevel()->isEmpty() &&xl->getSimpleLevel()->getFirstFid() == TFrameId::NO_FRAME)) {cells.append(TXshCell());continue;@@ -1794,10 +1774,10 @@ void CellArea::drawLevelCell(QPainter &p, int row, int col, bool isReference) {nameRect.adjust(0, 0, -frameAdj, 0);// draw text in red if the file does not exist- bool isRed = false;- TXshSimpleLevel *sl = cell.getSimpleLevel();+ bool isRed = false;+ TXshSimpleLevel *sl = cell.getSimpleLevel();if (sl && !sl->isFid(cell.m_frameId)) isRed = true;- TXshChildLevel *cl = cell.getChildLevel();+ TXshChildLevel *cl = cell.getChildLevel();if (cl && cell.getFrameId().getNumber() - 1 >= cl->getFrameCount())isRed = true;QColor penColor =@@ -1897,8 +1877,9 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {bool isSelected = cellSelection->isCellSelected(row, col) ||columnSelection->isColumnSelected(col);- if (row > 0) prevCell = xsh->getCell(row - 1, col); // cell in previous frame- // nothing to draw+ if (row > 0)+ prevCell = xsh->getCell(row - 1, col); // cell in previous frame+ // nothing to drawbool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer();@@ -2004,7 +1985,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {#ifdef _WIN32fontName = "Arial";#else- fontName = "Helvetica";+ fontName = "Helvetica";#endif}static QFont font(fontName, -1, QFont::Normal);@@ -2036,7 +2017,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) {#if QT_VERSION >= 0x050500QString elidaName = elideText(text, metric, nameRect.width(), "~");#else- QString elidaName = elideText(text, font, nameRect.width(), "~");+ QString elidaName = elideText(text, font, nameRect.width(), "~");#endifif (!sameLevel || prevCell.m_frameId != cell.m_frameId)@@ -2057,7 +2038,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,bool isSelected = cellSelection->isCellSelected(row, col);if (row > 0) prevCell = xsh->getCell(row - 1, col);- TXshCell nextCell = xsh->getCell(row + 1, col);+ TXshCell nextCell = xsh->getCell(row + 1, col);bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer();@@ -2068,8 +2049,8 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,bool isAfterMarkers =distance > 0 && ((row - offset) % distance) == 0 && row != 0;- bool isRed = false;- TXshPaletteLevel *pl = cell.getPaletteLevel();+ bool isRed = false;+ TXshPaletteLevel *pl = cell.getPaletteLevel();if (pl && !pl->getPalette()) isRed = true;QPoint xy = m_viewer->positionToXY(CellPosition(row, col));@@ -2201,7 +2182,7 @@ void CellArea::drawPaletteCell(QPainter &p, int row, int col,#ifdef _WIN32fontName = "Arial";#else- fontName = "Helvetica";+ fontName = "Helvetica";#endif}static QFont font(fontName, -1, QFont::Normal);@@ -2742,10 +2723,9 @@ void CellArea::mousePressEvent(QMouseEvent *event) {setDragTool(XsheetGUI::DragTool::makeLevelMoverTool(m_viewer));} else {m_viewer->getKeyframeSelection()->selectNone();- if (isSoundColumn &&- o->rect(PredefinedRect::PREVIEW_TRACK)- .adjusted(0, 0, -frameAdj, 0)- .contains(mouseInCell))+ if (isSoundColumn && o->rect(PredefinedRect::PREVIEW_TRACK)+ .adjusted(0, 0, -frameAdj, 0)+ .contains(mouseInCell))setDragTool(XsheetGUI::DragTool::makeSoundScrubTool(m_viewer, column->getSoundColumn()));else if (isSoundColumn &&@@ -2879,10 +2859,9 @@ void CellArea::mouseMoveEvent(QMouseEvent *event) {: QString::fromStdWString(levelName) + QString(" ") +QString::fromStdString(frameNumber));}- } else if (isSoundColumn &&- o->rect(PredefinedRect::PREVIEW_TRACK)- .adjusted(0, 0, -frameAdj, 0)- .contains(mouseInCell))+ } else if (isSoundColumn && o->rect(PredefinedRect::PREVIEW_TRACK)+ .adjusted(0, 0, -frameAdj, 0)+ .contains(mouseInCell))m_tooltip = tr("Click and drag to play");else if (m_levelExtenderRect.contains(pos))m_tooltip = tr("Click and drag to repeat selected cells");@@ -3513,4 +3492,4 @@ void CellArea::onStepChanged(QAction *act) {//------------------------------------------------------------------------------} // namespace XsheetGUI;+} // namespace XsheetGUI