diff --git a/toonz/sources/tnztools/geometrictool.cpp b/toonz/sources/tnztools/geometrictool.cpp index 7e4f9a2..f5d271a 100644 --- a/toonz/sources/tnztools/geometrictool.cpp +++ b/toonz/sources/tnztools/geometrictool.cpp @@ -1118,7 +1118,12 @@ public: ImageUtils::getFillingInformationOverlappingArea(vi, *fillInformation, stroke->getBBox()); - bool strokeAdded = false; + vi->addStroke(stroke); + TUndoManager::manager()->add(new UndoPencil( + vi->getStroke(vi->getStrokeCount() - 1), fillInformation, sl, id, + m_isFrameCreated, m_isLevelCreated, m_param.m_autogroup.getValue(), + m_param.m_autofill.getValue())); + if ((Preferences::instance()->getGuidedDrawingType() == 1 || Preferences::instance()->getGuidedDrawingType() == 2) && Preferences::instance()->getGuidedAutoInbetween()) { @@ -1127,19 +1132,11 @@ public: ToonzVectorBrushTool *vbTool = (ToonzVectorBrushTool *)tool; if (vbTool) { vbTool->setViewer(m_viewer); - strokeAdded = vbTool->doGuidedAutoInbetween( - id, vi, stroke, false, m_param.m_autogroup.getValue(), - m_param.m_autofill.getValue(), true); + vbTool->doGuidedAutoInbetween(id, vi, stroke, false, + m_param.m_autogroup.getValue(), + m_param.m_autofill.getValue(), false); } } - - if (!strokeAdded) { - vi->addStroke(stroke); - TUndoManager::manager()->add(new UndoPencil( - vi->getStroke(vi->getStrokeCount() - 1), fillInformation, sl, id, - m_isFrameCreated, m_isLevelCreated, m_param.m_autogroup.getValue(), - m_param.m_autofill.getValue())); - } } if (m_param.m_autogroup.getValue() && stroke->isSelfLoop()) { int index = vi->getStrokeCount() - 1; @@ -2095,7 +2092,7 @@ TStroke *EllipsePrimitive::makeStroke() const { return 0; return makeEllipticStroke( - getThickness(), + getThickness(), TPointD(0.5 * (m_selectingRect.x0 + m_selectingRect.x1), 0.5 * (m_selectingRect.y0 + m_selectingRect.y1)), fabs(0.5 * (m_selectingRect.x1 - m_selectingRect.x0)), diff --git a/toonz/sources/tnztools/tool.cpp b/toonz/sources/tnztools/tool.cpp index 04a7b1e..4032da2 100644 --- a/toonz/sources/tnztools/tool.cpp +++ b/toonz/sources/tnztools/tool.cpp @@ -1295,6 +1295,8 @@ void TTool::tweenSelectedGuideStrokes() { TTool *tool = TTool::getTool(T_Brush, TTool::ToolTargetType::VectorImage); ToonzVectorBrushTool *vbTool = (ToonzVectorBrushTool *)tool; if (vbTool) { + m_isFrameCreated = false; + m_isLevelCreated = false; vbTool->setViewer(m_viewer); vbTool->doFrameRangeStrokes( bFid, bStroke, fFid, fStroke, @@ -1394,6 +1396,8 @@ void TTool::tweenGuideStrokeToSelected() { TTool *tool = TTool::getTool(T_Brush, TTool::ToolTargetType::VectorImage); ToonzVectorBrushTool *vbTool = (ToonzVectorBrushTool *)tool; if (vbTool) { + m_isFrameCreated = false; + m_isLevelCreated = false; vbTool->setViewer(m_viewer); TUndoManager::manager()->beginBlock(); if (bStroke) diff --git a/toonz/sources/tnztools/toonzvectorbrushtool.cpp b/toonz/sources/tnztools/toonzvectorbrushtool.cpp index 801e532..1645d24 100644 --- a/toonz/sources/tnztools/toonzvectorbrushtool.cpp +++ b/toonz/sources/tnztools/toonzvectorbrushtool.cpp @@ -980,7 +980,11 @@ void ToonzVectorBrushTool::leftButtonUp(const TPointD &pos, m_snapSelf = false; } - bool strokeAdded = false; + addStrokeToImage(getApplication(), vi, stroke, m_breakAngles.getValue(), + false, false, m_isFrameCreated, m_isLevelCreated); + TRectD bbox = stroke->getBBox().enlarge(2) + m_track.getModifiedRegion(); + + invalidate(); // should use bbox? if ((Preferences::instance()->getGuidedDrawingType() == 1 || Preferences::instance()->getGuidedDrawingType() == 2) && @@ -988,21 +992,14 @@ void ToonzVectorBrushTool::leftButtonUp(const TPointD &pos, int fidx = getApplication()->getCurrentFrame()->getFrameIndex(); TFrameId fId = getFrameId(); - strokeAdded = doGuidedAutoInbetween( - fId, vi, stroke, m_breakAngles.getValue(), false, false, true); + doGuidedAutoInbetween(fId, vi, stroke, m_breakAngles.getValue(), false, + false, false); if (getApplication()->getCurrentFrame()->isEditingScene()) getApplication()->getCurrentFrame()->setFrame(fidx); else getApplication()->getCurrentFrame()->setFid(fId); } - - if (!strokeAdded) - addStrokeToImage(getApplication(), vi, stroke, m_breakAngles.getValue(), - false, false, m_isFrameCreated, m_isLevelCreated); - TRectD bbox = stroke->getBBox().enlarge(2) + m_track.getModifiedRegion(); - - invalidate(); // should use bbox? } assert(stroke); m_track.clear(); @@ -1141,7 +1138,7 @@ bool ToonzVectorBrushTool::doGuidedAutoInbetween( bool resultFront = false; TFrameId oFid; int cStrokeIdx = cvi->getStrokeCount(); - int cStrokeCount = cStrokeIdx + 1; + if (!drawStroke) cStrokeIdx--; TUndoManager::manager()->beginBlock(); if (osBack != -1) { @@ -1166,10 +1163,13 @@ bool ToonzVectorBrushTool::doGuidedAutoInbetween( strokeIdx < fStrokeCount) { TStroke *fStroke = fvi->getStroke(strokeIdx); - resultBack = doFrameRangeStrokes( + bool frameCreated = m_isFrameCreated; + m_isFrameCreated = false; + resultBack = doFrameRangeStrokes( oFid, fStroke, cFid, cStroke, Preferences::instance()->getGuidedInterpolation(), breakAngles, autoGroup, autoFill, false, drawStroke, false); + m_isFrameCreated = frameCreated; } } @@ -1197,10 +1197,13 @@ bool ToonzVectorBrushTool::doGuidedAutoInbetween( strokeIdx < fStrokeCount) { TStroke *fStroke = fvi->getStroke(strokeIdx); - resultFront = doFrameRangeStrokes( + bool frameCreated = m_isFrameCreated; + m_isFrameCreated = false; + resultFront = doFrameRangeStrokes( cFid, cStroke, oFid, fStroke, Preferences::instance()->getGuidedInterpolation(), breakAngles, autoGroup, autoFill, drawFirstStroke, false, false); + m_isFrameCreated = frameCreated; } } TUndoManager::manager()->endBlock();