Dev:2.7/Source/Checklists/Vector Icon
< Dev:2.7
目次
Adding a new Vector Icon
"Vector Icons" are special icons in Blender that are defined programmatically in C using OpenGL commands. They are not to be confused with the standard icons used all over the rest of the UI (see this page instead). They are currently only used for two special cases:
- When the icons in question need to be scaleable and have clear, sharp lines (e.g. dropdown arrows)
- When the appearance of the icons in question depend on the theme settings
Note: You should probably not be using this. These notes are just here in case anyone ever runs into the need to try whether these do what is needed.
Checklist
Assuming you've got an icon called my_icon
...
editors/include/UI_icons.h
- "DEF_VICO" block at end of file - Add some DEF_VICO entries for your icon types there. e.g,
DEF_VICO(MY_ICON_VEC)
editors/interface/interface_icons.c
- Just above "#ifndef WITH_HEADLESS" (above
init_brush_icons()
) - Add a function for drawing your icon as follows:
static void vicon_my_icon_draw(int x, int y, int w, int h, float alpha)
{
... some OpenGL drawing commands here - See the others for examples of what to do and how ...
}
- init_internal_icons() - Add a call to link the VICO identifier to the draw function:
def_internal_vicon(VICON_MY_ICON_VEC, vicon_my_icon_draw);
Usage
Use the icon by doing:
VICO_MY_ICON
in your code, when you'd normally have used
ICON_*