Dev:2.7/Source/Checklists/Vector Icon

提供: wiki
移動先: 案内検索

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:

  1. When the icons in question need to be scaleable and have clear, sharp lines (e.g. dropdown arrows)
  2. 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.


Assuming you've got an icon called my_icon...


  • "DEF_VICO" block at end of file - Add some DEF_VICO entries for your icon types there. e.g,



  • 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);


Use the icon by doing:


in your code, when you'd normally have used ICON_*