Dynamic icon file loading and themeability #5334

Closed
opened 2006-12-01 01:35:01 +01:00 by Matt Ebb · 6 comments
Member

%%%This patch allows icon files (.png) to be loaded into Blender dynamically, without having to go through the tedious and technical process of compiling them in. It also makes them part of the theme settings so they can be attached as part of a theme and saved in the default .B.blend.

Icons are scanned dynamically from disk. To add new icon files so they are available in the menu, create a folder underneath your .blender folder called 'icons' and drop the PNG file in there. They will then appear in a menu in: User Preferences -> Themes -> UI & Buttons -> Icon File.

The location of the icons folder will differ from platform to platform. On *nix and Mac OS X, it should be in $HOME/.blender/icons , on windows it will be different based on installation. Of course the fact that this .blender folder is only available through the terminal on Mac OS X is annoying and ugly, but is a separate issue that should be resolved...

Anyways, to prevent scanning the disk every time the icon menu is drawn, the available icon files are cached in a list, which is re-generated whever the icons are initialised - on startup, and whenever a selection from the menu is made (i.e. when a new icon file is chosen). A useful side effect of this, is that you can re-load an icon file dynamically while Blender is running just by choosing it again from the menu.

If the icon filename that's stored in the theme settings doesn't exist for some reason, Blender will revert to the built-in icons.

There are a few reasons for this patch:

  1. Working on icons for Blender has a huge barrier to entry. Even though creating icons is a job best done by a designer, the process to do so is highly technical (compile datatoc, convert blenderbuttons to c format, compile blender, etc). This means that working on icons for Blender is out of most designer's reach, leaving the job mostly to people who have the technical knowledge to do so, but generally aren't the best icon designers :) This patch makes it much easier to work on creating icons for Blender as all you need to do is save the icon file somewhere without even needing to compile Blender, and it can even be reloaded to check the icons in context while Blender is still running.

Also, as well as making it easier for people to work on icons for the default Blender, having the ability to have customised icons will also allow people to make their own personal themes, perhaps customised for various operating systems' look and feel. Even if these are unofficial, hopefully it may get people interested and active in creating icons for Blender, which may be useful for the project at large.

  1. Blender's icons are in dire need of an update. They are totally dated, inconsistent with each other, don't have guidelines for how they should look in various situations, and so on. It would be a good idea to really go back to basics and analyse this and make some sweeping changes for a new default icon set, perhaps involving changing the metaphors, colours or shapes used. Some conservatives may not like or want to get used to this, so this patch provides a way for them to keep using and maintain an 'old-school' icon set if they want.

There are a couple of implementation details that may be useful for a reviewer to know about, perhaps they are ok, perhaps there are better ways of doing things:

  • The icon file cache is just a static global ListBase in interface_icons.c. I tried attaching it to the G struct but things started going crazy, like Blender not being able to open the .B.blend and start up.

  • I changed the order of things initialising in BIF_init() (usiblender.c). Previously, the BIF_resources_init() was executed inside initbuttion(), before BIF_read_homefile() (which loads the theme information from the .B.blend). Because of this, it wasn't possible to decide on which icon to load based on the theme, since that information wasn't available. I checked through the code and didn't see anything that looked dangerous about it, so I moved BIF_resources_init() out to BIF_init() and after BIF_read_homefile(). This is working just fine for me, but I thought I'd mention it just in case...%%%

%%%This patch allows icon files (.png) to be loaded into Blender dynamically, without having to go through the tedious and technical process of compiling them in. It also makes them part of the theme settings so they can be attached as part of a theme and saved in the default .B.blend. Icons are scanned dynamically from disk. To add new icon files so they are available in the menu, create a folder underneath your .blender folder called 'icons' and drop the PNG file in there. They will then appear in a menu in: User Preferences -> Themes -> UI & Buttons -> Icon File. The location of the icons folder will differ from platform to platform. On *nix and Mac OS X, it should be in $HOME/.blender/icons , on windows it will be different based on installation. Of course the fact that this .blender folder is only available through the terminal on Mac OS X is annoying and ugly, but is a separate issue that should be resolved... Anyways, to prevent scanning the disk every time the icon menu is drawn, the available icon files are cached in a list, which is re-generated whever the icons are initialised - on startup, and whenever a selection from the menu is made (i.e. when a new icon file is chosen). A useful side effect of this, is that you can re-load an icon file dynamically while Blender is running just by choosing it again from the menu. If the icon filename that's stored in the theme settings doesn't exist for some reason, Blender will revert to the built-in icons. There are a few reasons for this patch: 1) Working on icons for Blender has a huge barrier to entry. Even though creating icons is a job best done by a designer, the process to do so is highly technical (compile datatoc, convert blenderbuttons to c format, compile blender, etc). This means that working on icons for Blender is out of most designer's reach, leaving the job mostly to people who have the technical knowledge to do so, but generally aren't the best icon designers :) This patch makes it much easier to work on creating icons for Blender as all you need to do is save the icon file somewhere without even needing to compile Blender, and it can even be reloaded to check the icons in context while Blender is still running. Also, as well as making it easier for people to work on icons for the default Blender, having the ability to have customised icons will also allow people to make their own personal themes, perhaps customised for various operating systems' look and feel. Even if these are unofficial, hopefully it may get people interested and active in creating icons for Blender, which may be useful for the project at large. 2) Blender's icons are in dire need of an update. They are totally dated, inconsistent with each other, don't have guidelines for how they should look in various situations, and so on. It would be a good idea to really go back to basics and analyse this and make some sweeping changes for a new default icon set, perhaps involving changing the metaphors, colours or shapes used. Some conservatives may not like or want to get used to this, so this patch provides a way for them to keep using and maintain an 'old-school' icon set if they want. ----- There are a couple of implementation details that may be useful for a reviewer to know about, perhaps they are ok, perhaps there are better ways of doing things: * The icon file cache is just a static global ListBase in interface_icons.c. I tried attaching it to the G struct but things started going crazy, like Blender not being able to open the .B.blend and start up. * I changed the order of things initialising in BIF_init() (usiblender.c). Previously, the BIF_resources_init() was executed inside initbuttion(), before BIF_read_homefile() (which loads the theme information from the .B.blend). Because of this, it wasn't possible to decide on which icon to load based on the theme, since that information wasn't available. I checked through the code and didn't see anything that looked dangerous about it, so I moved BIF_resources_init() out to BIF_init() and after BIF_read_homefile(). This is working just fine for me, but I thought I'd mention it just in case...%%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

Added subscriber: @PierreSchiller

Added subscriber: @PierreSchiller

Could we please add this feature back for 2.8? I´m really interested in developing better UI icons.

Could we please add this feature back for 2.8? I´m really interested in developing better UI icons.

Added subscriber: @xan2622

Added subscriber: @xan2622
Related pages: https://wiki.blender.org/index.php/Dev:Source/UI/Icon_Redesign https://wiki.blender.org/index.php/Dev:Source/UI/Icon_Guidelines https://blenderartists.org/forum/showthread.php?82903-Tango-Icon-Theme http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#5334
No description provided.