Fix T63775: Toolbar icons ignore BLENDER_SYSTEM_DATAFILES

The environment variable to locate system data-files was
ignored by toolbar icons.

Add bpy.utils.system_resource
to match Blender's internal data-file access.
This commit is contained in:
Campbell Barton
2019-07-23 16:23:56 +10:00
parent 6e72d3e00e
commit 07f3ad06fc
3 changed files with 55 additions and 5 deletions

View File

@@ -195,11 +195,8 @@ class ToolSelectPanelHelper:
assert(type(icon_name) is str)
icon_value = _icon_cache.get(icon_name)
if icon_value is None:
dirname = bpy.utils.resource_path('LOCAL')
if not os.path.exists(dirname):
# TODO(campbell): use a better way of finding datafiles.
dirname = bpy.utils.resource_path('SYSTEM')
filename = os.path.join(dirname, "datafiles", "icons", icon_name + ".dat")
dirname = bpy.utils.system_resource('DATAFILES', "icons")
filename = os.path.join(dirname, icon_name + ".dat")
try:
icon_value = bpy.app.icons.new_triangles_from_file(filename)
except Exception as ex: