From 277d8b90eff10f57f8c54cad3e69011819b48908 Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Aug 10 2018 06:45:40 +0000 Subject: rename xsheet cell with following level (#2199) --- diff --git a/toonz/sources/toonz/xshcellviewer.cpp b/toonz/sources/toonz/xshcellviewer.cpp index 43186cf..bd8f1ac 100644 --- a/toonz/sources/toonz/xshcellviewer.cpp +++ b/toonz/sources/toonz/xshcellviewer.cpp @@ -803,6 +803,10 @@ void RenameCellField::renameCell() { // if there is no level at the current cell, take the level from the // previous frames // (when editing not empty column) + if (xsheet->isColumnEmpty(c)) { + cells.append(TXshCell()); + continue; + } TXshCell cell; int tmpRow = m_row; @@ -811,6 +815,19 @@ void RenameCellField::renameCell() { if (!cell.isEmpty() || tmpRow == 0) break; tmpRow--; } + + // if the level is not found in the previous frames, then search in the + // following frames + if (cell.isEmpty()) { + tmpRow = m_row + 1; + int maxFrame = xsheet->getFrameCount(); + while (1) { + cell = xsheet->getCell(tmpRow, c); + if (!cell.isEmpty() || tmpRow >= maxFrame) break; + tmpRow++; + } + } + TXshLevel *xl = cell.m_level.getPointer(); if (!xl || (xl->getType() == OVL_XSHLEVEL && xl->getPath().getFrame() == TFrameId::NO_FRAME)) {