[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54998] branches/soc-2008-mxcurioni/ release/scripts/freestyle/style_modules/parameter_editor.py: Fix for the Sinus Displacement geometry modifier not working properly.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sun Mar 3 22:56:37 CET 2013


Revision: 54998
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54998
Author:   kjym3
Date:     2013-03-03 21:56:36 +0000 (Sun, 03 Mar 2013)
Log Message:
-----------
Fix for the Sinus Displacement geometry modifier not working properly.
The problem was caused by keeping a reference to a Vector object that is
assumed to be unchanged, but actually altered by the geometry modifier.

The same code updates were made to similar code portions to prevent
possible future bugs.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py	2013-03-03 20:32:27 UTC (rev 54997)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py	2013-03-03 21:56:36 UTC (rev 54998)
@@ -174,11 +174,11 @@
     total = stroke.length_2d
     distance = 0.0
     it = stroke.stroke_vertices_begin()
+    prev = it.object.point
     while not it.is_end:
         p = it.object.point
-        if not it.is_begin:
-            distance += (prev - p).length
-        prev = p
+        distance += (prev - p).length
+        prev = p.copy() # need a copy because the point can be altered
         t = min(distance / total, 1.0)
         yield it, t
         it.increment()
@@ -475,11 +475,11 @@
 def iter_distance_along_stroke(stroke):
     distance = 0.0
     it = stroke.stroke_vertices_begin()
+    prev = it.object.point
     while not it.is_end:
         p = it.object.point
-        if not it.is_begin:
-            distance += (prev - p).length
-        prev = p
+        distance += (prev - p).length
+        prev = p.copy() # need a copy because the point can be altered
         yield it, distance
         it.increment()
 
@@ -658,7 +658,7 @@
         p = sv.point
         if prev_p is None or (prev_p - p).length > 1e-6:
             yield sv
-            prev_p = p
+            prev_p = p.copy()
         it.increment()
 
 class RoundCapShader(StrokeShader):




More information about the Bf-blender-cvs mailing list