Dynamic icons uploading for Addons operator!

Hi guys, i’ve recently finished to creating this feature for blender, it’s not a big work but could sound nice for addons developer. Now operators can be drawn with custom icon. Now I’m interested to know, from the blender community if this can be useful or not, if so i’ll submit the patch. It need some bit of fixes, but it’s ready to go!!

So let me hear what you think!!

This is very very useful! there’s a lot of good things that we can do with it. We can open jpg files to or just .ico ?
Cheers

PNG would be my preference for a custom icon format, but having custom icons at all, and without hacks or rebuilds, has been needed in Blender since before the beginning of the universe.

SynaGl0w, if I understand correctly that doesn’t make it possible to choose custom icons. This would be a real tough task, i guess.
rebellion, so this lets you assign icons to operators or the addons itself? Would be nice to have.
Could you upload the code, so I can have a quick look over it?

Lolwut? What did I say about what?

… Right now, custom icons for an addon’s operators and panels is a real hack job. The whole point of custom icons is so I can use my own icons, with my own tools, in my own addons.

I was hoping for this functionality for a long time, and I am very interested.

@vitorbalbio, only png 64x64 works now.

@all: i see some confusion, however to be clear: with my patch you can upload icons via python, just call this bpy.utils.load_icon(path = “”)
this function return an integer pointing to the new icon. The returned value can be used in operator, label, everything that support the keyword icon_value for example: layout.label(“some text”, icon_value = 870). if you read the doc at moment only label and prop support custom icon(material, or texture icon). I’ve also added support for operator.

this is how it could be implemented in python:


icon = bpy.utils.load_icon("path_to_icon")
icon2 = bpy.utils.load_icon("path_to_icon2") 
icon3 = bpy.utils.load_icon("path_to_icon3") 
[...] #some code here

#later when drawing panel, menu, etc...

def draw(self, context):
        layout = self.layout

        scene = context.scene

        layout.label(text=" Simple Row:", icon_value = icon)
        layout.operator("operator_rna", icon_value = icon2)
        layout.prop(scene,prop,icon_value = icon3)

Has i said is not a big hack, since custom icon are already supported, at the moment work only for texture and material icon, now you can use you’r own icon, virtually is possible to customize the entire interface.

There is one big problem, icons can’t be resized… this mean if used in a bad way, create great confusion in the UI, this goes away from the purpose of this patch…

I’m wondering if some blender developer is interested on this… just would like to hear his opinion.

It sounds really useful, do you have a patch available maybe?

Nope, but i can create one, can you tell me how to do it? I see that you are on developer.blender, so do you think should i submit it??

I can already imagine the possibilities. It would be really nice to have something like this. Space management has always been the biggest issue with ui designs for addons. This looks very useful! Thumbs up

I assume you are familiar with git diff already? If yes, you need to register an account on developer.blender.org (anyone can make one) and create a patch by selecting “differential” from the tabs on the left, then there should be a “Create Diff” entry at the upper right of the screen. Use this to either paste the contents of git diff or upload the patch file itself. Add me as a reviewer in the relevant entry (you’ll see what I’m talking about once you create the diff) and we’ll review it there.

Custom icon loading for add-ons is something I’ve been hoping to push via the UI Team for a while now. Please do upload a patch to developer.blender.org

Thumbs up from me, custom icons would be great.

I’ve already added, if you want I’ll add you to CC or reviewer and i would like to hear you’re opinion XD

Please do.

i’ve added you as reviewer, you’r nick is carter2422 right?

Yep! Got it.