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
Branches
Tags
No related merge requests found
......@@ -246,16 +246,21 @@ class AddTree(Operator):
bl_label = "Sapling: Add Tree"
bl_options = {'REGISTER', 'UNDO'}
# Keep the strings in memory, see T83360.
_objectList_static_strings = []
def objectList(self, context):
objects = []
bObjects = bpy.data.objects
objects = AddTree._objectList_static_strings
objects.clear()
for obj in bObjects:
if (obj.type in ['MESH', 'CURVE', 'SURFACE']) and (obj.name not in ['tree', 'leaves']):
for obj in bpy.data.objects:
if (obj.type in {'MESH', 'CURVE', 'SURFACE'}) and (obj.name not in {'tree', 'leaves'}):
objects.append((obj.name, obj.name, ""))
return (objects if objects else
[('NONE', "No objects", "No appropriate objects in the Scene")])
if not objects:
objects.append(('NONE', "No objects", "No appropriate objects in the Scene"))
return objects
def update_tree(self, context):
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