Page MenuHome

improved sapling tree generator (Release Ahoy)
Closed, ResolvedPublic


Improved Sapling Tree Generator

new version of the sapling tree generator

version numbers and file names could be changed if needed
(right now everything has a '3' on the end to differentiate it from the original version)



Event Timeline

Aaron (Abpy) updated the task description. (Show Details)
Aaron (Abpy) raised the priority of this task from to Needs Triage by Developer.
Aaron (Abpy) added a project: Addons.
Aaron (Abpy) set Type to Patch.
Aaron (Abpy) added a subscriber: Aaron (Abpy).
Brendon Murphy (meta-androcto) triaged this task as Normal priority.Oct 22 2015, 2:45 AM

hi, this is a great update & it's wonderful to have a new maintainer for this addon.

Brendon Murphy (meta-androcto) raised the priority of this task from Normal to Confirmed, Medium.Oct 22 2015, 2:46 AM

I cant seem to install the addon it never appears after installing it, I tried with overwrite both on and off and did not change anything

Aaron (Abpy) to let your addon live together the official one, and considering that I store all non-official addons like your inside the ...\scripts\addons_extern folder (as it was available in the past, patching the file, I modified the file of your addon at line 93 and 792 respectively as follows:

presetpath = os.path.join(p, 'addons_extern', 'add_curve_sapling_3', 'presets')

self.layout.operator(AddTree.bl_idname, text="Add Tree 3.1", icon='PLUGIN') #To distinguish between the two

It would be nice if the script would be directory agnostic instead of hardcoding it's inside the \addons one. I forgot to tell you that I use only the zipped version of Blender.

Anyway, your script works fine to me at a first sight, and if it's planned to replace the old one then just disregard what I wrote previously.

@Riccardo Giovanetti (harvester),
hi, yes the plan is to replace original sapling with the new version. It's interesting that you use addons extern still. I also use this folder extensively for my addons repo. However, most users will fail at this & it's not a recommended action to take.

@Aaron Carlisle (Blendify), try to manually install the addon, you will need to add the folder add_curve_sapling_3 into the addons folder.

@Aaron (Abpy), hello & welcome, it might make it easier for people testing if you have only the add_curve_sapling_3 addon folder in your zip file. If you could list some of the changes (improved branching algo, new presets, usability improvements) it would be good too. I'll test out the presets & remake the existing presets as close as I can soon.


@Aaron (Abpy) It will be helpful if you create a differential that way it will be easier to review the code. I got the addon to install finally, I think your file structure is confusing Blender. After a little bit of testing I got a crash of the addon when trying to change the trunk height. To reproduce this I used try to drag the truck height to a value of 1 or more. Trace back

Traceback (most recent call last):
  File "C:\Users\Aaron\Downloads\Blender\blender-2.76-85072eb-win64\Blender-2.76.0-git.85072eb-AMD64\2.76\scripts\addons\add_curve_sapling_3\", line 779, in execute
  File "C:\Users\Aaron\Downloads\Blender\blender-2.76-85072eb-win64\Blender-2.76.0-git.85072eb-AMD64\2.76\scripts\addons\add_curve_sapling_3\", line 1321, in addTree
    useOldDownAngle, useParentAngle)
  File "C:\Users\Aaron\Downloads\Blender\blender-2.76-85072eb-win64\Blender-2.76.0-git.85072eb-AMD64\2.76\scripts\addons\add_curve_sapling_3\", line 844, in fabricate_stems
    downV = -downAngleV[n] * (1 - (1 - p.offset) / (1 - baseSize)) #(110, 80) = (60, -50)
ZeroDivisionError: float division by zero

location: <unknown location>:-1

Another issue is the F6 menu does not work correctly with the addon

hi, I don't know what the best way to do the paths is. It may depend on where its installed. So if someone knows the right way, it can be changed.

Remove the two documents in the first folder rename the zip to add_curve_sapling_3 don't have the next improved-sapling-tree-generator-master folder and delete the the license and other document. This worked for me. Here is what it should look like with these changes:

Oh!, I didn't realize I zipped the whole thing, sorry, yea that stuff wasn't supposed to be there.

Another feature that would be helpful is an update armature button, that way you only have to update the armature once when doing edits and changing different armature settings.

@Aaron Carlisle (Blendify), I'll confirm the float division by zero error. Whilst your armature suggestion is valid, it's also workflow related. The order of the settings directly relates to the order that tasks should be completed in.

@Aaron (Abpy), With the float division by zero error on trunk height, check commits on sapling, it rings a bell that we have fixed similar error already,
There's an issue with armatures & animation, in my test on a fairly heavy tree the armature had not collected all verts causing artifacts. (possibly wrong verts attached to wrong armature due to the heavy tree), maybe some limitations need to apply here as it was quite a heavy mesh & slowed my fast computer to unusable. (unable to playback animation in viewport.)
Also there still exists (same as Sapling) an issue with pruning & armatures. Possibly a button to apply pruning would solve this. (unable to add armature to pruned tree)

A note also, please try to work on the addon using builds from buildbot this way the addon is prepared for the next release as api changes occur during this time. most serious testers will be using these builds.


Armatures are limited in a few ways:
1, doesn't work with with auto curve handles or intersecting branches because of bone envelopes.
2, doesn't work with pruning, this should be fixable

Heres the latest version with trunk height fixed:

Hi Brendon. Yes, I have very good reasons to still use \addons_extern, which are to keep in sync the \addons and \addons_contrib with the GIT repositories, and because from day one I discovered Blender four years ago I've NEVER installed it but always used the zipped version, which works perfectly, and it's out of control by Windows OS and its user rights management.

Therefore, I'm not relying on the local user C:\Users\USERNAME\AppData\Roaming\Blender Foundation\Blender folder but instead I isolate Blender adding four folders inside it: \autosave, \cache, \config and \temp. This means that I simply need to create a \2.7x tree directory structure somewhere with all the "other stuff" I want inside it, including the \scripts\addons_extern folder and when I unzip a new version of Blender I "simply" copy over my custom content (including those four folders above mentioned and a customized file).

The good thing about open source projects like Blender is that I have access to all the files' content in plain text and I can read them ... because I'm too curious and I want to understand. Therefore, the reason the "normal" user fails on using the \addons_extern is because they leave to Windows the control of the installation or are afraid to change anything inside Blender. I'm not and I love this freedom.

This is the customized file I use (double checking every time if anything has been changed in the original one to keep it consistent, comparing them with Notepad++) and only two lines have to be added/modified: 58 and 162.

Brendon Murphy (meta-androcto) lowered the priority of this task from Confirmed, Medium to Normal.Mar 5 2016, 5:39 AM

no activity here, changing to Normal priority.
there's enough time spent on this seemingly simple upgrade already.

Ok, so what do I still need to do. Do you want to use the most recent version from the github? Also should the preset bug be fixed first in master? Maybe I could provide a diff.

Hi @Aaron (Abpy) I would like to see the preset bug fixed in your file & yes will use the most recent version from your github. I*'ve spoken to @Andrew Hale (trumanblending) & he's happy your updating.
One interesting thing may be worth adding is: In Edit mode the Merge Bones Alt/M could be useful with the Sapling Armature I have used/tested this & it works very well. My workflow was create tree, add armature, animate, merge bones & the animation was still intact, not as precise but working with very few bones. might be worth a try.
Thanks for your help here.

hi, i've been testing your sapling addon again & have been very pleased. I'm happy to commit to blender asap, just a couple of small things.
maybe 1 or 2 lines too long in utils
really would like a way to apply then delete the prune "envelope" object. (from a user perspective it's bad to set up your prune & try to rig & have failure)

That's it, hope your well.

Note: I wouldn't be concerned with feature requests at this stage, rather have stable improved code sooner, As it stands it's a comprehensive addon.

Edit: If pruning operator (menu element) is above the armature the menu workflow is better. In fact the pruning works on the armature. It only appears to fail (create a single line of bones) when the pruning reaches a certain threshold. It's easy to see once the workflow is create armature first, then go to pruning & adjust the levels. Quite cool really but quite touchy too, taking only small variables.

So that's pretty good, I can fix the smaller issues, a way to delete or apply the pruning object "envelope" would still be good, but not needed for this to proceed.

Hi, I've updated the Sapling Addon to fix issues.
My fixes on top of @Aaron (Abpy)
Clean up whitespace,
Fix long line lengths.
File renaming.
Fix Armature, Tree location generation to 0,0,0 (this was causing fails with armature weights & probably pruning)
Move Animation UI to own ui section.
Organize ui so it works in a linear fashion. (Each menu used consecutively builds the tree & leaves & armature, then Pruning & Animation.)


Tests welcome, will commit in a few days if no-one objects.

hi, I've tested your version and heres what I found.
Armatures and pruning still do not work in 2.76 or 2.77.
I don't think there is any change to attractup.
I like armature and animation in separate panels, I was starting to get too crowded.
I think the prune settings should be after branch growth and before leaves, because pruning is applied to the branches, then leaves and armature are applied to the resulting tree.

@Aaron (Abpy)
Thanks for input, I made your suggested changes It works well & less error prone for sure.
I was comparing the "willow" preset from the original sapling, to see if it can be recreated in your version, It looked like attractup & changes to vertical attraction, but might be just how the new algo handles them, we move on from that.
One final code suggestion: Is it possible to put in some error checks? As you said Armatures and pruning still do not work in 2.76 or 2.77., at least not well. Is there a way to warn user of potential errors & stop them?
That said, overall there's a great improvement in functionality, reduction in errors & I think it's worth making the change now to get feedback.

Lastly, did you have any presets you wanted to include? There have been requests for Pine & Fir. If you have any, send here within next 2 days please so we can commit this.

Thanks very much, I'll do a release ahoy for this addon now & change priority.


Note: This update breaks backwards compatibility with current presets, they may still be used but results will vary from original.

Brendon Murphy (meta-androcto) renamed this task from improved sapling tree generator to improved sapling tree generator (Release Ahoy).Apr 26 2016, 7:38 AM
Brendon Murphy (meta-androcto) updated the task description. (Show Details)
Brendon Murphy (meta-androcto) raised the priority of this task from Normal to Confirmed, High.

Ok, looks good.
Just 1 little change 'Fast Preview' should be in the animation panel.

Heres the presets I would like to add including my own japanese maple to replace the current one.

@Aaron (Abpy)
Added your change & small ui change in animation.
Added your latest commit from here:
Added Presets.

Are you going to update your git to match this version?

Note: found small issue, In Leaves dupli object if there's no object available for the menu it adds a warning to the console:
RNA Warning: Current value "0" matches no enum in 'CURVE_OT_tree_add', '(Null)', 'leafDupliObj'
this seems harmless, but maybe a better way to handle?
Thanks for patience & hard work

I adjusted the settings and changed the name of some presets:
("Weeping" to replace "")

I will probably maintain my own version separately.

Committed: rBAc3a6d9132a44afd254fa120157c66e72b751e6f1

@Aaron (Abpy) Thanks again, If you have any future updates please start a new Task, I'll look at your repo regularly, but best if you can periodically send your updates here.
If you would like access to commit directly to Blender Addons please send a request Attention: Ideasman42 to
"Hi, I'm the new developer of sapling, I would like commit access to Blender addons repo." will be enough to get the ball rolling.

Closing as resolved.

HI, I've just answered a question on BSE about this addon, about the origin being always 0,0,0 instead of the current 3d cursor location.

I've read the comment above stating that about "location generation to 0,0,0 (this was causing fails with armature weights & probably pruning)" and I thought that if there is no better solution, maybe you could store the initial 3d cursor location, then generate all at 0,0,0 and finally translate the completed object at the save location...

Is it possible to make the sapling settings not be in the recently used tools panel, is it very easy to unintentionally do any other action and lose the configuration panel?. Is there a possibility that the trunks have uvs and/or textures?

In my work we have ruled out using sapling for those two reasons alone. I think it would be ideal to be able to solve them.

Thank you.