[Bf-blender-cvs] [abf7378] master: Fix T44697: Multi-value edit /w layers fails

Campbell Barton noreply at git.blender.org
Tue May 26 07:21:53 CEST 2015


Commit: abf7378e4445ba10828e369edf399ba4c29995c1
Author: Campbell Barton
Date:   Tue May 26 15:16:30 2015 +1000
Branches: master
https://developer.blender.org/rBabf7378e4445ba10828e369edf399ba4c29995c1

Fix T44697: Multi-value edit /w layers fails

Not such a nice solution, but good to have this working.

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

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 feb9b40..f90c3af 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -162,6 +162,11 @@ typedef enum uiHandleButtonState {
 
 
 #ifdef USE_ALLSELECT
+
+/* Unfortunately theres no good way handle more generally:
+ * (propagate single clicks on layer buttons to other objects) */
+#define USE_ALLSELECT_LAYER_HACK
+
 typedef struct uiSelectContextElem {
 	PointerRNA ptr;
 	union {
@@ -1488,6 +1493,39 @@ static void ui_selectcontext_apply(
 			}
 		}
 
+#ifdef USE_ALLSELECT_LAYER_HACK
+		/* make up for not having 'handle_layer_buttons' */
+		{
+			PropertySubType subtype = RNA_property_subtype(prop);
+
+			if ((rna_type == PROP_BOOLEAN) &&
+			    ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER) &&
+			    is_array &&
+			    /* could check for 'handle_layer_buttons' */
+			    but->func)
+			{
+				wmWindow *win = CTX_wm_window(C);
+				if (!win->eventstate->shift) {
+					const int len = RNA_property_array_length(&but->rnapoin, prop);
+					int *tmparray = MEM_callocN(sizeof(int) * len, __func__);
+
+					tmparray[index] = true;
+
+					for (i = 0; i < selctx_data->elems_len; i++) {
+						uiSelectContextElem *other = &selctx_data->elems[i];
+						PointerRNA lptr = other->ptr;
+						RNA_property_boolean_set_array(&lptr, lprop, tmparray);
+						RNA_property_update(C, &lptr, lprop);
+					}
+
+					MEM_freeN(tmparray);
+
+					return;
+				}
+			}
+		}
+#endif
+
 		for (i = 0; i < selctx_data->elems_len; i++) {
 			uiSelectContextElem *other = &selctx_data->elems[i];
 			PointerRNA lptr = other->ptr;




More information about the Bf-blender-cvs mailing list