[Bf-blender-cvs] [f6dc0e9] master: Minor tweaks to preview templates

Campbell Barton noreply at git.blender.org
Tue May 12 10:29:24 CEST 2015


Commit: f6dc0e918b2687de067f2696b070b77f1a19a00b
Author: Campbell Barton
Date:   Tue May 12 18:28:05 2015 +1000
Branches: master
https://developer.blender.org/rBf6dc0e918b2687de067f2696b070b77f1a19a00b

Minor tweaks to preview templates

===================================================================

M	release/scripts/templates_py/ui_previews_custom_icon.py
M	release/scripts/templates_py/ui_previews_dynamic_enum.py

===================================================================

diff --git a/release/scripts/templates_py/ui_previews_custom_icon.py b/release/scripts/templates_py/ui_previews_custom_icon.py
index 6eb4ad2..53f84b2 100644
--- a/release/scripts/templates_py/ui_previews_custom_icon.py
+++ b/release/scripts/templates_py/ui_previews_custom_icon.py
@@ -31,7 +31,7 @@ class PreviewsExamplePanel(bpy.types.Panel):
         pcoll = preview_collections["main"]
 
         row = layout.row()
-        my_icon = pcoll.get("my_icon")
+        my_icon = pcoll["my_icon"]
         row.operator("render.render", icon_value=my_icon.icon_id)
 
         # my_icon.icon_id can be used in any UI function that accepts
diff --git a/release/scripts/templates_py/ui_previews_dynamic_enum.py b/release/scripts/templates_py/ui_previews_dynamic_enum.py
index 5dda696..5269f7f 100644
--- a/release/scripts/templates_py/ui_previews_dynamic_enum.py
+++ b/release/scripts/templates_py/ui_previews_dynamic_enum.py
@@ -14,7 +14,7 @@
 # For custom icons, see the template "ui_previews_custom_icon.py".
 #
 # For distributable scripts, it is recommended to place the icons inside the
-# addon directory and access it relative to the py script file for portability:
+# script directory and access it relative to the py script file for portability:
 #
 #    os.path.join(os.path.dirname(__file__), "images")
 
@@ -47,11 +47,9 @@ def enum_previews_from_directory_items(self, context):
 
         for i, name in enumerate(image_paths):
             # generates a thumbnail preview for a file.
-            # Also works with previews for 'MOVIE', 'BLEND' and 'FONT'
             filepath = os.path.join(directory, name)
             thumb = pcoll.load(filepath, filepath, 'IMAGE')
-            # enum item: (identifier, name, description, icon, number)
-            enum_items.append((name, name, name, thumb.icon_id, i))
+            enum_items.append((name, name, "", thumb.icon_id, i))
 
     pcoll.my_previews = enum_items
     pcoll.my_previews_dir = directory




More information about the Bf-blender-cvs mailing list