Adding an Image to ThemeUI


#1

OK, so in order to help sort out those that dislike the monochrome icons, I am working on adding an icon sheet to the theme. By enabling designers (& users) to work on/use icons without needing to recompile the application. Brecht has stated that, provided the code is bug free, this is a feature he is willing to merge.

With that said, I’ve been looking at the code and the ThemeUI is a POD structure without pointers or the like, which means I can’t piggy-back the loading/saving of the icon image in the existing read/write userdef functions. At least, not without changing their nature from simple POD read/write to something more.

So I’m looking for some advice on the matter. I personally think the image data should be stored with the rest of the theme colours but that complicates the simple data structures it uses at the moment. If there is a better example to borrow from, I’m willing to use it.


Blender 2.8 user interface design
#2

There is still code remaining from the old icon image loading. It was disabled due to not supporting DPI and different icon resolutions, but can be updated to support that.
https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_icons.c;968bf0df148c6fac7567860a64433daa97d042c9$469

You don’t need to store icons in the ThemeUI code, we generally avoid storing runtime data in DNA structures when possible.


#3

I noticed that code, thanks, but wouldn’t that require the icons to be delivered as a separate file with themes currently being a single one and/or loaded from the “.blend”?

I’m trying to keep the loading/saving/distributing of themes from getting more complicated. I’m happy to store it elsewhere in memory, like the array constants used for icons currently, I just tend to avoid globals if I can avoid it.


#4

I don’t think storing custom icons differently really helps, if the builtin icons are still stored in a global texture. It doesn’t make the code easier to understand or maintain to have two different systems. And I don’t see much wrong with having them as globals, we only want to have one set of icons in memory, otherwise it’s a waste of memory.

I’m not sure delivering the icons embedded in the theme file is ideal. It does make installation easier, but people probably want to choose their own combination of icon and theme anyway, without them being tied together.

If we are concerned about making icons easy to install I suggest to have an “Install Icons…” button next to “Install Theme…”, which can unpack a zip file like we do for addons. The installed icons could then be available a from menu like the regular themes.


#5

Or we could support theme zip files that include icons, and then “Install Theme…” could unpack the theme XML to one directory and the icons to another. If we really want them to be bundled together, though I’m not sure users would want to have their theme colors changed whenever they install icons.


#6

OK, if the plan is to have icons separate to theme (in my mind, they were intimately connected) - I’ll work with that. Thanks brecht.


#7

Well good luck to you. It would be great to have an opportunity to replace default icons, at least with the old ones.