[Bf-blender-cvs] [48115c08e07] custom-manipulators: Remove unused widget/operator integration

Campbell Barton noreply at git.blender.org
Fri Jun 9 06:50:46 CEST 2017


Commit: 48115c08e07459dc3183adc3fdd438a28a79425c
Author: Campbell Barton
Date:   Fri Jun 9 14:47:02 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rB48115c08e07459dc3183adc3fdd438a28a79425c

Remove unused widget/operator integration

While this is a useful feature, current integration is untested
and stored the operator in the wmManipulatorGroupType
instead of its instance.

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

M	source/blender/makesrna/intern/rna_wm_manipulator.c
M	source/blender/windowmanager/WM_types.h
M	source/blender/windowmanager/intern/wm_event_system.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/manipulators/WM_manipulator_types.h
M	source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
M	source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
M	source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h

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

diff --git a/source/blender/makesrna/intern/rna_wm_manipulator.c b/source/blender/makesrna/intern/rna_wm_manipulator.c
index c053883e307..f21c11acf61 100644
--- a/source/blender/makesrna/intern/rna_wm_manipulator.c
+++ b/source/blender/makesrna/intern/rna_wm_manipulator.c
@@ -912,8 +912,6 @@ static void rna_def_manipulatorgroup(BlenderRNA *brna)
 		 "Supports culled depth by other objects in the view"},
 		{WM_MANIPULATORGROUPTYPE_SELECT, "SELECT", 0, "Select",
 		 "Supports selection"},
-		{WM_MANIPULATORGROUPTYPE_OP, "OPERATOR", 0, "Operator",
-		 "Attached to operator, and is only accessible as long as this runs"},
 		{0, NULL, 0, NULL, NULL}
 	};
 	prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index aa103df2614..ad8df014902 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -578,9 +578,6 @@ typedef struct wmOperatorType {
 	/* pointer to modal keymap, do not free! */
 	struct wmKeyMap *modalkeymap;
 
-	/* manipulator-group that is accessible while operator runs */
-	wmManipulatorGroupType *mgroup_type;
-
 	/* python needs the operator type as well */
 	int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot) ATTR_WARN_UNUSED_RESULT;
 
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 20376541c58..003aa5a9e41 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1738,11 +1738,6 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
 			wm_region_mouse_co(C, event);
 			wm_event_modalkeymap(C, op, event, &dbl_click_disabled);
 
-			/* attach manipulator-map to handler if not there yet */
-			if (ot->mgroup_type && !handler->manipulator_map) {
-				wm_manipulatorgroup_attach_to_modal_handler(C, handler, ot->mgroup_type, op);
-			}
-
 			if (ot->flag & OPTYPE_UNDO)
 				wm->op_undo_depth++;
 
@@ -1792,7 +1787,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
 				}
 
 				/* update manipulators during modal handlers */
-				wm_manipulatormaps_handled_modal_update(C, event, handler, ot);
+				wm_manipulatormaps_handled_modal_update(C, event, handler);
 
 				/* remove modal handler, operator itself should have been canceled and freed */
 				if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) {
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 29f6e2c001b..f925f22e878 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -177,10 +177,6 @@ static void wm_operatortype_append__end(wmOperatorType *ot)
 		ot->name = N_("Dummy Name");
 	}
 
-	if (ot->mgroup_type) {
-		ot->mgroup_type->flag |= WM_MANIPULATORGROUPTYPE_OP;
-	}
-
 	/* XXX All ops should have a description but for now allow them not to. */
 	RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description : UNDOCUMENTED_OPERATOR_TIP);
 	RNA_def_struct_identifier(ot->srna, ot->idname);
@@ -498,9 +494,6 @@ void WM_operatortype_remove_ptr(wmOperatorType *ot)
 	BLI_ghash_remove(global_ops_hash, ot->idname, NULL, NULL);
 
 	WM_keyconfig_update_operatortype();
-	if (ot->mgroup_type) {
-		WM_manipulatorgrouptype_remove_ptr(NULL, G.main, ot->mgroup_type);
-	}
 
 	MEM_freeN(ot);
 }
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_types.h b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
index 06046ee5e2c..30ce4353e14 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_types.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
@@ -213,9 +213,6 @@ typedef struct wmManipulatorGroupType {
 
 	int flag;
 
-	/* if type is spawned from operator this is set here */
-	void *op;
-
 	/* same as manipulator-maps, so registering/unregistering goes to the correct region */
 	short spaceid, regionid;
 	char mapidname[64];
@@ -234,8 +231,6 @@ enum {
 	WM_MANIPULATORGROUPTYPE_DEPTH_3D = (1 << 2),
 	/* Manipulators can be selected */
 	WM_MANIPULATORGROUPTYPE_SELECT  = (1 << 3),
-	/* manipulator group is attached to operator, and is only accessible as long as this runs */
-	WM_MANIPULATORGROUPTYPE_OP          = (1 << 4),
 };
 
 
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c b/source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
index d54f0aec13b..4f570d4b80b 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulatorgroup.c
@@ -134,27 +134,6 @@ void wm_manipulatorgroup_manipulator_register(wmManipulatorGroup *mgroup, wmMani
 	manipulator->parent_mgroup = mgroup;
 }
 
-void wm_manipulatorgroup_attach_to_modal_handler(
-        bContext *C, wmEventHandler *handler,
-        wmManipulatorGroupType *wgt, wmOperator *op)
-{
-	/* maybe overly careful, but manipulator-grouptype could come from a failed creation */
-	if (!wgt) {
-		return;
-	}
-
-	/* now instantiate the manipulator-map */
-	wgt->op = op;
-
-	/* try to find map in handler region that contains wgt */
-	if (handler->op_region && handler->op_region->manipulator_map) {
-		handler->manipulator_map = handler->op_region->manipulator_map;
-		ED_region_tag_redraw(handler->op_region);
-	}
-
-	WM_event_add_mousemove(C);
-}
-
 wmManipulator *wm_manipulatorgroup_find_intersected_mainpulator(
         const wmManipulatorGroup *mgroup, bContext *C, const wmEvent *event,
         unsigned char *part)
@@ -207,8 +186,7 @@ void wm_manipulatorgroup_ensure_initialized(wmManipulatorGroup *mgroup, const bC
 bool wm_manipulatorgroup_is_visible(const wmManipulatorGroup *mgroup, const bContext *C)
 {
 	/* Check for poll function, if manipulator-group belongs to an operator, also check if the operator is running. */
-	return ((mgroup->type->flag & WM_MANIPULATORGROUPTYPE_OP) == 0 || mgroup->type->op) &&
-	       (!mgroup->type->poll || mgroup->type->poll(C, mgroup->type));
+	return (!mgroup->type->poll || mgroup->type->poll(C, mgroup->type));
 }
 
 bool wm_manipulatorgroup_is_visible_in_drawstep(const wmManipulatorGroup *mgroup, const int drawstep)
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c b/source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
index c75ae6ce377..8eaf7030bec 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulatormap.c
@@ -397,18 +397,13 @@ void WM_manipulatormap_add_handlers(ARegion *ar, wmManipulatorMap *mmap)
 }
 
 void wm_manipulatormaps_handled_modal_update(
-        bContext *C, wmEvent *event, wmEventHandler *handler,
-        const wmOperatorType *ot)
+        bContext *C, wmEvent *event, wmEventHandler *handler)
 {
 	const bool modal_running = (handler->op != NULL);
 
 	/* happens on render or when joining areas */
-	if (!handler->op_region || !handler->op_region->manipulator_map)
+	if (!handler->op_region || !handler->op_region->manipulator_map) {
 		return;
-
-	/* hide operator manipulators */
-	if (!modal_running && ot->mgroup_type) {
-		ot->mgroup_type->op = NULL;
 	}
 
 	wmManipulatorMap *mmap = handler->op_region->manipulator_map;
diff --git a/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h b/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
index 4a0740d793a..836446fbc4c 100644
--- a/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
+++ b/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
@@ -59,10 +59,6 @@ void wm_manipulatortype_init(void);
 void MANIPULATORGROUP_OT_manipulator_select(struct wmOperatorType *ot);
 void MANIPULATORGROUP_OT_manipulator_tweak(struct wmOperatorType *ot);
 
-void  wm_manipulatorgroup_attach_to_modal_handler(
-        struct bContext *C, struct wmEventHandler *handler,
-        struct wmManipulatorGroupType *wgt, struct wmOperator *op);
-
 /* -------------------------------------------------------------------- */
 /* wmManipulatorMap */
 
@@ -72,8 +68,7 @@ void wm_manipulatormaptypes_free(void);
 void wm_manipulators_keymap(struct wmKeyConfig *keyconf);
 
 void wm_manipulatormaps_handled_modal_update(
-        bContext *C, struct wmEvent *event, struct wmEventHandler *handler,
-        const struct wmOperatorType *ot);
+        bContext *C, struct wmEvent *event, struct wmEventHandler *handler);
 void wm_manipulatormap_handler_context(bContext *C, struct wmEventHandler *handler);
 
 struct wmManipulator *wm_manipulatormap_find_highlighted_manipulator(




More information about the Bf-blender-cvs mailing list