8
$\begingroup$

I have created an add-on but I can't apply my own icon to the operators in this add-on.

Is there any easy way to implement this?

Or do I need to add the icon to an SVG file?

$\endgroup$
6
$\begingroup$

You can only use already available icons, too see which are available enable the Icons add-on. A panel with all icons will be displayed in the text editor properties (or python console). The name of the icons is shown in a tooltip.

You can use the icon attribute like:

row = layout.column(align=True)
row.operator('id_name', icon='QUESTION')

enter image description here

Custom icons require compilation which is off-topic here but you could find a discussion on custom icons at this BA thread.

Possibly outdated information on how to integrate custom icons you find in the Wiki. There is descibed that all icons are stored in a single .png file which explains that you can't use SVG or any other format.

$\endgroup$
2
$\begingroup$

If your addon draws using opengl (via the bgl module) you can draw your own images directly, however this is not accessible while drawing typical buttons & layouts.

You can however do this from: (http://www.blender.org/documentation/blender_python_api_2_69_release/bpy.types.Space.html?highlight=draw_handler_add#bpy.types.Space.draw_handler_add) unfortunatly using these callbacks is currently undocumented but you can see examples in scripts distributed with blender.

$\endgroup$
  • $\begingroup$ Very useful link but I'm still searching the Examples for That 'Space type' script $\endgroup$ – Rasa Mohamed Dec 17 '13 at 4:16
  • $\begingroup$ Math Vis addon is one, though it draws mostly in 3d space (except for text). $\endgroup$ – ideasman42 Dec 17 '13 at 5:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.