Named Layers -Code Question

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
ace1
Posts: 0
Joined: Mon Feb 19, 2007 4:21 am
Location: Miami,Florida
Contact:

Named Layers -Code Question

Post by ace1 »

I'm adding a feature to the named layers interface.
I want to put an icon pull down menu int the 3D header next to the layer buttons so that when it is pressed the names of only the "occupied layers" will appear and thus will be able to be selected.

Question:
Where are the icon images stored in the sources and in what format are they stored? Hope someone can help.
Thanks in advance :D :D
DIGIMATOR

BeBraw
Posts: 0
Joined: Sun Feb 19, 2006 4:14 pm

Post by BeBraw »

Check out BIF_resources.h (it's in ../mybranch/blender/source/blender/include/). You can find enum containing all the icons there. This enum is linked to file called blenderbuttons. You can find that at ../mybranch/release/datafiles.

To add an icon you need add it to the enum. (Note the logic between blenderbuttons and enum. It starts from the bottom left corner and goes right. It goes like this till top.). Replace wanted blank icon with yours. Remember to add it to blenderbuttons too.

This is not enough however. You need to compile blenderbuttons. You can do this by using datatoc.c. This is a small program that you need to compile. Then you can use it to convert blenderbuttons to suitable file that can be added to the source.

There are instructions about how to use datatoc to compile splash screen at http://wiki.blender.org/index.php/Blend ... lashScreen . The procedure should be somewhat similar for blenderbuttons.

If you are unsure, check out some old commit that adds a new icon to Blender. This might clarify some things.

I hope this gets you started. :)

ace1
Posts: 0
Joined: Mon Feb 19, 2007 4:21 am
Location: Miami,Florida
Contact:

Post by ace1 »

Thanks BeBraw! :D :D
I think I'm ready to go now.Now on to actually write the code.
DIGIMATOR

ace1
Posts: 0
Joined: Mon Feb 19, 2007 4:21 am
Location: Miami,Florida
Contact:

Post by ace1 »

I've got the code up and running but there were a few questions I forgot to ask about concerning adding an icon to Blender . I've even made a large icon image in photoshop ready to be reduced and refined for better visibility at lower resolution.
Questions:

What size should the icon image be for Blender?
In what format : Jpeg,png,tiff?
Where do I store the image? Is there an icon image file stored in Blender that I should add mine to since I only need to add one?
After I use the dataoc utility to compile blenderbuttons,will the utility produce another blenderbuttons file or where do I go from there?

Is there something I should do to the blenderbuttons file too?
This is the final problem to be solved in coding this particular interface feature of the named layers UI system.In making a change in design decisions this feature will replace the old layer buttons in the 3D header (in my builds). An added benifit is that the interface will be much smaller yet more powerful and workflow friendly.

Again,I hope someone can point me in the right direction as the Blender community has graciously done time and time again.Without you helping me understand the logic of the codebase,I would'nt have gotten this far this fast!

A special thanks to BeBraw!

Thanks in advance :D :D :D
DIGIMATOR

ace1
Posts: 0
Joined: Mon Feb 19, 2007 4:21 am
Location: Miami,Florida
Contact:

Post by ace1 »

I found out that the 65kb blenderbuttons file is a .png file.
I have to add my icon to it, dataoc it,add button to BIF_recources.h
and compile.
DIGIMATOR

Post Reply