OpenToonz - An open-source full-featured 2D animation creation software
C
Fix frame range undo (#1759)
Jeremy Bullock129805fb685c
diff --git a/toonz/sources/tnztools/brushtool.cpp b/toonz/sources/tnztools/brushtool.cppindex 956e7d2b8..9c9a7d8f3 100644--- a/toonz/sources/tnztools/brushtool.cpp+++ b/toonz/sources/tnztools/brushtool.cpp@@ -340,7 +340,8 @@ static void findMaxCurvPoints(TStroke *stroke, const float &angoloLim,static void addStroke(TTool::Application *application, const TVectorImageP &vi,TStroke *stroke, bool breakAngles, bool frameCreated,- bool levelCreated) {+ bool levelCreated, TXshSimpleLevel *sLevel = NULL,+ TFrameId fid = TFrameId::NO_FRAME) {QMutexLocker lock(vi->getMutex());if (application->getCurrentObject()->isSpline()) {@@ -358,9 +359,14 @@ static void addStroke(TTool::Application *application, const TVectorImageP &vi,// Up this value the point can be considered a max curvature point.findMaxCurvPoints(stroke, angoloLim, curvMaxLim, corners);- TXshSimpleLevel *sl = application->getCurrentLevel()->getSimpleLevel();+ TXshSimpleLevel *sl;+ if (!sLevel) {+ sl = application->getCurrentLevel()->getSimpleLevel();+ } else {+ sl = sLevel;+ }TFrameId id = application->getCurrentTool()->getTool()->getCurrentFid();-+ if (id == TFrameId::NO_FRAME && fid != TFrameId::NO_FRAME) id = fid;if (!corners.empty()) {if (breakAngles)split(stroke, corners, strokes);@@ -422,10 +428,11 @@ namespace {void addStrokeToImage(TTool::Application *application, const TVectorImageP &vi,TStroke *stroke, bool breakAngles, bool frameCreated,- bool levelCreated) {+ bool levelCreated, TXshSimpleLevel *sLevel = NULL,+ TFrameId id = TFrameId::NO_FRAME) {QMutexLocker lock(vi->getMutex());addStroke(application, vi.getPointer(), stroke, breakAngles, frameCreated,- levelCreated);+ levelCreated, sLevel, id);// la notifica viene gia fatta da addStroke!// getApplication()->getCurrentTool()->getTool()->notifyImageChanged();}@@ -1649,13 +1656,13 @@ bool BrushTool::doFrameRangeStrokes(TFrameId firstFrameId, TStroke *firstStroke,} elseaddStrokeToImage(getApplication(), img, firstImage->getStroke(0),m_breakAngles.getValue(), m_isFrameCreated,- m_isLevelCreated);+ m_isLevelCreated, sl, fid);} else if (t == 1) {if (swapped && !drawFirstStroke) {} elseaddStrokeToImage(getApplication(), img, lastImage->getStroke(0),m_breakAngles.getValue(), m_isFrameCreated,- m_isLevelCreated);+ m_isLevelCreated, sl, fid);} else {assert(firstImage->getStrokeCount() == 1);assert(lastImage->getStrokeCount() == 1);@@ -1663,7 +1670,7 @@ bool BrushTool::doFrameRangeStrokes(TFrameId firstFrameId, TStroke *firstStroke,assert(vi->getStrokeCount() == 1);addStrokeToImage(getApplication(), img, vi->getStroke(0),m_breakAngles.getValue(), m_isFrameCreated,- m_isLevelCreated);+ m_isLevelCreated, sl, fid);}}TUndoManager::manager()->endBlock();@@ -2420,16 +2427,16 @@ void BrushTool::addPreset(QString name) {preset.m_max = m_rasThickness.getValue().second;}- preset.m_acc = m_accuracy.getValue();- preset.m_smooth = m_smooth.getValue();- preset.m_hardness = m_hardness.getValue();- preset.m_selective = m_selective.getValue();- preset.m_pencil = m_pencil.getValue();- preset.m_breakAngles = m_breakAngles.getValue();- preset.m_pressure = m_pressure.getValue();- preset.m_cap = m_capStyle.getIndex();- preset.m_join = m_joinStyle.getIndex();- preset.m_miter = m_miterJoinLimit.getValue();+ preset.m_acc = m_accuracy.getValue();+ preset.m_smooth = m_smooth.getValue();+ preset.m_hardness = m_hardness.getValue();+ preset.m_selective = m_selective.getValue();+ preset.m_pencil = m_pencil.getValue();+ preset.m_breakAngles = m_breakAngles.getValue();+ preset.m_pressure = m_pressure.getValue();+ preset.m_cap = m_capStyle.getIndex();+ preset.m_join = m_joinStyle.getIndex();+ preset.m_miter = m_miterJoinLimit.getValue();// Pass the preset to the managerm_presetsManager.addPreset(preset);