diff --git a/toonz/sources/tnztools/skeletontool.cpp b/toonz/sources/tnztools/skeletontool.cpp index 0cb31d2..14b6d97 100644 --- a/toonz/sources/tnztools/skeletontool.cpp +++ b/toonz/sources/tnztools/skeletontool.cpp @@ -328,7 +328,7 @@ void SkeletonTool::leftButtonDown(const TPointD &ppos, const TMouseEvent &e) { m_otherColumnBBoxAff = TAffine(); m_labelPos = TPointD(0, 0); m_label = ""; - + // This undo block ends in leftButtonUp TUndoManager::manager()->beginBlock(); if (!doesApply()) return; diff --git a/toonz/sources/toonz/cellselection.cpp b/toonz/sources/toonz/cellselection.cpp index 27a6229..93a4651 100644 --- a/toonz/sources/toonz/cellselection.cpp +++ b/toonz/sources/toonz/cellselection.cpp @@ -2865,7 +2865,7 @@ static void createNewDrawing(TXsheet *xsh, int row, int col, const Type *Var = dynamic_cast(Data) void TCellSelection::dPasteCells() { - if (isEmpty()) // Se la selezione delle celle e' vuota ritorno. + if (isEmpty()) return; int r0, c0, r1, c1; getSelectedCells(r0, c0, r1, c1); @@ -2874,7 +2874,10 @@ void TCellSelection::dPasteCells() { QClipboard *clipboard = QApplication::clipboard(); const QMimeData *mimeData = clipboard->mimeData(); if (DYNAMIC_CAST(TCellData, cellData, mimeData)) { - if (!cellData->canChange(xsh, c0)) return; + if (!cellData->canChange(xsh, c0)) { + TUndoManager::manager()->endBlock(); + return; + } for (int c = 0; c < cellData->getColCount(); c++) { for (int r = 0; r < cellData->getRowCount(); r++) { TXshCell src = cellData->getCell(r, c); diff --git a/toonz/sources/toonzqt/functionpaneltools.cpp b/toonz/sources/toonzqt/functionpaneltools.cpp index d0d6bfd..6d255a3 100644 --- a/toonz/sources/toonzqt/functionpaneltools.cpp +++ b/toonz/sources/toonzqt/functionpaneltools.cpp @@ -106,6 +106,7 @@ MovePointDragTool::MovePointDragTool(FunctionPanel *panel, TDoubleParam *curve) , m_speed1Index(-1) , m_groupEnabled(false) , m_selection(0) { + // This undo block is closed in the destructor TUndoManager::manager()->beginBlock(); if (curve) { diff --git a/toonz/sources/toonzqt/fxselection.cpp b/toonz/sources/toonzqt/fxselection.cpp index 81b440c..07983d7 100644 --- a/toonz/sources/toonzqt/fxselection.cpp +++ b/toonz/sources/toonzqt/fxselection.cpp @@ -259,8 +259,11 @@ bool FxSelection::insertPasteSelection() { fxsData->getFxs(fxs, zeraryFxColumnSize, columns); if (fxs.empty() && columns.empty()) return true; - if (!auto_.m_destruct) - auto_.m_destruct = true, TUndoManager::manager()->beginBlock(); + // auto ends the undo block in the destructor. + if (!auto_.m_destruct) { + auto_.m_destruct = true; + TUndoManager::manager()->beginBlock(); + } TFxCommand::insertPasteFxs(selectedLinks[i], fxs.toStdList(), zeraryFxColumnSize.toStdMap(), @@ -301,6 +304,7 @@ bool FxSelection::addPasteSelection() { fxsData->getFxs(fxs, zeraryFxColumnSize, columns); if (fxs.empty() && columns.empty()) return true; + // auto ends the undo block in its destructor if (!auto_.m_destruct) auto_.m_destruct = true, TUndoManager::manager()->beginBlock(); @@ -344,6 +348,7 @@ bool FxSelection::replacePasteSelection() { fxsData->getFxs(fxs, zeraryFxColumnSize, columns); if (fxs.empty() && columns.empty()) return true; + // auto ends the undo block in its destructor if (!auto_.m_destruct) auto_.m_destruct = true, TUndoManager::manager()->beginBlock(); @@ -378,8 +383,9 @@ void FxSelection::ungroupSelection() { TUndoManager::manager()->beginBlock(); QSet::iterator it; - for (it = idSet.begin(); it != idSet.end(); it++) - TFxCommand::ungroupFxs(*it, m_xshHandle); + for (it = idSet.begin(); it != idSet.end(); it++) { + TFxCommand::ungroupFxs(*it, m_xshHandle); + } TUndoManager::manager()->endBlock(); selectNone(); m_xshHandle->notifyXsheetChanged();