[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2240] trunk/py/scripts/addons/ add_curve_sapling/utils.py: Fixed a memory access issue on OSX due to getting bezier point' s coordinates after a new point was added to the spline.
Andrew Hale
TrumanBlending at gmail.com
Wed Aug 10 12:13:23 CEST 2011
Revision: 2240
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2240
Author: trumanblending
Date: 2011-08-10 10:13:22 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
Fixed a memory access issue on OSX due to getting bezier point's coordinates after a new point was added to the spline. This caused corruption of the tree model.
Modified Paths:
--------------
trunk/py/scripts/addons/add_curve_sapling/utils.py
Modified: trunk/py/scripts/addons/add_curve_sapling/utils.py
===================================================================
--- trunk/py/scripts/addons/add_curve_sapling/utils.py 2011-08-09 13:47:42 UTC (rev 2239)
+++ trunk/py/scripts/addons/add_curve_sapling/utils.py 2011-08-10 10:13:22 UTC (rev 2240)
@@ -266,10 +266,14 @@
# Make the growth vec the length of a stem segment
dirVec.normalize()
dirVec *= stem.segL
+
+ # Get the end point position
+ end_co = stem.p.co.copy()
+
# Add the new point and adjust its coords, handles and radius
newSpline.bezier_points.add()
newPoint = newSpline.bezier_points[-1]
- (newPoint.co,newPoint.handle_left_type,newPoint.handle_right_type) = (stem.p.co + dirVec,hType,hType)
+ (newPoint.co,newPoint.handle_left_type,newPoint.handle_right_type) = (end_co + dirVec,hType,hType)
newPoint.radius = stem.radS*(1 - (stem.seg + 1)/stem.segMax) + stem.radE*((stem.seg + 1)/stem.segMax)
# If this isn't the last point on a stem, then we need to add it to the list of stems to continue growing
if stem.seg != stem.segMax:
@@ -298,9 +302,13 @@
dirVec.rotate(upRotMat)
dirVec.normalize()
dirVec *= stem.segL
+
+ # Get the end point position
+ end_co = stem.p.co.copy()
+
stem.spline.bezier_points.add()
newPoint = stem.spline.bezier_points[-1]
- (newPoint.co,newPoint.handle_left_type,newPoint.handle_right_type) = (stem.p.co + dirVec,hType,hType)
+ (newPoint.co,newPoint.handle_left_type,newPoint.handle_right_type) = (end_co + dirVec,hType,hType)
newPoint.radius = stem.radS*(1 - (stem.seg + 1)/stem.segMax) + stem.radE*((stem.seg + 1)/stem.segMax)
# There are some cases where a point cannot have handles as VECTOR straight away, set these now.
if numSplit != 0:
More information about the Bf-extensions-cvs
mailing list