[Bf-blender-cvs] [070dd04a2a4] custom-manipulators: Cleanup widget API

Campbell Barton noreply at git.blender.org
Thu Jun 8 16:12:18 CEST 2017


Commit: 070dd04a2a4cc5a2984890130a0bd902ae0cfa89
Author: Campbell Barton
Date:   Fri Jun 9 00:13:32 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rB070dd04a2a4cc5a2984890130a0bd902ae0cfa89

Cleanup widget API

Rename handler -> modal (matches operator)

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

M	source/blender/editors/include/ED_transform.h
M	source/blender/editors/manipulator_library/arrow3d_manipulator.c
M	source/blender/editors/manipulator_library/cage2d_manipulator.c
M	source/blender/editors/space_node/node_widgets.c
M	source/blender/editors/space_view3d/view3d_manipulators.c
M	source/blender/editors/transform/transform_manipulator.c
M	source/blender/editors/transform/transform_manipulator2d.c
M	source/blender/makesrna/intern/rna_wm_manipulator.c
M	source/blender/makesrna/intern/rna_wm_manipulator_api.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_api.h
M	source/blender/windowmanager/manipulators/WM_manipulator_types.h
M	source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M	source/blender/windowmanager/manipulators/intern/wm_manipulator_intern.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_fn.h
M	source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
M	source/blenderplayer/bad_level_call_stubs/stubs.c

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

diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index a20d2925564..0a790c72686 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -161,7 +161,7 @@ void TRANSFORM_WGT_manipulator(struct wmManipulatorGroupType *wgt);
 
 void TRANSFORM_WGT_object(struct wmManipulatorGroupType *wgt);
 
-bool WIDGETGROUP_manipulator2d_poll(const struct bContext *C, struct wmManipulatorGroupType *wgrouptype);
+bool WIDGETGROUP_manipulator2d_poll(const struct bContext *C, struct wmManipulatorGroupType *wgt);
 void WIDGETGROUP_manipulator2d_init(const struct bContext *C, struct wmManipulatorGroup *wgroup);
 void WIDGETGROUP_manipulator2d_refresh(const struct bContext *C, struct wmManipulatorGroup *wgroup);
 void WIDGETGROUP_manipulator2d_draw_prepare(const struct bContext *C, struct wmManipulatorGroup *wgroup);
diff --git a/source/blender/editors/manipulator_library/arrow3d_manipulator.c b/source/blender/editors/manipulator_library/arrow3d_manipulator.c
index 9c04b99074d..954941ebe34 100644
--- a/source/blender/editors/manipulator_library/arrow3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/arrow3d_manipulator.c
@@ -255,7 +255,7 @@ static void manipulator_arrow_draw(const bContext *UNUSED(C), wmManipulator *man
  * Calculate arrow offset independent from prop min value,
  * meaning the range will not be offset by min value first.
  */
-static void manipulator_arrow_handler(bContext *C, wmManipulator *manipulator, const wmEvent *event, const int flag)
+static void manipulator_arrow_modal(bContext *C, wmManipulator *manipulator, const wmEvent *event, const int flag)
 {
 	ArrowManipulator3D *arrow = (ArrowManipulator3D *)manipulator;
 	ManipulatorInteraction *inter = manipulator->interaction_data;
@@ -534,7 +534,7 @@ static void MANIPULATOR_WT_arrow_3d(wmManipulatorType *wt)
 	wt->draw_select = manipulator_arrow_render_3d_intersect;
 	wt->position_get = manipulator_arrow_get_final_pos;
 	wt->intersect = NULL;
-	wt->handler = manipulator_arrow_handler;
+	wt->modal = manipulator_arrow_modal;
 	wt->invoke = manipulator_arrow_invoke;
 	wt->prop_data_update = manipulator_arrow_prop_data_update;
 	wt->exit = manipulator_arrow_exit;
diff --git a/source/blender/editors/manipulator_library/cage2d_manipulator.c b/source/blender/editors/manipulator_library/cage2d_manipulator.c
index cb4ef6879ff..20eeab9d90d 100644
--- a/source/blender/editors/manipulator_library/cage2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/cage2d_manipulator.c
@@ -414,7 +414,7 @@ static void manipulator_rect_transform_invoke(
 	manipulator->interaction_data = data;
 }
 
-static void manipulator_rect_transform_handler(
+static void manipulator_rect_transform_modal(
         bContext *C, wmManipulator *manipulator, const wmEvent *event,
         const int UNUSED(flag))
 {
@@ -580,7 +580,7 @@ static void MANIPULATOR_WT_cage(wmManipulatorType *wt)
 	wt->draw = manipulator_rect_transform_draw;
 	wt->invoke = manipulator_rect_transform_invoke;
 	wt->prop_data_update = manipulator_rect_transform_prop_data_update;
-	wt->handler = manipulator_rect_transform_handler;
+	wt->modal = manipulator_rect_transform_modal;
 	wt->intersect = manipulator_rect_transform_intersect;
 	wt->exit = manipulator_rect_transform_exit;
 	wt->cursor_get = manipulator_rect_transform_get_cursor;
diff --git a/source/blender/editors/space_node/node_widgets.c b/source/blender/editors/space_node/node_widgets.c
index 2ff6472f8d0..0862499e567 100644
--- a/source/blender/editors/space_node/node_widgets.c
+++ b/source/blender/editors/space_node/node_widgets.c
@@ -42,7 +42,7 @@
 #include "node_intern.h"
 
 
-static bool WIDGETGROUP_node_transform_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgrouptype))
+static bool WIDGETGROUP_node_transform_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
 	SpaceNode *snode = CTX_wm_space_node(C);
 
diff --git a/source/blender/editors/space_view3d/view3d_manipulators.c b/source/blender/editors/space_view3d/view3d_manipulators.c
index 1db174e84dc..b249936f6fe 100644
--- a/source/blender/editors/space_view3d/view3d_manipulators.c
+++ b/source/blender/editors/space_view3d/view3d_manipulators.c
@@ -60,7 +60,7 @@
 /** \name Lamp Manipulators
  * \{ */
 
-static bool WIDGETGROUP_lamp_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgrouptype))
+static bool WIDGETGROUP_lamp_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
 	Object *ob = CTX_data_active_object(C);
 
@@ -132,7 +132,7 @@ struct CameraWidgetGroup {
 	wmManipulator *ortho_scale;
 };
 
-static bool WIDGETGROUP_camera_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgrouptype))
+static bool WIDGETGROUP_camera_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
 	Object *ob = CTX_data_active_object(C);
 
@@ -297,7 +297,7 @@ void VIEW3D_WGT_camera(wmManipulatorGroupType *wgt)
 /** \name Force Field Manipulators
  * \{ */
 
-static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgrouptype))
+static bool WIDGETGROUP_forcefield_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
 	Object *ob = CTX_data_active_object(C);
 
@@ -367,7 +367,7 @@ void VIEW3D_WGT_force_field(wmManipulatorGroupType *wgt)
 #define MAX_ARMATURE_FACEMAP_NAME (2 * MAX_NAME + 1) /* "OBJECTNAME_FACEMAPNAME" */
 
 
-static bool WIDGETGROUP_armature_facemaps_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgrouptype))
+static bool WIDGETGROUP_armature_facemaps_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
 	Object *ob = CTX_data_active_object(C);
 
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 2b06eb34bcb..1309e5bcf42 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -1118,7 +1118,7 @@ static ManipulatorGroup *manipulatorgroup_init(wmManipulatorGroup *wgroup)
 /**
  * Custom handler for manipulator widgets
  */
-static void manipulator_handler(
+static void manipulator_modal(
         bContext *C, wmManipulator *widget, const wmEvent *UNUSED(event), const int UNUSED(flag))
 {
 	const ScrArea *sa = CTX_wm_area(C);
@@ -1150,7 +1150,7 @@ static void WIDGETGROUP_manipulator_init(const bContext *UNUSED(C), wmManipulato
 		manipulator_get_axis_constraint(axis_idx, constraint_axis);
 
 		/* custom handler! */
-		WM_manipulator_set_fn_custom_handler(axis, manipulator_handler);
+		WM_manipulator_set_fn_custom_modal(axis, manipulator_modal);
 
 		switch(axis_idx) {
 			case MAN_AXIS_TRANS_X:
@@ -1330,7 +1330,7 @@ static void WIDGETGROUP_manipulator_draw_prepare(const bContext *C, wmManipulato
 	MAN_ITER_AXES_END;
 }
 
-static bool WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmManipulatorGroupType *UNUSED(wgrouptype))
+static bool WIDGETGROUP_manipulator_poll(const struct bContext *C, struct wmManipulatorGroupType *UNUSED(wgt))
 {
 	/* it's a given we only use this in 3D view */
 	const ScrArea *sa = CTX_wm_area(C);
@@ -1367,12 +1367,12 @@ static void WIDGETGROUP_object_manipulator_init(const bContext *C, wmManipulator
 	WIDGETGROUP_manipulator_init(C, wgroup);
 }
 
-static bool WIDGETGROUP_object_manipulator_poll(const bContext *C, wmManipulatorGroupType *wgrouptype)
+static bool WIDGETGROUP_object_manipulator_poll(const bContext *C, wmManipulatorGroupType *wgt)
 {
 	Object *ob = ED_object_active_context((bContext *)C);
 
 	if (ED_operator_object_active((bContext *)C)) {
-		if (STREQ(wgrouptype->idname, ob->id.name)) {
+		if (STREQ(wgt->idname, ob->id.name)) {
 			return true;
 		}
 	}
diff --git a/source/blender/editors/transform/transform_manipulator2d.c b/source/blender/editors/transform/transform_manipulator2d.c
index 67aab461e11..60e02648537 100644
--- a/source/blender/editors/transform/transform_manipulator2d.c
+++ b/source/blender/editors/transform/transform_manipulator2d.c
@@ -192,7 +192,7 @@ void WIDGETGROUP_manipulator2d_init(const bContext *UNUSED(C), wmManipulatorGrou
 		manipulator2d_get_axis_color(axis_idx, col, col_hi);
 
 		/* custom handler! */
-		WM_manipulator_set_fn_custom_handler(axis, manipulator2d_handler);
+		WM_manipulator_set_fn_custom_modal(axis, manipulator2d_handler);
 		/* set up widget data */
 		ED_manipulator_arrow2d_set_angle(axis, -M_PI_2 * axis_idx);
 		ED_manipulator_arrow2d_set_line_len(axis, 0.8f);
@@ -240,7 +240,7 @@ void WIDGETGROUP_manipulator2d_draw_prepare(const bContext *C, wmManipulatorGrou
  * - Called on every redraw, better to do a more simple poll and check for selection in _refresh
  * - UV editing only, could be expanded for other things.
  */
-bool WIDGETGROUP_manipulator2d_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgrouptype))
+bool WIDGETGROUP_manipulator2d_poll(const bContext *C, wmManipulatorGroupType *UNUSED(wgt))
 {
 	SpaceImage *sima = CTX_wm_space_image(C);
 	Object *obedit = CTX_data_edit_object(C);
diff --git a/source/blender/makesrna/intern/rna_wm_manipulator.c b/source/blender/makesrna/intern/rna_wm_manipulator.c
index 101ebb75df8..a0b19cf3c78 100644
--- a/source/blender/makesrna/intern/rna_wm_manipulator.c
+++ b/source/blender/makesrna/intern/rna_wm_manipulator.c
@@ -137,17 +137,17 @@ static int rna_manipulator_intersect_cb(
 	return intersect_id;
 }
 
-static void rna_manipulator_handler_cb(
+static void rna_manipulator_modal_cb(
         struct bContext *C, struct wmManipulator *mpr, const struct wmEvent *event, int tweak)
 {
-	extern FunctionRNA rna_Manipulator_handler_func;
+	extern FunctionRNA rna_Manipulator_modal_func;
 	wmManipulatorGroup *mgroup = WM_manipulator_get_parent_group(mpr);
 	PointerRNA mpr_ptr;
 	ParameterList list;
 	FunctionRNA *func;
 	RNA_pointer_create(NULL, mpr->type->ext.srna, mpr, &mpr_ptr);
-	/* RNA_struct_find_function(&mpr_ptr, "handler"); */
-	func = &rna_Manipulator_handler_func;
+	/* RNA_struct_find_function(&mpr_ptr, "modal"); */
+	func = &rna_Manipulator_modal_func;
 	RNA_parameter_list_create(&list, &mpr_ptr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
 	RNA_parameter_set_lookup(&list, "manipulator", &

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list