From ce0b4469badac7b53230cbd3a4ecdb4338e49be3 Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Jul 23 2019 19:05:30 +0000 Subject: input cell with non-existent level (#2670) --- diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp index 745e96f..f0b3b00 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]); #endif FilmstripCmd::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 draw bool sameLevel = prevCell.m_level.getPointer() == cell.m_level.getPointer(); @@ -2004,7 +1985,7 @@ void CellArea::drawSoundTextCell(QPainter &p, int row, int col) { #ifdef _WIN32 fontName = "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 >= 0x050500 QString elidaName = elideText(text, metric, nameRect.width(), "~"); #else - QString elidaName = elideText(text, font, nameRect.width(), "~"); + QString elidaName = elideText(text, font, nameRect.width(), "~"); #endif if (!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 _WIN32 fontName = "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