Code

LPEbendpath fix: save widthfactor parameter ofcourse doh!
authorjohanengelen <johanengelen@users.sourceforge.net>
Fri, 23 Nov 2007 23:39:26 +0000 (23:39 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Fri, 23 Nov 2007 23:39:26 +0000 (23:39 +0000)
src/live_effects/lpe-pathalongpath.cpp
src/live_effects/lpe-pathalongpath.h

index e552bdaad7fa5db2d405acf8411ca26ce0122043..100d0428dcd220a4eb6d5f0295b020503b89c4b8 100644 (file)
@@ -64,6 +64,7 @@ LPEPathAlongPath::LPEPathAlongPath(LivePathEffectObject *lpeobject) :
     Effect(lpeobject),\r
     bend_path(_("Bend path"), _("Path along which to bend the original path"), "bendpath", &wr, this, "M0,0 L1,0"),\r
     width_path(_("Width path"), _("..."), "widthpath", &wr, this, "M0,0 L1,0"),\r
+    width_path_range(_("Width path range"), _("Range of widthpath parameter"), "widthpath_range", &wr, this, 1),\r
     copytype(_("Path copies"), _("How many copies to place along the skeleton path"), "copytype", PAPCopyTypeConverter, &wr, this, PAPCT_SINGLE_STRETCHED),\r
     prop_scale(_("Width"), _("Width of the path"), "prop_scale", &wr, this, 1),\r
     scale_y_rel(_("Width in units of length"), _("Scale the width of the path in units of its length"), "scale_y_rel", &wr, this, false),\r
@@ -71,6 +72,7 @@ LPEPathAlongPath::LPEPathAlongPath(LivePathEffectObject *lpeobject) :
 {\r
     registerParameter( dynamic_cast<Parameter *>(&bend_path) );\r
     registerParameter( dynamic_cast<Parameter *>(&width_path) );\r
+    registerParameter( dynamic_cast<Parameter *>(&width_path_range) );\r
     registerParameter( dynamic_cast<Parameter *>(&copytype) );\r
     registerParameter( dynamic_cast<Parameter *>(&prop_scale) );\r
     registerParameter( dynamic_cast<Parameter *>(&scale_y_rel) );\r
@@ -148,7 +150,7 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2
 \r
     Piecewise<D2<SBasis> > widthpwd2 = arc_length_parametrization(Piecewise<D2<SBasis> >(width_path),2,.1);\r
     D2<Piecewise<SBasis> > widthd2pw = make_cuts_independant(widthpwd2);\r
-    Piecewise<SBasis> width = (Piecewise<SBasis>(widthd2pw[Y]) - uskeletonbounds[Y].middle()) * wfactor;\r
+    Piecewise<SBasis> width = (Piecewise<SBasis>(widthd2pw[Y]) - uskeletonbounds[Y].middle()) / width_path_range;\r
 \r
 \r
     double offs = 0;\r
@@ -195,7 +197,7 @@ LPEPathAlongPath::resetDefaults(SPItem * item)
     pathw.appendNew<Geom::LineSegment>( endw );\r
     width_path.param_set_and_write_new_value( pathw.toPwSb() );\r
     \r
-    wfactor = 1/(startw[Y]-start[Y]);\r
+    width_path_range.param_set_value(startw[Y]-start[Y]);\r
 }\r
 \r
 } // namespace LivePathEffect\r
index b75d5e2274b2b0c70bdb86b1a1143f4808a97c5c..915cad8b0aa8613a35c148d2a9790ccf447d8053 100644 (file)
@@ -37,11 +37,11 @@ public:
 private:\r
     PathParam  bend_path;\r
     PathParam  width_path;\r
+    ScalarParam  width_path_range;\r
     EnumParam<PAPCopyType> copytype;\r
     ScalarParam  prop_scale;\r
     BoolParam scale_y_rel;\r
     BoolParam    vertical_pattern;\r
-    double wfactor;\r
 \r
     void on_pattern_pasted();\r
 \r