Dev:2.4/Doc/How to/Add a ToolTip
Adding Button Tool Tips
I always wanted to help out with Blender development but never knew where to start. I am not that great a programmer so I needed something to keep it simple. I started with searching the various Blender forums at elysiun and blender.org to learn what those who came before me had learned. What I learned was to start small. So in that spirit I thought I would add some tooltips to the Realtime Buttons. Here we go... I fired up Blender and selected the Realtime Buttons. I held the mouse cursor over the "Actor" button and the tooltip poped up with "Objects that are evaluated by the engine". I quickly opened a console changed into the Blender source directory and entered the following (linux) command:
grep -n "Objects that are evaluated by the engine" -R *
The console returned the following:
blender/src/buttons_logic.c:2295: "Objects that are evaluated by the engine "); blender/src/buttons_logic.c:2333: "Objects that are evaluated by the engine ");
Opening the file _buttons_logic.c_ informed me that there were two functions, _buttons_enji()_, and _buttons_ketsji()_. The name "ketsji" should be familiar from browsing this section so I started at line 2333 which is in _buttons_ketsji()_.
uiDefButI(block, TOG|BIT|2, B_REDR, "Actor", 10,205,75,19, &ob->gameflag, 0, 0, 0, 0, "Objects that are evaluated by the engine");
And from the _BIF_interface.h_ here is the function definition:
uiBut '''uiDefButI(uiBlock '''block, int type, int retval, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
Please look [] for information on this function. That last set of quotes is where the tooltip goes. A little search for empty quotes in this file and a little caution about where and when to add a tooltip and you are on your way! Take a look at the other _buttons_*.c_ files in blender/src as well.
PS: Join the GameEngineTeam and blenderwiki to help with these pages. :)
-- DeveloperWikiStephenHughes - 26 Apr 2005