From BlenderWiki

Jump to: navigation, search

Function name conventions

A function should be named with subject first, then the verb:

       <prefix>_<what it is>_<what it does>

Prefix is the "module", and can be upper or lower case, if it's upper case, means exported outside its own module (the API), with lower case it's a local module only, for example:

        void WM_screen_activate()
        void wm_check()

If a function is only used inside a C file, it should be made static. It then doesn't have to follow the prefix rule, depending on clarity...

        static void wm_window_close()
        static int query_qual()

Struct name conventions

The same prefix and order rule can apply to exported struct names, but with the openGL convention, to have them clearly distinguished from function names. for example:

        struct wmWindowManager {
        struct uiBlock {

Structs on global (kernel) level can get a 'b' prefix:

        struct bContext {

But that's not enforced really... (see DNA structs)

#define name conventions

Defines are always fully capitalized, and have prefix to show origin:


to prevent prefixes to become confusingly long, special ones are fine too, like for keymap defines:


Operator definitions

For Operator definitions it's important to find out where they are located. Here an extra OT is added in the name, to indicate "Operator Type"


Since these are names saved in operator stacks (macros) it's important to make them nice and future proof.


  • Variable names are lower case only, also in structs
  • Names are minimal 2 characters, unless it's a counter in a loop.