Skip to content
Snippets Groups Projects
Commit cef282cc authored by Campbell Barton's avatar Campbell Barton
Browse files

Fix T83360: Tree gen error showing "Leaf Object" enum

Account for limitation in the Python API which needs to keep references
to strings used in an enum.
parent 4599d5d3
No related branches found
Tags
No related merge requests found
...@@ -246,16 +246,21 @@ class AddTree(Operator): ...@@ -246,16 +246,21 @@ class AddTree(Operator):
bl_label = "Sapling: Add Tree" bl_label = "Sapling: Add Tree"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
# Keep the strings in memory, see T83360.
_objectList_static_strings = []
def objectList(self, context): def objectList(self, context):
objects = [] objects = AddTree._objectList_static_strings
bObjects = bpy.data.objects objects.clear()
for obj in bObjects: for obj in bpy.data.objects:
if (obj.type in ['MESH', 'CURVE', 'SURFACE']) and (obj.name not in ['tree', 'leaves']): if (obj.type in {'MESH', 'CURVE', 'SURFACE'}) and (obj.name not in {'tree', 'leaves'}):
objects.append((obj.name, obj.name, "")) objects.append((obj.name, obj.name, ""))
return (objects if objects else if not objects:
[('NONE', "No objects", "No appropriate objects in the Scene")]) objects.append(('NONE', "No objects", "No appropriate objects in the Scene"))
return objects
def update_tree(self, context): def update_tree(self, context):
self.do_update = True self.do_update = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment