Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Hale <TrumanBlending@gmail.com>2011-08-10 14:13:22 +0400
committerAndrew Hale <TrumanBlending@gmail.com>2011-08-10 14:13:22 +0400
commitaed108d4a328dd25c3ca360cc9702c6a2d3a9bd5 (patch)
treebafc2ac0b4474161c8c7be161b9df22d7c4aa213 /add_curve_sapling/utils.py
parentd90c4808f6d282ab6bbd34a1d0fb08608250b0a9 (diff)
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.
Diffstat (limited to 'add_curve_sapling/utils.py')
-rw-r--r--add_curve_sapling/utils.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/add_curve_sapling/utils.py b/add_curve_sapling/utils.py
index 59b79219..14401a02 100644
--- a/add_curve_sapling/utils.py
+++ b/add_curve_sapling/utils.py
@@ -266,10 +266,14 @@ def growSpline(stem,numSplit,splitAng,splitAngV,splineList,attractUp,hType,splin
# 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 @@ def growSpline(stem,numSplit,splitAng,splitAngV,splineList,attractUp,hType,splin
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: