[Bf-committers] Code "cleanups" in buttons.c

Timo Mihaljov bf-committers@blender.org
Sat, 22 Feb 2003 20:38:35 +0200


Hi everybody,
as a first step in preparation for future GUI changes, I've used refactoring 
to make (parts of) buttons.c more readable.

At first I wanted to do this for just one function (I picked curvebuts() at 
random) just to show everyone what I'd like to do to the source and ask if 
it's OK to do that, but then I got carried away and reorganized meshbuts() 
and commonbuts() aswell. :-)

I haven't changed what the program does in any way, I've just reorganized the 
actions in a way that IMHO is easier to understand at a quick glance.

I made the following changes to the buttons.c in bf-tree CVS code:
1) I gave all the functions that draw the EditButtons for different object 
types more sensible names: curvebuts() -> create_curve_edit_buttons(), 
commonbuts() -> create_common_edit_buttons(), etc.

2) I tried to make the code inside three of them 
(create_common_edit_buttons(), create_mesh_edit_buttons(), 
create_curve_edit_buttons()) easier to read. For doing this I also

3) created 3 helper functions: active_obj_ptr(), edited_obj_ptr() and 
obj_data_is_linked().

I don't know if it's OK to include files in the mails to this list so I'll 
just give you the URL where you can get the patch:
http://matvei.joroinen.fi/partial_buttons_cleanup.patch

I'd like to hear people's thoughts on changes like this to the code. If the 
project managers are OK with it I'd like to continue to improve the 
architecture of the GUI system, as I think that there might be quite a number 
of GUI changes coming up and I'd like to make them as easy as possible.


Timo Mihaljov
noid @ #blenderchat & #blendersauce