[Bf-committers] How does Icon stored in Blender and how to add icon for a space window

Joe Eagar joeedh at gmail.com
Tue Mar 21 11:03:32 CET 2006


xiang liang wrote:
> I add a space window in Blender, and I want to add a icon for the window
> How can I do that
> I also want to add some Icon for buttons, How can I do that
>   
All icons are stored in a file called blenderbuttons in 
release/datafiles.  The file is a png image, with the icons arranged on 
a grid; to use it just rename to file to blenderbuttons.png.  The png 
has an alpha channel, so transparency shouldn't be a problem.

To add new icons, use the blank gridspaces (start with the *second* one) 
as defined in the icon enumeration in 
source/blender/include/BIF_resources.h.  The icons are named, starting 
from the lower left, left to right.  There are six blank icons you can 
use at the moment as defined in the enum; except you cannot use the 
first one.  I believe the idea is you fill in the blanks (starting with 
the second one) and replace the ICON_BLANKxxx with your icon name as you 
go.  I *think* you can add new rows to the blenderbuttons file if you 
have to, but if you do then you want to add ICON_BLANKXX to the 
enumeration for all the blank icons in the row you added.

There's another file, datatoc.c, which must be compiled into a program 
and used to turn blenderbuttons (renamed to not have the .png) into a .c 
file which can be compiled into Blender.  To use datatoc, it should be 
as easy as (if you use gcc):

gcc datatoc.c -o datatoc[.exe on windows]
./datatoc blenderbuttons

Datatoc will spit out blenderbuttons.c, which goes in 
source/blender/src.  Note if your using windows: datatoc is best run on 
the command line, since simply dragging the file onto it ends up with 
the whole pathname being compiled as the filename, rather then just the 
filename.

joeedh
P.S.: I've never done this before, so this probably isn't perfect; for 
more info you can ask questions on #blendercoders at irc.freenode.net .


More information about the Bf-committers mailing list