[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55230] trunk/blender/source: code cleanup : use const events for modal and invoke operators.

Campbell Barton ideasman42 at gmail.com
Wed Mar 13 10:03:47 CET 2013


Revision: 55230
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55230
Author:   campbellbarton
Date:     2013-03-13 09:03:46 +0000 (Wed, 13 Mar 2013)
Log Message:
-----------
code cleanup: use const events for modal and invoke operators.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/anim_channels_edit.c
    trunk/blender/source/blender/editors/animation/anim_markers.c
    trunk/blender/source/blender/editors/animation/anim_ops.c
    trunk/blender/source/blender/editors/animation/keyframing.c
    trunk/blender/source/blender/editors/animation/keyingsets.c
    trunk/blender/source/blender/editors/armature/armature_add.c
    trunk/blender/source/blender/editors/armature/armature_relations.c
    trunk/blender/source/blender/editors/armature/armature_select.c
    trunk/blender/source/blender/editors/armature/editarmature_sketch.c
    trunk/blender/source/blender/editors/armature/pose_edit.c
    trunk/blender/source/blender/editors/armature/pose_group.c
    trunk/blender/source/blender/editors/armature/pose_lib.c
    trunk/blender/source/blender/editors/armature/pose_select.c
    trunk/blender/source/blender/editors/armature/pose_slide.c
    trunk/blender/source/blender/editors/curve/editcurve.c
    trunk/blender/source/blender/editors/curve/editfont.c
    trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
    trunk/blender/source/blender/editors/include/ED_mesh.h
    trunk/blender/source/blender/editors/include/ED_numinput.h
    trunk/blender/source/blender/editors/include/ED_transform.h
    trunk/blender/source/blender/editors/interface/interface_ops.c
    trunk/blender/source/blender/editors/interface/view2d_ops.c
    trunk/blender/source/blender/editors/io/io_collada.c
    trunk/blender/source/blender/editors/mask/mask_add.c
    trunk/blender/source/blender/editors/mask/mask_ops.c
    trunk/blender/source/blender/editors/mask/mask_select.c
    trunk/blender/source/blender/editors/mesh/editface.c
    trunk/blender/source/blender/editors/mesh/editmesh_knife.c
    trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c
    trunk/blender/source/blender/editors/mesh/editmesh_rip.c
    trunk/blender/source/blender/editors/mesh/editmesh_select.c
    trunk/blender/source/blender/editors/mesh/editmesh_tools.c
    trunk/blender/source/blender/editors/mesh/mesh_data.c
    trunk/blender/source/blender/editors/metaball/mball_edit.c
    trunk/blender/source/blender/editors/object/object_add.c
    trunk/blender/source/blender/editors/object/object_bake.c
    trunk/blender/source/blender/editors/object/object_constraint.c
    trunk/blender/source/blender/editors/object/object_edit.c
    trunk/blender/source/blender/editors/object/object_modifier.c
    trunk/blender/source/blender/editors/object/object_relations.c
    trunk/blender/source/blender/editors/physics/particle_edit.c
    trunk/blender/source/blender/editors/physics/physics_fluid.c
    trunk/blender/source/blender/editors/physics/rigidbody_world.c
    trunk/blender/source/blender/editors/render/render_internal.c
    trunk/blender/source/blender/editors/render/render_opengl.c
    trunk/blender/source/blender/editors/render/render_shading.c
    trunk/blender/source/blender/editors/render/render_view.c
    trunk/blender/source/blender/editors/screen/screen_ops.c
    trunk/blender/source/blender/editors/screen/screendump.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_hide.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
    trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt_uv.c
    trunk/blender/source/blender/editors/sound/sound_ops.c
    trunk/blender/source/blender/editors/space_action/action_edit.c
    trunk/blender/source/blender/editors/space_action/action_select.c
    trunk/blender/source/blender/editors/space_buttons/buttons_ops.c
    trunk/blender/source/blender/editors/space_clip/clip_dopesheet_ops.c
    trunk/blender/source/blender/editors/space_clip/clip_graph_ops.c
    trunk/blender/source/blender/editors/space_clip/clip_intern.h
    trunk/blender/source/blender/editors/space_clip/clip_ops.c
    trunk/blender/source/blender/editors/space_clip/space_clip.c
    trunk/blender/source/blender/editors/space_clip/tracking_ops.c
    trunk/blender/source/blender/editors/space_clip/tracking_select.c
    trunk/blender/source/blender/editors/space_console/console_ops.c
    trunk/blender/source/blender/editors/space_console/space_console.c
    trunk/blender/source/blender/editors/space_file/file_ops.c
    trunk/blender/source/blender/editors/space_graph/graph_edit.c
    trunk/blender/source/blender/editors/space_graph/graph_ops.c
    trunk/blender/source/blender/editors/space_graph/graph_select.c
    trunk/blender/source/blender/editors/space_image/image_ops.c
    trunk/blender/source/blender/editors/space_image/space_image.c
    trunk/blender/source/blender/editors/space_info/info_ops.c
    trunk/blender/source/blender/editors/space_info/info_report.c
    trunk/blender/source/blender/editors/space_logic/logic_ops.c
    trunk/blender/source/blender/editors/space_nla/nla_channels.c
    trunk/blender/source/blender/editors/space_nla/nla_edit.c
    trunk/blender/source/blender/editors/space_nla/nla_select.c
    trunk/blender/source/blender/editors/space_node/node_add.c
    trunk/blender/source/blender/editors/space_node/node_edit.c
    trunk/blender/source/blender/editors/space_node/node_group.c
    trunk/blender/source/blender/editors/space_node/node_relationships.c
    trunk/blender/source/blender/editors/space_node/node_select.c
    trunk/blender/source/blender/editors/space_node/node_view.c
    trunk/blender/source/blender/editors/space_node/space_node.c
    trunk/blender/source/blender/editors/space_outliner/outliner_edit.c
    trunk/blender/source/blender/editors/space_outliner/outliner_intern.h
    trunk/blender/source/blender/editors/space_outliner/outliner_select.c
    trunk/blender/source/blender/editors/space_outliner/outliner_tools.c
    trunk/blender/source/blender/editors/space_outliner/space_outliner.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_select.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_view.c
    trunk/blender/source/blender/editors/space_sequencer/space_sequencer.c
    trunk/blender/source/blender/editors/space_text/space_text.c
    trunk/blender/source/blender/editors/space_text/text_autocomplete.c
    trunk/blender/source/blender/editors/space_text/text_ops.c
    trunk/blender/source/blender/editors/space_view3d/space_view3d.c
    trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
    trunk/blender/source/blender/editors/space_view3d/view3d_fly.c
    trunk/blender/source/blender/editors/space_view3d/view3d_header.c
    trunk/blender/source/blender/editors/space_view3d/view3d_ruler.c
    trunk/blender/source/blender/editors/space_view3d/view3d_select.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c
    trunk/blender/source/blender/editors/transform/transform.c
    trunk/blender/source/blender/editors/transform/transform.h
    trunk/blender/source/blender/editors/transform/transform_generics.c
    trunk/blender/source/blender/editors/transform/transform_input.c
    trunk/blender/source/blender/editors/transform/transform_manipulator.c
    trunk/blender/source/blender/editors/transform/transform_ops.c
    trunk/blender/source/blender/editors/transform/transform_snap.c
    trunk/blender/source/blender/editors/util/numinput.c
    trunk/blender/source/blender/editors/util/undo.c
    trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
    trunk/blender/source/blender/editors/uvedit/uvedit_smart_stitch.c
    trunk/blender/source/blender/editors/uvedit/uvedit_unwrap_ops.c
    trunk/blender/source/blender/makesrna/intern/rna_wm.c
    trunk/blender/source/blender/makesrna/intern/rna_wm_api.c
    trunk/blender/source/blender/windowmanager/WM_api.h
    trunk/blender/source/blender/windowmanager/WM_types.h
    trunk/blender/source/blender/windowmanager/intern/wm_dragdrop.c
    trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
    trunk/blender/source/blender/windowmanager/intern/wm_gesture.c
    trunk/blender/source/blender/windowmanager/intern/wm_operators.c
    trunk/blender/source/blenderplayer/bad_level_call_stubs/stubs.c

Modified: trunk/blender/source/blender/editors/animation/anim_channels_edit.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_edit.c	2013-03-13 07:16:53 UTC (rev 55229)
+++ trunk/blender/source/blender/editors/animation/anim_channels_edit.c	2013-03-13 09:03:46 UTC (rev 55230)
@@ -2260,7 +2260,7 @@
 	ED_region_tag_redraw(ac->ar);
 }
 
-static int animchannels_rename_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *evt)
+static int animchannels_rename_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
 {
 	bAnimContext ac;
 	ARegion *ar;
@@ -2281,7 +2281,7 @@
 	 *		so that the tops of channels get caught ok. Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use
 	 *		ACHANNEL_HEIGHT_HALF.
 	 */
-	UI_view2d_region_to_view(v2d, evt->mval[0], evt->mval[1], &x, &y);
+	UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y);
 	
 	if (ac.datatype == ANIMCONT_NLA) {
 		SpaceNla *snla = (SpaceNla *)ac.sl;
@@ -2594,7 +2594,7 @@
 /* ------------------- */
 
 /* handle clicking */
-static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	bAnimContext ac;
 	ARegion *ar;

Modified: trunk/blender/source/blender/editors/animation/anim_markers.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_markers.c	2013-03-13 07:16:53 UTC (rev 55229)
+++ trunk/blender/source/blender/editors/animation/anim_markers.c	2013-03-13 09:03:46 UTC (rev 55230)
@@ -514,8 +514,8 @@
  *			that operator would otherwise have used. If NULL, the operator's standard
  *			exec() callback will be called instead in the appropriate places.
  */
-static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent *evt, 
-                                           int (*invoke_func)(bContext *, wmOperator *, wmEvent *))
+static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, const wmEvent *event,
+                                           int (*invoke_func)(bContext *, wmOperator *, const wmEvent *))
 {
 	ScrArea *sa = CTX_wm_area(C);
 	int retval = OPERATOR_PASS_THROUGH;
@@ -524,7 +524,7 @@
 	
 	/* allow operator to run now */
 	if (invoke_func)
-		retval = invoke_func(C, op, evt);
+		retval = invoke_func(C, op, event);
 	else if (op->type->exec)
 		retval = op->type->exec(C, op);
 	else
@@ -545,9 +545,9 @@
  * though will need to implement their own wrapper which calls the second-tier callback themselves
  * (passing through the custom invoke function they use)
  */
-static int ed_markers_opwrap_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_markers_opwrap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
-	return ed_markers_opwrap_invoke_custom(C, op, evt, NULL);
+	return ed_markers_opwrap_invoke_custom(C, op, event, NULL);
 }
 
 /* ************************** add markers *************************** */
@@ -685,14 +685,14 @@
 	ED_area_headerprint(CTX_wm_area(C), NULL);
 }
 
-static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	if (ed_marker_move_init(C, op)) {
 		MarkerMove *mm = op->customdata;
 		
-		mm->evtx = evt->x;
-		mm->firstx = evt->x;
-		mm->event_type = evt->type;
+		mm->evtx = event->x;
+		mm->firstx = event->x;
+		mm->event_type = event->type;
 		
 		/* add temp handler */
 		WM_event_add_modal_handler(C, op);
@@ -706,9 +706,9 @@
 	return OPERATOR_CANCELLED;
 }
 
-static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event)
 {
-	return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_move_invoke);
+	return ed_markers_opwrap_invoke_custom(C, op, event, ed_marker_move_invoke);
 }
 
 /* note, init has to be called succesfully */
@@ -757,7 +757,7 @@
 
 
 
-static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	Scene *scene = CTX_data_scene(C);
 	MarkerMove *mm = op->customdata;
@@ -766,14 +766,14 @@
 	float dx, fac;
 	char str[256];
 		
-	switch (evt->type) {
+	switch (event->type) {
 		case ESCKEY:
 			ed_marker_move_cancel(C, op);
 			return OPERATOR_CANCELLED;
 		
 		case RIGHTMOUSE:
 			/* press = user manually demands transform to be canceled */
-			if (evt->val == KM_PRESS) {
+			if (event->val == KM_PRESS) {
 				ed_marker_move_cancel(C, op);
 				return OPERATOR_CANCELLED;
 			}
@@ -783,7 +783,7 @@
 		case PADENTER:
 		case LEFTMOUSE:
 		case MIDDLEMOUSE:
-			if (WM_modal_tweak_exit(evt, mm->event_type)) {
+			if (WM_modal_tweak_exit(event, mm->event_type)) {
 				ed_marker_move_exit(C, op);
 				WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
 				WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
@@ -796,17 +796,17 @@
 			
 			dx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
 			
-			if (evt->x != mm->evtx) {   /* XXX maybe init for first time */
+			if (event->x != mm->evtx) {   /* XXX maybe init for first time */
 				int a, offs, totmark = 0;
 				
-				mm->evtx = evt->x;
+				mm->evtx = event->x;
 				
-				fac = ((float)(evt->x - mm->firstx) * dx);
+				fac = ((float)(event->x - mm->firstx) * dx);
 				
 				if (mm->slink->spacetype == SPACE_TIME) 
-					apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, FPS, 0.1 * FPS, 0);
+					apply_keyb_grid(event->shift, event->ctrl, &fac, 0.0, FPS, 0.1 * FPS, 0);
 				else
-					apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, 1.0, 0.1, 0 /*was: U.flag & USER_AUTOGRABGRID*/);
+					apply_keyb_grid(event->shift, event->ctrl, &fac, 0.0, 1.0, 0.1, 0 /*was: U.flag & USER_AUTOGRABGRID*/);
 				
 				offs = (int)fac;
 				RNA_int_set(op->ptr, "frames", offs);
@@ -865,8 +865,8 @@
 			}
 	}
 
-	if (evt->val == KM_PRESS) {
-		if (handleNumInput(&mm->num, evt)) {
+	if (event->val == KM_PRESS) {
+		if (handleNumInput(&mm->num, event)) {
 			char str_tx[NUM_STR_REP_LEN];
 			float value = RNA_int_get(op->ptr, "frames");
 			applyNumInput(&mm->num, &value);
@@ -982,15 +982,15 @@
 	
 }
 
-static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	ed_marker_duplicate_apply(C);
-	return ed_marker_move_invoke(C, op, evt);
+	return ed_marker_move_invoke(C, op, event);
 }
 
-static int ed_marker_duplicate_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_duplicate_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event)
 {
-	return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_duplicate_invoke);
+	return ed_markers_opwrap_invoke_custom(C, op, event, ed_marker_duplicate_invoke);
 }
 
 static void MARKER_OT_duplicate(wmOperatorType *ot)
@@ -1037,7 +1037,7 @@
 	}
 }
 
-static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
+static int ed_marker_select(bContext *C, const wmEvent *event, int extend, int camera)
 {
 	ListBase *markers = ED_context_get_markers(C);
 	ARegion *ar = CTX_wm_region(C);
@@ -1048,8 +1048,8 @@
 	if (markers == NULL)
 		return OPERATOR_PASS_THROUGH;
 
-	x = evt->x - ar->winrct.xmin;
-	y = evt->y - ar->winrct.ymin;
+	x = event->x - ar->winrct.xmin;
+	y = event->y - ar->winrct.ymin;
 	
 	UI_view2d_region_to_view(v2d, x, y, &viewx, NULL);
 	
@@ -1104,19 +1104,19 @@
 	return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 }
 
-static int ed_marker_select_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	short extend = RNA_boolean_get(op->ptr, "extend");
 	short camera = 0;
 #ifdef DURIAN_CAMERA_SWITCH
 	camera = RNA_boolean_get(op->ptr, "camera");
 #endif
-	return ed_marker_select(C, evt, extend, camera);
+	return ed_marker_select(C, event, extend, camera);
 }
 
-static int ed_marker_select_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_select_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event)
 {
-	return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_select_invoke);
+	return ed_markers_opwrap_invoke_custom(C, op, event, ed_marker_select_invoke);
 }
 
 static void MARKER_OT_select(wmOperatorType *ot)
@@ -1201,9 +1201,9 @@
 	return 1;
 }
 
-static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event)
 {
-	return ed_markers_opwrap_invoke_custom(C, op, evt, WM_border_select_invoke);
+	return ed_markers_opwrap_invoke_custom(C, op, event, WM_border_select_invoke);
 }
 
 static void MARKER_OT_select_border(wmOperatorType *ot)
@@ -1310,10 +1310,10 @@
 	return OPERATOR_FINISHED;
 }
 
-static int ed_marker_delete_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_delete_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	// XXX: must we keep these confirmations?
-	return ed_markers_opwrap_invoke_custom(C, op, evt, WM_operator_confirm);
+	return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_confirm);
 }
 
 static void MARKER_OT_delete(wmOperatorType *ot)
@@ -1353,7 +1353,7 @@
 	}
 }
 
-static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event)
 {
 	/* must initialize the marker name first if there is a marker selected */
 	TimeMarker *marker = ED_markers_get_first_selected(ED_context_get_markers(C));
@@ -1361,7 +1361,7 @@
 		RNA_string_set(op->ptr, "name", marker->name);
 	
 	/* now see if the operator is usable */
-	return ed_markers_opwrap_invoke_custom(C, op, evt, WM_operator_props_popup);
+	return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_props_popup);
 }
 
 static void MARKER_OT_rename(wmOperatorType *ot)
@@ -1415,9 +1415,9 @@
 	return OPERATOR_FINISHED;
 }
 
-static int ed_marker_make_links_scene_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+static int ed_marker_make_links_scene_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event)
 {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list