Source/Interface/Icons

Icons

There are multiple types of icons in Blender:

  • blender_icons.svg - Main icon sheets.
  • alert_icons.svg - Large icons for dialogs (warning, info, etc).
  • prvicons.svg - Used for large preview of documents, drives, etc.
  • brushicons/ - A folder with PNG images for the built-in brushes (sculpt, Grease Pencil, etc)
  • ../lib/resources/icon_geom.blend - Tool icons are actually meshes inside icon_geom.blend

The source files for most icons are stored in /release/datafiles/, except the tool icons which are in the lib/resources folder in SVN.

blender_icons

This is just a SVG image containing a grid of icons. A Python script exports this file into 2 PNG images using Inkscape, then cropped into .dat files using Blender.

The following has been tested on GNU/Linux (Ubuntu), and on Windows through WSL (Windows Subsystem for Linux).

Design

See the Human Interface Guidelines on best practices to design Blender icons. Before adding new icons please consult with members of the User Interface module.

Requirements

  • To modify or add icons you need to know how to build Blender
  • Inkscape 1.0+
    • On Debian/Ubuntu/WSL: apt install inkscape (Ubuntu 20.04 LTS ships with Inkscape 0.9x, you need to get it from the ppa:inkscape.dev/stable PPA).
  • Blender
    • Needs to be accessible by running blender
  • Python 3+

How to edit icons

  • Open blender_icons.svg in Inkscape
  • Edit or add an icon in one of the empty rows, try to put it in a place where it makes sense (a row of similar icons), see UI_icons.h for reference.
  • Run make icons
  • Compile Blender (you can use the faster make lite to quickly iterate through versions)

How to add a new icon

  • Add the icon to blender_icons.svg
  • Open /source/blender/editors/include/UI_icons.h
  • Find the section that makes more sense for the icon you want to add.
    • e.g. if you want to add an icon for the Sequencer, look for icons starting with SEQ_.
  • Find a DEF_ICON_BLANK(<number>) available and replace it with:
    • DEF_ICON(EXAMPLE_NAME)
  • Some icons are coloured by the theme based on their category.
    • DEF_ICON_SCENE(<name>)
    • DEF_ICON_COLLECTION(<name>)
    • DEF_ICON_OBJECT(<name>)
    • DEF_ICON_OBJECT_DATA(<name>)
    • DEF_ICON_MODIFIER(<name>)
    • DEF_ICON_SHADING(<name>)
    • DEF_ICON_FOLDER(<name>)
 e.g. If you are adding a new modifier, use DEF_ICON_MODIFIER(<name>) instead of DEF_ICON.

For other categories read the header of UI_icons.h

Your new icon will be accessible just like regular icons:

  • layout.prop(sc, "example_prop", text="My Prop", icon='EXAMPLE_NAME')

Committing the icon

  • Add the icon name to /source/blender/editors/datafiles/CMakeLists.txt
    • Use lowercase, and place it in the same order than in UI_icons.h
  • blender_icons.svg
    • Make sure that the changes only add the icon and nothing else (no header changes, metatags, etc).

For reference, check out this commit or this commit that add icons.

alert_icons / prvicons

  • Edit: prvicons.svg or alert_icons.svg`
  • Run make icons
  • Rebuild blender.

brushicons

Brush icons are simple PNG files that can be edited using any image editing software like GIMP or Krita.

  • Edit the images on /release/datafiles/brushicons/

Assigning images to brushes is done manually as part of startup.blend.

icon_geom

Tools in the toolbar have to supply an icon. Here's how:

In blender 2.8 we have the possibility of creating binary icon files (.dat) from blender files (.blend). You can see some examples of these blender files with icons in the "icon_geom.blend" in the library with the blender dependencies. (..lib/resources/icon_geom.blend).

This library is located in Blender's Resources SVN repository, here:

https://svn.blender.org/svnroot/bf-blender/trunk/lib/resources

To create the actual icons, follow the built-in README.txt inside icon_geom.blend. This will guide you through creating the icon mesh correctly.

Once you do the geometry in blender, you can transform it into a binary icon file with the command: make icons_geom