[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14009] trunk/blender/source/blender/src/ interface.c: The BUTM button type (used for 'R' button in StretchTo/ LimitDist constraints) now acts like a button when clicked on.

Joshua Leung aligorith at gmail.com
Sat Mar 8 03:38:41 CET 2008


Revision: 14009
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14009
Author:   aligorith
Date:     2008-03-08 03:38:35 +0100 (Sat, 08 Mar 2008)

Log Message:
-----------
The BUTM button type (used for 'R' button in StretchTo/LimitDist constraints) now acts like a button when clicked on. 

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

Modified: trunk/blender/source/blender/src/interface.c
===================================================================
--- trunk/blender/source/blender/src/interface.c	2008-03-08 02:21:55 UTC (rev 14008)
+++ trunk/blender/source/blender/src/interface.c	2008-03-08 02:38:35 UTC (rev 14009)
@@ -2687,15 +2687,42 @@
 
 static int ui_do_but_BUTM(uiBut *but)
 {
+	int activated;
+	
+	do {
+		int oflag= but->flag;
+		short mval[2];
+			
+		uiGetMouse(mywinget(), mval);
+		
+		if (uibut_contains_pt(but, mval))
+			but->flag |= UI_SELECT;
+		else
+			but->flag &= ~UI_SELECT;
+		
+		if (but->flag != oflag) {
+			ui_draw_but(but);
+			ui_block_flush_back(but->block);
+		}
+		
+		PIL_sleep_ms(10);
+	} while (get_mbut() & L_MOUSE);
 
-	ui_set_but_val(but, but->min);
-	UIafterfunc_butm= but->butm_func;
-	UIafterfunc_arg1= but->butm_func_arg;
-	UIafterval= but->a2;
+	activated= (but->flag & UI_SELECT);
+
+	if (activated) {
+		ui_set_but_val(but, but->min);
+		UIafterfunc_butm= but->butm_func;
+		UIafterfunc_arg1= but->butm_func_arg;
+		UIafterval= but->a2;
+		
+		uibut_do_func(but);
+	}
 	
-	uibut_do_func(but);
-	
-	return but->retval;
+	but->flag &= ~UI_SELECT;
+	ui_draw_but(but);
+
+	return activated?but->retval:0;
 }
 
 static int ui_do_but_LABEL(uiBut *but)





More information about the Bf-blender-cvs mailing list