Using Custom Icon Button for Addons

Is it possible to load/insert custom icons w/Python into my own addon without having to recompile Blender?

I am preferably looking for the quickest and easiest way to do this.

1 Like

I don’t think so, there is no mention in the API of this…

Well, then how do addon developers do it. Hard-Ops and BoxCutter all have custom icons in their add-ons?

Of course this is possible. Here is the api:

And you even have the template example bundled with blender.


But that link is just for previewing images.
What about hooking it up to an operator in a button?

No this is for operator too where you can use your custom icon.
layout.operator(“scene.my_op”, icon_value=my_icon.icon_id)

Okay… I will try it out.

Did you finally make it work?

Check out T78630 and T64628, they contain an example that can help you.
And of course, why not just see how this is done in the above mentioned Hard-Ops and BoxCutter.

1 Like

Is this a reply to my question? If yes, what is T78630 and T64628? Thank you for your time!

Not to you personally, but the answer to the topic.

1 Like

Oh okay excuse me, I though you answered to me. :slight_smile:

But if your question is “how to use custom icon button for addons” then these links can help you.
Or if you have an answer, please post it for others for the future.

1 Like

Basically yes, I am looking for how to use custom icons for my addons, but I can’t see how those two links can help me. :slight_smile: They both talk about custom icons that don’t greyout. I haven’t reach that level yet!!! :laughing: I first need to know how I can make them show up…

There are zip archives with code samples, I think this is just what you need.

Perhaps here is a detailed explanation:

1 Like

:open_mouth: I didn’t notice those zip files!!! Well I did like “icon_brightness.blend” script but I get this error: AttributeError: '_RestrictData' object has no attribute 'filepath'. Any idea?

No, it works for me without errors.
But googling this error gives a lot of results…

Can I show you my code?

I don’t think I can do anything else, I don’t understand Python. :slight_smile:

Try asking here

1 Like

Okay!!! Thank you for the links and for your time!!! :slight_smile: