Improve editing a spline path through control points for locked angles.
When a user locks one segment of a spline path, the neighboring segment must not be able to override it.
This commit is contained in:
parent
92028ddbc4
commit
b15a11dac2
|
@ -1,6 +1,7 @@
|
||||||
# Version 0.7.37 (unreleased)
|
# Version 0.7.37 (unreleased)
|
||||||
- Fix Tape crash on Mac OS X.
|
- Fix Tape crash on Mac OS X.
|
||||||
- Fix issue in VAbstractCurve::CurveIntersectAxis.
|
- Fix issue in VAbstractCurve::CurveIntersectAxis.
|
||||||
|
- Improve editing a spline path through control points for locked angles.
|
||||||
|
|
||||||
# Version 0.7.36 October 24, 2020
|
# Version 0.7.36 October 24, 2020
|
||||||
- [#892] Show tooltip for piece node point.
|
- [#892] Show tooltip for piece node point.
|
||||||
|
|
|
@ -111,14 +111,38 @@ VToolSplinePath::VToolSplinePath(const VToolSplinePathInitData &initData, QGraph
|
||||||
{
|
{
|
||||||
const VSpline spl = splPath->GetSpline(i);
|
const VSpline spl = splPath->GetSpline(i);
|
||||||
|
|
||||||
const bool freeAngle1 = qmu::QmuTokenParser::IsSingle(spl.GetStartAngleFormula());
|
bool freeAngle1 = true;
|
||||||
|
|
||||||
|
if (i > 1)
|
||||||
|
{
|
||||||
|
const VSpline prevSpl = splPath->GetSpline(i-1);
|
||||||
|
freeAngle1 = qmu::QmuTokenParser::IsSingle(spl.GetStartAngleFormula()) &&
|
||||||
|
qmu::QmuTokenParser::IsSingle(prevSpl.GetEndAngleFormula());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
freeAngle1 = qmu::QmuTokenParser::IsSingle(spl.GetStartAngleFormula());
|
||||||
|
}
|
||||||
|
|
||||||
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl.GetC1LengthFormula());
|
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl.GetC1LengthFormula());
|
||||||
|
|
||||||
auto *controlPoint = new VControlPointSpline(i, SplinePointPosition::FirstPoint,
|
auto *controlPoint = new VControlPointSpline(i, SplinePointPosition::FirstPoint,
|
||||||
static_cast<QPointF>(spl.GetP2()), freeAngle1, freeLength1, this);
|
static_cast<QPointF>(spl.GetP2()), freeAngle1, freeLength1, this);
|
||||||
InitControlPoint(controlPoint);
|
InitControlPoint(controlPoint);
|
||||||
|
|
||||||
const bool freeAngle2 = qmu::QmuTokenParser::IsSingle(spl.GetEndAngleFormula());
|
bool freeAngle2 = true;
|
||||||
|
|
||||||
|
if (i < splPath->CountSubSpl())
|
||||||
|
{
|
||||||
|
const VSpline nextSpl = splPath->GetSpline(i+1);
|
||||||
|
freeAngle2 = qmu::QmuTokenParser::IsSingle(nextSpl.GetStartAngleFormula()) &&
|
||||||
|
qmu::QmuTokenParser::IsSingle(spl.GetEndAngleFormula());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
freeAngle2 = qmu::QmuTokenParser::IsSingle(spl.GetEndAngleFormula());
|
||||||
|
}
|
||||||
|
|
||||||
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl.GetC2LengthFormula());
|
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl.GetC2LengthFormula());
|
||||||
|
|
||||||
controlPoint = new VControlPointSpline(i, SplinePointPosition::LastPoint, static_cast<QPointF>(spl.GetP3()),
|
controlPoint = new VControlPointSpline(i, SplinePointPosition::LastPoint, static_cast<QPointF>(spl.GetP3()),
|
||||||
|
@ -325,12 +349,39 @@ void VToolSplinePath::UpdateControlPoints(const VSpline &spl, QSharedPointer<VSp
|
||||||
qint32 indexSpline) const
|
qint32 indexSpline) const
|
||||||
{
|
{
|
||||||
VSplinePoint p = splPath->GetSplinePoint(indexSpline, SplinePointPosition::FirstPoint);
|
VSplinePoint p = splPath->GetSplinePoint(indexSpline, SplinePointPosition::FirstPoint);
|
||||||
|
|
||||||
|
if (indexSpline >1)
|
||||||
|
{
|
||||||
|
VSpline prevSpline = splPath->GetSpline(indexSpline-1);
|
||||||
|
if (qmu::QmuTokenParser::IsSingle(prevSpline.GetEndAngleFormula()))
|
||||||
|
{
|
||||||
|
p.SetAngle1(spl.GetEndAngle(), spl.GetEndAngleFormula());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
p.SetAngle2(spl.GetStartAngle(), spl.GetStartAngleFormula());
|
p.SetAngle2(spl.GetStartAngle(), spl.GetStartAngleFormula());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
p.SetLength2(spl.GetC1Length(), spl.GetC1LengthFormula());
|
p.SetLength2(spl.GetC1Length(), spl.GetC1LengthFormula());
|
||||||
splPath->UpdatePoint(indexSpline, SplinePointPosition::FirstPoint, p);
|
splPath->UpdatePoint(indexSpline, SplinePointPosition::FirstPoint, p);
|
||||||
|
|
||||||
p = splPath->GetSplinePoint(indexSpline, SplinePointPosition::LastPoint);
|
p = splPath->GetSplinePoint(indexSpline, SplinePointPosition::LastPoint);
|
||||||
|
|
||||||
|
if (indexSpline < splPath->CountSubSpl())
|
||||||
|
{
|
||||||
|
VSpline nextSpline = splPath->GetSpline(indexSpline+1);
|
||||||
|
if (qmu::QmuTokenParser::IsSingle(nextSpline.GetStartAngleFormula()))
|
||||||
|
{
|
||||||
p.SetAngle1(spl.GetEndAngle(), spl.GetEndAngleFormula());
|
p.SetAngle1(spl.GetEndAngle(), spl.GetEndAngleFormula());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p.SetAngle1(spl.GetEndAngle(), spl.GetEndAngleFormula());
|
||||||
|
}
|
||||||
|
|
||||||
p.SetLength1(spl.GetC2Length(), spl.GetC2LengthFormula());
|
p.SetLength1(spl.GetC2Length(), spl.GetC2LengthFormula());
|
||||||
splPath->UpdatePoint(indexSpline, SplinePointPosition::LastPoint, p);
|
splPath->UpdatePoint(indexSpline, SplinePointPosition::LastPoint, p);
|
||||||
}
|
}
|
||||||
|
@ -732,7 +783,19 @@ void VToolSplinePath::RefreshCtrlPoints()
|
||||||
const auto spl = splPath->GetSpline(i);
|
const auto spl = splPath->GetSpline(i);
|
||||||
|
|
||||||
{
|
{
|
||||||
const bool freeAngle1 = qmu::QmuTokenParser::IsSingle(spl.GetStartAngleFormula());
|
bool freeAngle1 = true;
|
||||||
|
|
||||||
|
if (i > 1)
|
||||||
|
{
|
||||||
|
const VSpline prevSpl = splPath->GetSpline(i-1);
|
||||||
|
freeAngle1 = qmu::QmuTokenParser::IsSingle(spl.GetStartAngleFormula()) &&
|
||||||
|
qmu::QmuTokenParser::IsSingle(prevSpl.GetEndAngleFormula());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
freeAngle1 = qmu::QmuTokenParser::IsSingle(spl.GetStartAngleFormula());
|
||||||
|
}
|
||||||
|
|
||||||
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl.GetC1LengthFormula());
|
const bool freeLength1 = qmu::QmuTokenParser::IsSingle(spl.GetC1LengthFormula());
|
||||||
|
|
||||||
const auto splinePoint = spl.GetP1();
|
const auto splinePoint = spl.GetP1();
|
||||||
|
@ -741,7 +804,19 @@ void VToolSplinePath::RefreshCtrlPoints()
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const bool freeAngle2 = qmu::QmuTokenParser::IsSingle(spl.GetEndAngleFormula());
|
bool freeAngle2 = true;
|
||||||
|
|
||||||
|
if (i < splPath->CountSubSpl())
|
||||||
|
{
|
||||||
|
const VSpline nextSpl = splPath->GetSpline(i+1);
|
||||||
|
freeAngle2 = qmu::QmuTokenParser::IsSingle(nextSpl.GetStartAngleFormula()) &&
|
||||||
|
qmu::QmuTokenParser::IsSingle(spl.GetEndAngleFormula());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
freeAngle2 = qmu::QmuTokenParser::IsSingle(spl.GetEndAngleFormula());
|
||||||
|
}
|
||||||
|
|
||||||
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl.GetC2LengthFormula());
|
const bool freeLength2 = qmu::QmuTokenParser::IsSingle(spl.GetC2LengthFormula());
|
||||||
|
|
||||||
const auto splinePoint = spl.GetP4();
|
const auto splinePoint = spl.GetP4();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user