Adding Current Revision number to Your Blender Window Title

Here is a very simple modification you can make to your Blender source which will not hurt anything and give new coders a chance to try editing source files and recompiling, plus you’ll get visual feedback that your edits have worked.

Back when I was submitting bug reports I found it convenient to have the current revision number handy without having to bring up the splash screen, so I changed a few lines in Blender’s source to put the revision number up in the window title.

Here is the step-by-step process of making this modification:

1: Make sure you have your source code set up properly and that it compiles cleanly.

2: Navigate to the file: blender/source/blender/windowmanager/intern/wm_window.c and open it.

3: Scroll down to the section that says:

void wm_window_title(wmWindowManager *wm, wmWindow *win)

4: Just inside of the wm_window_title() function add a line that says:

        extern char build_rev[];

5: About 9 lines below that, there is a char array (i.e. a string) definition
" char str[sizeof(G.main->name) + 12];"

Chang it to read:

char str[sizeof(G.main->name) + 12 + 5];

This will give additional room to add the revision number to the window title.

6: Directly below that line is a line that begins “BLI_snprintf(str, sizeof(str),”. Change that line to read:

BLI_snprintf(str, sizeof(str), "%s Blender%s [%s]", build_rev, wm->file_saved ? "":"*", G.main->name);

Basically you are just prepending a '%s ’ to the quoted format string in that function call and then adding the ‘build_rev’ variable to the list of parameters. %s is a place holder for a string in the format string. In our case it will be the revision number.

7: In the ‘else’ clause that follows directly below, change the first two lines within it to be:

                        char str[14];
                        BLI_snprintf(str, sizeof(str), "%s Blender", build_rev);

Once again we’ve made room for the revision number by increasing the size of our string ‘str’ and changed the format string to accept our build_rev variable.

8: Save the file and recompile. If all goes well when you launch your newly compiled copy of Blender you will see the current revision number in your window title!