Fix T63504: Python Template 'ui_previews_dynamic_enum' error

thx @nacioss for the fix
This commit is contained in:
Philipp Oeser 2019-04-12 14:00:57 +02:00
parent a96d42b2e8
commit f3fc8271b8
Notes: blender-bot 2023-02-14 19:16:39 +01:00
Referenced by issue blender/blender-addons#63504, Python Template demo script error
1 changed files with 5 additions and 1 deletions

View File

@ -51,7 +51,11 @@ def enum_previews_from_directory_items(self, context):
for i, name in enumerate(image_paths):
# generates a thumbnail preview for a file.
filepath = os.path.join(directory, name)
thumb = pcoll.load(filepath, filepath, 'IMAGE')
icon = pcoll.get(name)
if not icon:
thumb = pcoll.load(name, filepath, 'IMAGE')
else:
thumb = pcoll[name]
enum_items.append((name, name, "", thumb.icon_id, i))
pcoll.my_previews = enum_items