diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-07-02 20:27:52 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-07-02 20:27:52 +0400 |
commit | 5a516098fcddf8d7a59fb06ddb43c1863d4233eb (patch) | |
tree | 15590764d5d7a32ef0e9799ee8aa124883dda4dc /release | |
parent | 123f95e43742cec5c543ec11d301fe23c8932815 (diff) |
Fixed cap shaders that failed with zero length strokes.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/freestyle/style_modules/parameter_editor.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/release/scripts/freestyle/style_modules/parameter_editor.py b/release/scripts/freestyle/style_modules/parameter_editor.py index 22f8bc7beaa..3a52329ca74 100644 --- a/release/scripts/freestyle/style_modules/parameter_editor.py +++ b/release/scripts/freestyle/style_modules/parameter_editor.py @@ -333,8 +333,13 @@ class WithinImageBorderUP1D(UnaryPredicate1D): def iter_stroke_vertices(stroke): it = stroke.strokeVerticesBegin() + prev_p = None while not it.isEnd(): - yield it.getObject() + sv = it.getObject() + p = sv.getPoint() + if prev_p is None or (prev_p - p).length > 1e-6: + yield sv + prev_p = p it.increment() class RoundCapShader(StrokeShader): @@ -346,6 +351,8 @@ class RoundCapShader(StrokeShader): buffer = [] for sv in iter_stroke_vertices(stroke): buffer.append((sv.getPoint(), sv.attribute())) + if len(buffer) < 2: + return # calculate the number of additional vertices to form caps R, L = stroke[0].attribute().getThicknessRL() caplen_beg = (R + L) / 2.0 @@ -394,6 +401,8 @@ class SquareCapShader(StrokeShader): buffer = [] for sv in iter_stroke_vertices(stroke): buffer.append((sv.getPoint(), sv.attribute())) + if len(buffer) < 2: + return # calculate the number of additional vertices to form caps R, L = stroke[0].attribute().getThicknessRL() caplen_beg = (R + L) / 2.0 |