Created by: DolphinDream
Started adding custom icon support.
Currently the implementation expects the icons to be stored in the ui/icons folder and be given in sv_icon_name.png format. An icon filename in this folder is converted/uppercased into icon string ID SV_ICON_NAME, which then can be used in sv modules wherever the nodes/props need to add a custom icon.
As suggested by @zeffii I added support to nodeview_space_menu.py to handle a new bl_icon2 attribute that a custom node can specify to declare a custom icon. These custom icons will be displayed in the search menu. (see commit comments for more details). If a node declares bl_icon attribute, this icon is used in the search menu, otherwise, if bl_icon2 is given, the custom icon is used instead.
Note: there’s no need to specify both bl_icon and bl_icon2, but if bl_icon2 is also specified, it takes precedence over the bl_icon.
class SvMixNumbersNode(bpy.types.Node, SverchCustomTreeNode):
''' Mix Numbers '''
bl_idname = 'SvMixNumbersNode'
bl_label = 'Mix Numbers'
bl_icon2 = ‘SV_MIX_NUMBER'
To add custom icons to various UI properties, this is done by adding the attribute icon_value=customIcon(“CUSTOM_ICON_ID”) to the property:
layout.prop(self, “floatValue”, text=“Float value”, icon_value=customIcon(“SV_FLOAT”))
Of course, to use custom icons in a module you need to include the custom icon module:
from sverchok.ui.sv_icons import customIcon