[Bf-blender-cvs] [78f13ee46cc] blender2.8: UI: use "none" icon if loading fails

Campbell Barton noreply at git.blender.org
Mon Apr 30 13:58:05 CEST 2018


Commit: 78f13ee46cc94f541c23546531936a15bcbb3a93
Author: Campbell Barton
Date:   Mon Apr 30 13:55:15 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB78f13ee46cc94f541c23546531936a15bcbb3a93

UI: use "none" icon if loading fails

Workaround for issues w/ two column layout when icons are missing.

Also fix reloading icons when some values aren't valid.

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

M	release/scripts/startup/bl_ui/space_toolsystem_common.py

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

diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index 1ae9a15b6a3..f81a040efe7 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -31,7 +31,8 @@ __all__ = (
 if "_icon_cache" in locals():
     release = bpy.app.icons.release
     for icon_value in _icon_cache.values():
-        release(icon_value)
+        if icon_value != 0:
+            release(icon_value)
     del release
 
 
@@ -161,7 +162,11 @@ class ToolSelectPanelHelper:
                         print("Missing icons:", filename, ex)
                     else:
                         print("Corrupt icon:", filename, ex)
-                    icon_value = 0
+                    # Use none as a fallback (avoids layout issues).
+                    if icon_name != "none":
+                        icon_value = ToolSelectPanelHelper._icon_value_from_icon_handle("none")
+                    else:
+                        icon_value = 0
                 _icon_cache[icon_name] = icon_value
             return icon_value
         else:



More information about the Bf-blender-cvs mailing list