From 4c3140004aa61169061ddd2628a4f2c8d88f46a1 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sun, 3 Jul 2011 07:48:19 +0000 Subject: [PATCH] Fixed a bug introduced in the last commit to address the issue of cap shaders. --- .../freestyle/style_modules/parameter_editor.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/release/scripts/freestyle/style_modules/parameter_editor.py b/release/scripts/freestyle/style_modules/parameter_editor.py index 3a52329ca74..d5f9fc4a251 100644 --- a/release/scripts/freestyle/style_modules/parameter_editor.py +++ b/release/scripts/freestyle/style_modules/parameter_editor.py @@ -351,7 +351,8 @@ class RoundCapShader(StrokeShader): buffer = [] for sv in iter_stroke_vertices(stroke): buffer.append((sv.getPoint(), sv.attribute())) - if len(buffer) < 2: + nverts = len(buffer) + if nverts < 2: return # calculate the number of additional vertices to form caps R, L = stroke[0].attribute().getThicknessRL() @@ -360,8 +361,7 @@ class RoundCapShader(StrokeShader): R, L = stroke[-1].attribute().getThicknessRL() caplen_end = (R + L) / 2.0 nverts_end = max(5, int(R + L)) - # increase the total number of stroke vertices - nverts = stroke.strokeVerticesSize() + # adjust the total number of stroke vertices stroke.Resample(nverts + nverts_beg + nverts_end) # restore the location and attribute of the original vertices for i in range(nverts): @@ -401,7 +401,8 @@ class SquareCapShader(StrokeShader): buffer = [] for sv in iter_stroke_vertices(stroke): buffer.append((sv.getPoint(), sv.attribute())) - if len(buffer) < 2: + nverts = len(buffer) + if nverts < 2: return # calculate the number of additional vertices to form caps R, L = stroke[0].attribute().getThicknessRL() @@ -410,8 +411,7 @@ class SquareCapShader(StrokeShader): R, L = stroke[-1].attribute().getThicknessRL() caplen_end = (R + L) / 2.0 nverts_end = 1 - # increase the total number of stroke vertices - nverts = stroke.strokeVerticesSize() + # adjust the total number of stroke vertices stroke.Resample(nverts + nverts_beg + nverts_end) # restore the location and attribute of the original vertices for i in range(nverts):