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:
@@ -118,7 +118,7 @@ class ToolSelectPanelHelper:
|
|||||||
icon_value = _icon_cache.get(icon_name)
|
icon_value = _icon_cache.get(icon_name)
|
||||||
if icon_value is None:
|
if icon_value is None:
|
||||||
dirname = bpy.utils.resource_path('LOCAL')
|
dirname = bpy.utils.resource_path('LOCAL')
|
||||||
if not dirname:
|
if not os.path.exists(dirname):
|
||||||
# TODO(campbell): use a better way of finding datafiles.
|
# TODO(campbell): use a better way of finding datafiles.
|
||||||
dirname = bpy.utils.resource_path('SYSTEM')
|
dirname = bpy.utils.resource_path('SYSTEM')
|
||||||
filename = os.path.join(dirname, "datafiles", "icons", icon_name + ".dat")
|
filename = os.path.join(dirname, "datafiles", "icons", icon_name + ".dat")
|
||||||
|
|||||||
Reference in New Issue
Block a user