[tuhopuu-cvs] CVS commit: tuhopuu3/source/blender/include BIF_interface.h tuhopuu3/source/blender/makesdna DNA_object_types.h tuhopuu3/source/blender/src buttons_object.c buttons_scene.c buttons_shading.c header_view3d.c interface.c interface_draw.c
Matt Ebb
matt at mke3.net
Wed Apr 13 08:14:05 CEST 2005
broken (Matt Ebb) 2005/04/13 08:14:05 CEST
Modified files:
tuhopuu3/source/blender/include BIF_interface.h
tuhopuu3/source/blender/makesdna DNA_object_types.h
tuhopuu3/source/blender/src buttons_object.c buttons_scene.c
buttons_shading.c header_view3d.c
interface.c interface_draw.c
Log:
* Button disabling (greying out)
http://mke3.net/blender/interface/controls/greyed_out.png
Another little intermediate addition, something that's been needed
for a long, long, long time. Hopefully now, rather than a weird mix
of buttons disappearing (or not) based on various conditions, this
can be standardised on as much as possible. I don't know if this is
the nicest way to do it, but I've tried to keep it fairly
unobtrusive, and hey, it works.
While disabled, the buttons are tinted roughly 50% against the
background colour, and don't respond to any mouse-overs, clicks,
or tabs.
The code to use it is very simple, just like the button
alignment code. Just surround the relevant button definitions with:
uiBlockBeginDisabled(block, condition); and
uiBlockEndDisabled(block);
The 'condition' parameter is the condition under which the buttons
are disabled, so if it evaluates, the buttons are disabled, if it
equals 0, the buttons remain enabled as normal.
Eg.
uiBlockBeginDisabled(block, (!(ob->transflag & OB_DUPLIVERTS)));
uiDefButC(block, TOG|BIT|5, REDRAWVIEW3D, "Rotation", ...
uiBlockEndDisabled(block);
This can also be used in menus, I've already included one example
usage in the 3D View -> View menu that disables the 'Camera' option
if there is no active camera in the scene:
http://mke3.net/blender/interface/controls/greyed_out_menu.png
The code for this is:
uiBlockBeginDisabled(block, (G.scene->camera == NULL) );
-- code for the menu entry here --
uiBlockEndDisabled(block);
Anyone who would like to compile a list of places where this should
be used throughout the menus/buttons is very welcome to do so, or
even offer a patch :)
Revision Changes Path
1.3 +7 -3 tuhopuu3/source/blender/include/BIF_interface.h
<http://projects.blender.org/viewcvs/viewcvs.cgi/tuhopuu3/source/blender/include/BIF_interface.h.diff?r1=1.2&r2=1.3&cvsroot=tuhopuu>
1.5 +3 -1 tuhopuu3/source/blender/makesdna/DNA_object_types.h
<http://projects.blender.org/viewcvs/viewcvs.cgi/tuhopuu3/source/blender/makesdna/DNA_object_types.h.diff?r1=1.4&r2=1.5&cvsroot=tuhopuu>
1.18 +22 -5 tuhopuu3/source/blender/src/buttons_object.c
<http://projects.blender.org/viewcvs/viewcvs.cgi/tuhopuu3/source/blender/src/buttons_object.c.diff?r1=1.17&r2=1.18&cvsroot=tuhopuu>
1.18 +19 -12 tuhopuu3/source/blender/src/buttons_scene.c
<http://projects.blender.org/viewcvs/viewcvs.cgi/tuhopuu3/source/blender/src/buttons_scene.c.diff?r1=1.17&r2=1.18&cvsroot=tuhopuu>
1.26 +6 -2 tuhopuu3/source/blender/src/buttons_shading.c
<http://projects.blender.org/viewcvs/viewcvs.cgi/tuhopuu3/source/blender/src/buttons_shading.c.diff?r1=1.25&r2=1.26&cvsroot=tuhopuu>
1.20 +14 -1 tuhopuu3/source/blender/src/header_view3d.c
<http://projects.blender.org/viewcvs/viewcvs.cgi/tuhopuu3/source/blender/src/header_view3d.c.diff?r1=1.19&r2=1.20&cvsroot=tuhopuu>
1.22 +36 -6 tuhopuu3/source/blender/src/interface.c
<http://projects.blender.org/viewcvs/viewcvs.cgi/tuhopuu3/source/blender/src/interface.c.diff?r1=1.21&r2=1.22&cvsroot=tuhopuu>
1.17 +227 -235 tuhopuu3/source/blender/src/interface_draw.c
<http://projects.blender.org/viewcvs/viewcvs.cgi/tuhopuu3/source/blender/src/interface_draw.c.diff?r1=1.16&r2=1.17&cvsroot=tuhopuu>
More information about the tuhopuu-cvs
mailing list