OpenToonz - An open-source full-featured 2D animation creation software
C
fix pasting raster to cell
shun-iwasawa3e5bb9d04502
diff --git a/toonz/sources/toonz/cellselection.cpp b/toonz/sources/toonz/cellselection.cppindex a05078c56..608fce3fd 100644--- a/toonz/sources/toonz/cellselection.cpp+++ b/toonz/sources/toonz/cellselection.cpp@@ -639,6 +639,8 @@ bool pasteRasterImageInCellWithoutUndo(int row, int col,app->getCurrentLevel()->setLevel(sl);app->getCurrentLevel()->notifyLevelChange();sl->save();+ // after saving you need to obtain the image again+ img = sl->getFrame(fid, true);} else {img = sl->createEmptyFrame();assert(img);@@ -648,6 +650,8 @@ bool pasteRasterImageInCellWithoutUndo(int row, int col,sl->setFrame(fid, img);}xsh->setCell(row, col, TXshCell(sl, fid));+ // to let the undo to know which frame is edited+ TTool::m_cellsData.push_back({row, row, TTool::CellOps::BlankToNew});} else {sl = cell.getSimpleLevel();fid = cell.getFrameId();@@ -1630,6 +1634,9 @@ static void pasteStrokesInCell(int row, int col,static void pasteRasterImageInCell(int row, int col,const RasterImageData *rasterImageData) {+ // to let the undo to know which frame is edited+ TTool::m_cellsData.clear();+TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();TXshCell cell = xsh->getCell(row, col);bool createdFrame = false;diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cppindex 1bc2edd58..ac8e1e65c 100644--- a/toonz/sources/toonzlib/txshsimplelevel.cpp+++ b/toonz/sources/toonzlib/txshsimplelevel.cpp@@ -1964,7 +1964,7 @@ TImageP TXshSimpleLevel::createEmptyFrame() {// manner as createNewLevel() in order to avoid crash. This can be happened if// the level was not saved after creating and being placed in the xsheet.if (isEmpty()) {- initializePalette();+ if (!getPalette()) initializePalette();initializeResolutionAndDpi();}