Fix missing icons in non-portable local builds.

The problem is that some local path is always returned by
bpy_resource_path. The function does not enforce a check for existence
of the path in the low level code.

Since client code may indeed not care about existence of the directory,
I leave bpy_resource_path alone and patch the python code to check for
existence. An  extra argument that enforces the check might be a better
solution, but I will be leaving this to the UI team.
This commit is contained in:
2018-04-27 17:10:28 +03:00
parent c6d68916ed
commit ca66112b29

View File

@@ -118,7 +118,7 @@ class ToolSelectPanelHelper:
icon_value = _icon_cache.get(icon_name)
if icon_value is None:
dirname = bpy.utils.resource_path('LOCAL')
if not dirname:
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")