[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13420] trunk/blender/source/blender/src/ buttons_object.c: Bugfix:

Joshua Leung aligorith at gmail.com
Sun Jan 27 10:39:27 CET 2008


Revision: 13420
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13420
Author:   aligorith
Date:     2008-01-27 10:39:26 +0100 (Sun, 27 Jan 2008)

Log Message:
-----------
Bugfix:

Previous changes for Constraint Up/Down buttons broke the drawing of some constraints. It seems the lack of any buttons within an pair of uiBeginBlockAlign() and uiEndBlockAlign() caused problems.

Modified Paths:
--------------
    trunk/blender/source/blender/src/buttons_object.c

Modified: trunk/blender/source/blender/src/buttons_object.c
===================================================================
--- trunk/blender/source/blender/src/buttons_object.c	2008-01-27 06:08:43 UTC (rev 13419)
+++ trunk/blender/source/blender/src/buttons_object.c	2008-01-27 09:39:26 UTC (rev 13420)
@@ -582,12 +582,14 @@
 		uiBlockSetEmboss(block, UI_EMBOSS);
 	}
 	else {
-		short prev_proxylock;
+		short prev_proxylock, show_upbut, show_downbut;
 		
 		/* Up/Down buttons: 
 		 *	Proxy-constraints are not allowed to occur after local (non-proxy) constraints
 		 *	as that poses problems when restoring them, so disable the "up" button where
-		 *	it may cause this situation.
+		 *	it may cause this situation. 
+		 *
+		 * 	Up/Down buttons should only be shown (or not greyed - todo) if they serve some purpose. 
 		 */
 		if (proxylocked_constraints_owner(ob, pchan)) {
 			if (con->prev) {
@@ -598,23 +600,27 @@
 		}
 		else
 			prev_proxylock= 0;
-		 
-		uiBlockBeginAlign(block);
-			uiBlockSetEmboss(block, UI_EMBOSS);
 			
-			/* only show buttons that will do anything valid */
-			if ((prev_proxylock==0) && (con->prev)) {
-				but = uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, VICON_MOVE_UP, *xco+width-50, *yco, 16, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Move constraint up in constraint stack");
-				uiButSetFunc(but, constraint_moveUp, ob, con);
-			}
-			
-			if (con->next) {
-				but = uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, VICON_MOVE_DOWN, *xco+width-50+18, *yco, 16, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Move constraint down in constraint stack");
-				uiButSetFunc(but, constraint_moveDown, ob, con);
-			}
-		uiBlockEndAlign(block);
+		show_upbut= ((prev_proxylock == 0) && (con->prev));
+		show_downbut= (con->next) ? 1 : 0;
 		
+		if (show_upbut || show_downbut) {
+			uiBlockBeginAlign(block);
+				uiBlockSetEmboss(block, UI_EMBOSS);
+				
+				if (show_upbut) {
+					but = uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, VICON_MOVE_UP, *xco+width-50, *yco, 16, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Move constraint up in constraint stack");
+					uiButSetFunc(but, constraint_moveUp, ob, con);
+				}
+				
+				if (show_downbut) {
+					but = uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, VICON_MOVE_DOWN, *xco+width-50+18, *yco, 16, 18, NULL, 0.0, 0.0, 0.0, 0.0, "Move constraint down in constraint stack");
+					uiButSetFunc(but, constraint_moveDown, ob, con);
+				}
+			uiBlockEndAlign(block);
+		}
 		
+		
 		/* Close 'button' - emboss calls here disable drawing of 'button' behind X */
 		uiBlockSetEmboss(block, UI_EMBOSSN);
 		





More information about the Bf-blender-cvs mailing list