diff --git a/toonz/sources/include/tools/modifiers/modifierassistants.h b/toonz/sources/include/tools/modifiers/modifierassistants.h index 8a4fc3d..3dcd35d 100644 --- a/toonz/sources/include/tools/modifiers/modifierassistants.h +++ b/toonz/sources/include/tools/modifiers/modifierassistants.h @@ -45,8 +45,8 @@ private: bool enabledOnly ) const; public: - const bool drawOnly; - const double sensitiveLength; + bool drawOnly; + double sensitiveLength; explicit TModifierAssistants(bool drawOnly = false); diff --git a/toonz/sources/include/tools/modifiers/modifiersegmentation.h b/toonz/sources/include/tools/modifiers/modifiersegmentation.h index 32b18c2..af4278c 100644 --- a/toonz/sources/include/tools/modifiers/modifiersegmentation.h +++ b/toonz/sources/include/tools/modifiers/modifiersegmentation.h @@ -25,16 +25,17 @@ //***************************************************************************************** class DVAPI TModifierSegmentation: public TInputModifier { -public: - const double precision; - const double precisionSqr; - private: + TPointD m_step; + void addSegments(TTrack &track, const TTrackPoint &p0, const TTrackPoint &p1, int level = 0); public: - TModifierSegmentation(double precision = 1.0); + TModifierSegmentation(const TPointD &step = TPointD(1.0, 1.0)); + void setStep(const TPointD &step); + const TPointD& getStep() const { return m_step; } + void modifyTrack( const TTrack &track, const TInputSavePoint::Holder &savePoint, diff --git a/toonz/sources/tnztools/fullcolorbrushtool.cpp b/toonz/sources/tnztools/fullcolorbrushtool.cpp index dc20487..78c5016 100644 --- a/toonz/sources/tnztools/fullcolorbrushtool.cpp +++ b/toonz/sources/tnztools/fullcolorbrushtool.cpp @@ -139,7 +139,7 @@ FullColorBrushTool::FullColorBrushTool(std::string name) m_modifierLine = new TModifierLine(); m_modifierTangents = new TModifierTangents(); m_modifierAssistants = new TModifierAssistants(); - m_modifierSegmentation = new TModifierSegmentation(0.25); + m_modifierSegmentation = new TModifierSegmentation(); m_thickness.setNonLinearSlider(); diff --git a/toonz/sources/tnztools/modifiers/modifiersegmentation.cpp b/toonz/sources/tnztools/modifiers/modifiersegmentation.cpp index ffde794..447c9e4 100644 --- a/toonz/sources/tnztools/modifiers/modifiersegmentation.cpp +++ b/toonz/sources/tnztools/modifiers/modifiersegmentation.cpp @@ -9,10 +9,15 @@ //***************************************************************************************** -TModifierSegmentation::TModifierSegmentation(double precision): - precision(std::max(TConsts::epsilon, precision)), - precisionSqr(std::max(TConsts::epsilon, precision) * std::max(TConsts::epsilon, precision)) -{ } +TModifierSegmentation::TModifierSegmentation(const TPointD &step) + { setStep(step); } + + +void +TModifierSegmentation::setStep(const TPointD &step) { + m_step.x = std::max(TConsts::epsilon, fabs(step.x)); + m_step.y = std::max(TConsts::epsilon, fabs(step.y)); +} void @@ -25,7 +30,7 @@ TModifierSegmentation::addSegments( static const int maxRecursion = 10; TPointD d = p1.position - p0.position; - if (level >= maxRecursion || d.x*d.x + d.y*d.y <= precisionSqr) { + if (level >= maxRecursion || (fabs(d.x) <= m_step.x && fabs(d.y) <= m_step.y)) { track.push_back(p1); return; }