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:
authorCampbell Barton <ideasman42@gmail.com>2021-01-07 05:52:09 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-01-07 05:52:09 +0300
commitcef282cc9acdc1eb4e77d92fa7631f47a47a867c (patch)
tree72279b0a4cbd30e3dbee15b15e9db2f2ca802321
parent4599d5d3c8ae91e958fad44df6d5fb30a2edb680 (diff)
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.
-rw-r--r--add_curve_sapling/__init__.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/add_curve_sapling/__init__.py b/add_curve_sapling/__init__.py
index 9bcd1492..6756797b 100644
--- a/add_curve_sapling/__init__.py
+++ b/add_curve_sapling/__init__.py
@@ -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