diff --git a/toonz/sources/common/tvectorimage/tvectorimage.cpp b/toonz/sources/common/tvectorimage/tvectorimage.cpp index ab7fd8a..4f1fb28 100644 --- a/toonz/sources/common/tvectorimage/tvectorimage.cpp +++ b/toonz/sources/common/tvectorimage/tvectorimage.cpp @@ -1034,8 +1034,8 @@ bool TVectorImage::Imp::areWholeGroups(const std::vector &indexes) const { if (!m_strokes[indexes[i]]->m_groupId.isGrouped()) return false; for (j = 0; j < m_strokes.size(); j++) { int ret = areDifferentGroup(indexes[i], false, j, false); - if (ret == -1 || - (ret >= 1 && find(indexes.begin(), indexes.end(), j) == indexes.end())) + if (ret == -1 || (ret >= 1 && find(indexes.begin(), indexes.end(), j) == + indexes.end())) return false; } } @@ -1282,7 +1282,7 @@ void TVectorImage::mergeImage(const TVectorImageP &img, const TAffine &affine, } else { img->m_imp->m_strokes[i]->m_groupId = TGroupId(groupId, img->m_imp->m_strokes[i]->m_groupId); - } + } } } } @@ -2154,7 +2154,8 @@ VIStroke *TVectorImage::Imp::joinStroke(int index1, int index2, int cpIndex1, // check if the both ends are at the same postion bool isSamePos = isAlmostZero(tdistance2(stroke1->getControlPoint(cpIndex1), - stroke2->getControlPoint(cpIndex2))); + stroke2->getControlPoint(cpIndex2)), + 1e-4); // connecting the ends in the same shape at the same postion // means just making the shape self-looped if (isSamePos && index1 == index2) { @@ -2908,7 +2909,7 @@ void TVectorImage::Imp::regroupGhosts(std::vector &changedStrokes) { ((currGroupId.isGrouped(false) != 0 && m_strokes[i]->m_groupId == currGroupId) || (currGroupId.isGrouped(true) != 0 && - m_strokes[i]->m_groupId.isGrouped(true) != 0))) { + m_strokes[i]->m_groupId.isGrouped(true) != 0))) { if (m_strokes[i]->m_groupId != currGroupId) { m_strokes[i]->m_groupId = currGroupId; changedStrokes.push_back(i); diff --git a/toonz/sources/tnztools/geometrictool.cpp b/toonz/sources/tnztools/geometrictool.cpp index 8b8bfad..38a1f46 100644 --- a/toonz/sources/tnztools/geometrictool.cpp +++ b/toonz/sources/tnztools/geometrictool.cpp @@ -2316,6 +2316,7 @@ void MultiArcPrimitive::leftButtonUp(const TPointD &pos, const TMouseEvent &e) { case 2: m_tool->addStroke(m_hasLastStroke); + m_stroke = 0; if (!m_isSingleArc && !m_endStroke) { m_hasLastStroke = true; @@ -2355,8 +2356,7 @@ void MultiArcPrimitive::mouseMove(const TPointD &pos, const TMouseEvent &e) { break; case 2: m_centralPoint = TThickPoint(newPos, getThickness()); - TThickQuadratic q(m_stroke->getControlPoint(0), m_centralPoint, - m_stroke->getControlPoint(8)); + TThickQuadratic q(m_startPoint, m_centralPoint, m_endPoint); TThickQuadratic q0, q1, q00, q01, q10, q11; q.split(0.5, q0, q1); @@ -2367,7 +2367,6 @@ void MultiArcPrimitive::mouseMove(const TPointD &pos, const TMouseEvent &e) { assert(q01.getP2() == q10.getP0()); assert(q10.getP2() == q11.getP0()); - m_stroke->setControlPoint(0, q00.getP0()); m_stroke->setControlPoint(1, q00.getP1()); m_stroke->setControlPoint(2, q00.getP2()); m_stroke->setControlPoint(3, q01.getP1()); @@ -2375,7 +2374,6 @@ void MultiArcPrimitive::mouseMove(const TPointD &pos, const TMouseEvent &e) { m_stroke->setControlPoint(5, q10.getP1()); m_stroke->setControlPoint(6, q10.getP2()); m_stroke->setControlPoint(7, q11.getP1()); - m_stroke->setControlPoint(8, q11.getP2()); break; } m_tool->invalidate();