Page MenuHome

WorkSpaceTool bl_icon trouble
Open, Confirmed, MediumPublic

Description

System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce GTX 1050 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 388.13

Blender Version
Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: rBf6cb5f54494e
Worked: (optional)

Short description of error
So. I create WorkSpaceTool class with my custom icon and register it. If I install the addon with this tool from zip file, icon moved to addon directory (C:\Users\Username\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\MyAddonName\icons\ops.generic.toolname.dat). But in the toolbar I have "None" icon. Ok, before calling

bpy.utils.register_tool

I use next lines:

frpath = os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
                      "PathTool", "icons", "ops.generic.toolname.dat")
path = os.path.split(bpy.app.binary_path)[0]
pathto = os.path.join(path, "2.80", "datafiles", "icons", "ops.generic.toolname.dat")

if os.path.isfile(frpath) and (not os.path.isfile(pathto)):
    try:
        copyfile(frpath, pathto)
    except:
        print("Icon file not copied!")

to move icon to C:\Program Files\Blender Foundation\Blender\2.80\datafiles\icons. This operation can be done only if start Blender as administrator.
But why I can't search icon directly in the adon directory? Why user whu install my addon need to move one file by hands?

Details

Type
To Do

Related Objects

Event Timeline

Ivan (vanyOk) updated the task description. (Show Details)
Ivan (vanyOk) added a project: Add-ons.
Ivan (vanyOk) changed Type from Bug to To Do.
Philipp Oeser (lichtwerk) triaged this task as Confirmed, Medium priority.

This is true, since the toolsystem always uses bpy.utils.system_resource('DATAFILES', "icons"), see _icon_value_from_icon_handle.

Since you already changed this from bug to TODO, I would kindly ask @Campbell Barton (campbellbarton) about the design of this: how are addons supposed to provide their tool icons bundled? I think we can confirm this [I expect lots of addons wanting to do this]?
Should this be put on https://developer.blender.org/T63733?

Ok, thank you for feedback. I'm waiting