[Bf-blender-cvs] [898b649] master: UI: multi-value-edit, tint button while editing

Campbell Barton noreply at git.blender.org
Wed May 13 02:01:28 CEST 2015


Commit: 898b6491ed979ab5a59af25f5fb06841e8df59e5
Author: Campbell Barton
Date:   Wed May 13 09:58:05 2015 +1000
Branches: master
https://developer.blender.org/rB898b6491ed979ab5a59af25f5fb06841e8df59e5

UI: multi-value-edit, tint button while editing

Currently re-uses node-flag (which is only used to tint color too)

===================================================================

M	source/blender/editors/interface/interface_handlers.c

===================================================================

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 8e3cc08..036e2ba 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -185,12 +185,17 @@ typedef struct uiSelectContextStore {
 
 static bool ui_selectcontext_begin(
         bContext *C, uiBut *but, struct uiSelectContextStore *selctx_data);
+static void ui_selectcontext_end(
+        uiBut *but, uiSelectContextStore *selctx_data);
 static void ui_selectcontext_apply(
         bContext *C, uiBut *but, struct uiSelectContextStore *selctx_data,
         const double value, const double value_orig);
 
 #define IS_ALLSELECT_EVENT(event) ((event)->alt != 0)
 
+/* just show a tinted color so users know its activated */
+#define UI_BUT_IS_SELECT_CONTEXT UI_BUT_NODE_ACTIVE
+
 #endif  /* USE_ALLSELECT */
 
 
@@ -1426,9 +1431,25 @@ finally:
 	/* caller can clear */
 	selctx_data->do_free = true;
 
+	if (success) {
+		but->flag |= UI_BUT_IS_SELECT_CONTEXT;
+	}
+
 	return success;
 }
 
+static void ui_selectcontext_end(
+        uiBut *but, uiSelectContextStore *selctx_data)
+{
+	if (selctx_data->do_free) {
+		if (selctx_data->elems) {
+			MEM_freeN(selctx_data->elems);
+		}
+	}
+
+	but->flag &= ~UI_BUT_IS_SELECT_CONTEXT;
+}
+
 static void ui_selectcontext_apply(
         bContext *C, uiBut *but, uiSelectContextStore *selctx_data,
         const double value, const double value_orig)
@@ -7606,11 +7627,7 @@ static void button_activate_exit(
 		MEM_freeN(data->origstr);
 
 #ifdef USE_ALLSELECT
-	if (data->select_others.do_free) {
-		if (data->select_others.elems) {
-			MEM_freeN(data->select_others.elems);
-		}
-	}
+	ui_selectcontext_end(but, &data->select_others);
 #endif
 
 	/* redraw (data is but->active!) */




More information about the Bf-blender-cvs mailing list