OpenToonz - An open-source full-featured 2D animation creation software
C
Encapsulate expressions in parentheses
Michał Janiszewskib1cc3ceeac18
diff --git a/toonz/sources/common/tgeometry/tcurveutil.cpp b/toonz/sources/common/tgeometry/tcurveutil.cppindex 3ba356bc1..be1d30fea 100644--- a/toonz/sources/common/tgeometry/tcurveutil.cpp+++ b/toonz/sources/common/tgeometry/tcurveutil.cpp@@ -396,11 +396,12 @@ int intersect(const TQuadratic &q,return 0;}- if (q.getP2() - q.getP1() == q.getP1() - q.getP0()) //pure il secondo e' unsegmento....+ if (q.getP2() - q.getP1() == q.getP1() - q.getP0()) {//pure il secondo e' unsegmento....if (firstIsQuad)return intersect(TSegment(q.getP0(), q.getP2()), s, intersections);elsereturn intersect(s, TSegment(q.getP0(), q.getP2()), intersections);+ }vector<TPointD> bez, pol;bez.push_back(q.getP0());diff --git a/toonz/sources/include/tgeometry.h b/toonz/sources/include/tgeometry.hindex 4401c4bfe..d689575c9 100644--- a/toonz/sources/include/tgeometry.h+++ b/toonz/sources/include/tgeometry.h@@ -885,7 +885,7 @@ template <>inline TRectT<double>::TRectT(const TDimensionT<double> &d): x0(0.0), y0(0.0), x1(d.lx), y1(d.ly){};template <>-inline bool TRectT<double>::isEmpty() const { return x0 == x1 && y0 == y1 || x0 > x1 || y0 > y1; }+inline bool TRectT<double>::isEmpty() const { return (x0 == x1 && y0 == y1) || x0 > x1 || y0 > y1; }template <>inline void TRectT<double>::empty() { x0 = y0 = x1 = y1 = 0; }template <>diff --git a/toonz/sources/include/tpixel.h b/toonz/sources/include/tpixel.hindex 501734482..49ba0d305 100644--- a/toonz/sources/include/tpixel.h+++ b/toonz/sources/include/tpixel.h@@ -248,7 +248,7 @@ public:: r(rr), g(gg), b(bb), m(mm){};inline bool operator==(const TPixelD &p) const { return r == p.r && g == p.g && b == p.b && m == p.m; };- inline bool operator<(const TPixelD &p) const { return r < p.r || r == p.r && (g < p.g || g == p.g && (b < p.b || b == p.b && (m < p.m))); };+ inline bool operator<(const TPixelD &p) const { return r < p.r || (r == p.r && (g < p.g || (g == p.g && (b < p.b || (b == p.b && (m < p.m)))))); };inline bool operator>=(const TPixelD &p) const { return !operator<(p); };inline bool operator!=(const TPixelD &p) const { return !operator==(p); };diff --git a/toonz/sources/tnztools/skeletonsubtools.cpp b/toonz/sources/tnztools/skeletonsubtools.cppindex ee653be17..f7d309a3f 100644--- a/toonz/sources/tnztools/skeletonsubtools.cpp+++ b/toonz/sources/tnztools/skeletonsubtools.cpp@@ -825,7 +825,7 @@ void IKTool::initEngine(const TPointD &pos)Skeleton::Bone *next = m_skeleton->getBoneByColumnIndex(*it++);for (; it != links.end(); ++it)stack.push_back(std::make_pair(*it, prev));- if (links.size() > 1 || prev && next && prev->getParent() == bone && next->getParent() == bone) {+ if (links.size() > 1 || (prev && next && (prev->getParent() == bone && next->getParent() == bone))) {bone = next;} else {m_joints.push_back(Joint(bone, prev, sign));diff --git a/toonz/sources/tnztools/typetool.cpp b/toonz/sources/tnztools/typetool.cppindex a8cd536de..e9bf9c040 100644--- a/toonz/sources/tnztools/typetool.cpp+++ b/toonz/sources/tnztools/typetool.cpp@@ -1218,13 +1218,14 @@ void TypeTool::leftButtonDown(const TPointD &pos, const TMouseEvent &)if (!vi && !ti)return;- if (m_isFrameCreated)+ if (m_isFrameCreated) {if (vi)m_undo = new UndoTypeTool(0, 0, getApplication()->getCurrentLevel()->getSimpleLevel(),getCurrentFid(), m_isFrameCreated, m_isLevelCreated);elsem_undo = new RasterUndoTypeTool(0, 0, getApplication()->getCurrentLevel()->getSimpleLevel(),getCurrentFid(), m_isFrameCreated, m_isLevelCreated);+ }// closeImeWindow();// if(m_viewer) m_viewer->enableIme(true);diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cppindex b85619175..48396dc25 100644--- a/toonz/sources/toonz/iocommand.cpp+++ b/toonz/sources/toonz/iocommand.cpp@@ -570,7 +570,7 @@ void substituteLevel(TXsheet *xsh, TXshLevel *srcLevel, TXshLevel *dstLevel)xsh->getCells(r0, c, rowCount, &cells[0]);bool changed = false;for (int i = 0; i < rowCount; i++) {- if (!cells[i].isEmpty())+ if (!cells[i].isEmpty()) {if (cells[i].m_level.getPointer() == srcLevel) {cells[i].m_level = dstLevel;changed = true;@@ -583,6 +583,7 @@ void substituteLevel(TXsheet *xsh, TXshLevel *srcLevel, TXshLevel *dstLevel)substitutedSubs.insert(childLevel);}}+ }}if (changed)xsh->setCells(r0, c, rowCount, &cells[0]);diff --git a/toonz/sources/toonzlib/doubleparamcmd.cpp b/toonz/sources/toonzlib/doubleparamcmd.cppindex eec0c2520..3e1ddb650 100644--- a/toonz/sources/toonzlib/doubleparamcmd.cpp+++ b/toonz/sources/toonzlib/doubleparamcmd.cpp@@ -250,14 +250,14 @@ void KeyframeSetter::getRotatingSpeedHandles(}}// SpeedInOut * Linear *- if (ty[0] == 2 && ty[1] == 1 || ty[1] == 2 && ty[2] == 1) {+ if ((ty[0] == 2 && ty[1] == 1) || (ty[1] == 2 && ty[2] == 1)) {int k = ty[1] == 1 ? kIndex - 1 : kIndex;double speed = getNorm(param->getSpeedIn(k));if (speed > epsilon)rotatingSpeeds.push_back(std::make_pair(-speed, k));}// * Linear * SpeedInOut- if (ty[1] == 1 && ty[2] == 2 || ty[2] == 1 && ty[3] == 2) {+ if ((ty[1] == 1 && ty[2] == 2) || (ty[2] == 1 && ty[3] == 2)) {int k = ty[2] == 2 ? kIndex : kIndex + 1;double speed = getNorm(param->getSpeedOut(k));if (speed > epsilon)@@ -623,7 +623,7 @@ void KeyframeSetter::setSpeedIn(const TPointD &speedIn)double outNorm = getNorm(m_keyframe.m_speedOut);if (m_kIndex + 1 == m_param->getKeyframeCount() ||isSpeedInOut(m_kIndex) ||- m_keyframe.m_type == TDoubleKeyframe::Expression && m_keyframe.m_expressionText.find("cycle") != string::npos) {+ (m_keyframe.m_type == TDoubleKeyframe::Expression && m_keyframe.m_expressionText.find("cycle") != string::npos)) {// update next segment speed vectordouble inNorm = getNorm(m_keyframe.m_speedIn);if (inNorm < eps)diff --git a/toonz/sources/toonzlib/tstageobject.cpp b/toonz/sources/toonzlib/tstageobject.cppindex 4005c7dcd..92ba32c40 100644--- a/toonz/sources/toonzlib/tstageobject.cpp+++ b/toonz/sources/toonzlib/tstageobject.cpp@@ -1925,11 +1925,11 @@ void TStageObject::loadData(TIStream &is)if (tnzVersion < VersionNumber(1, 16) && !keyframes.empty()) {std::map<int, TStageObject::Keyframe>::iterator itKf = keyframes.begin();std::set<int> keyframeIndexSet;- for (itKf; itKf != keyframes.end(); itKf++)+ for (; itKf != keyframes.end(); itKf++)if (is52FullKeyframe(itKf->first))keyframeIndexSet.insert(itKf->first);std::set<int>::iterator itKfInd = keyframeIndexSet.begin();- for (itKfInd; itKfInd != keyframeIndexSet.end(); itKfInd++)+ for (; itKfInd != keyframeIndexSet.end(); itKfInd++)setkey(m_scale, *itKfInd);}updateKeyframes();diff --git a/toonz/sources/toonzqt/functionpaneltools.cpp b/toonz/sources/toonzqt/functionpaneltools.cppindex 5261ccb65..c47da719b 100644--- a/toonz/sources/toonzqt/functionpaneltools.cpp+++ b/toonz/sources/toonzqt/functionpaneltools.cpp@@ -382,10 +382,10 @@ void MoveHandleDragTool::drag(QMouseEvent *e)if (m_nSpeed != QPointF(0, 0)) {QPointF delta = posF - p0;posF -= m_nSpeed * (delta.x() * m_nSpeed.x() + delta.y() * m_nSpeed.y());- if (m_handle == FunctionPanel::SpeedIn && posF.x() > p0.x() || m_handle == FunctionPanel::SpeedOut && posF.x() < p0.x())+ if ((m_handle == FunctionPanel::SpeedIn && posF.x() > p0.x()) || (m_handle == FunctionPanel::SpeedOut && posF.x() < p0.x()))posF = p0;} else {- if (m_handle == FunctionPanel::SpeedIn && posF.x() > p0.x() || m_handle == FunctionPanel::SpeedOut && posF.x() < p0.x())+ if ((m_handle == FunctionPanel::SpeedIn && posF.x() > p0.x()) || (m_handle == FunctionPanel::SpeedOut && posF.x() < p0.x()))posF.setX(p0.x());}diff --git a/toonz/sources/toonzqt/functionselection.cpp b/toonz/sources/toonzqt/functionselection.cppindex 284150421..da71db186 100644--- a/toonz/sources/toonzqt/functionselection.cpp+++ b/toonz/sources/toonzqt/functionselection.cpp@@ -590,8 +590,8 @@ void FunctionSelection::doCut()if (i + 1 < n && kk.contains(i + 1) && !cellsSelection)delta += curve->keyframeIndexToFrame(i) - curve->keyframeIndexToFrame(i + 1);} else {- if (cellsSelection && bottomRow <= curve->keyframeIndexToFrame(i) ||- !cellsSelection && delta != 0)+ if ((cellsSelection && bottomRow <= curve->keyframeIndexToFrame(i)) ||+ (!cellsSelection && delta != 0))moveUndo->addMovement(curve, j, delta);j++;}