Fix T39777: Blender 2.65-2.7 Sapling Bug

Clamp branchL to min 0.0 (negative branch length does not make much sense, and
non-int power of negative numbers gives complex numbers...).
This commit is contained in:
Bastien Montagne 2014-04-18 08:43:34 +02:00
parent c74a03c3eb
commit b5e7aac94f
Notes: blender-bot 2023-02-14 20:08:39 +01:00
Referenced by issue #39777, Blender 2.65-2.7 Sapling Bug
2 changed files with 2 additions and 1 deletions

View File

@ -25,7 +25,7 @@ bl_info = {
"description": ("Adds a parametric tree. The method is presented by "
"Jason Weber & Joseph Penn in their paper 'Creation and Rendering of "
"Realistic Trees'."),
"warning": "length parameters may cause errors", # used for warning icon and text in addons panel
#"warning": "length parameters may cause errors", # used for warning icon and text in addons panel
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Curve/Sapling_Tree",
"tracker_url": "https://developer.blender.org/T27226",

View File

@ -606,6 +606,7 @@ def addTree(props):
childStems = False
else:
childStems = leaves*shapeRatio(leafDist,p.offset/p.lengthPar)
branchL = max(branchL, 0.0)
# Determine the starting and ending radii of the stem using the tapering of the stem
startRad = min(p.radiusPar[0]*((branchL/p.lengthPar)**ratioPower), p.radiusPar[1])
endRad = startRad*(1 - taper[n])