Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-27 19:15:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-27 19:15:55 +0400
commitf1acd6ac3e78aa4b898ee310dae2814015616e5f (patch)
treef9e12a8ac3f65b75465920ec188803751fe06c8b
parent49e0c832e16195d8a656798830a63074eb6cd6c7 (diff)
code cleanup: pass mouse position as int[2] rather then wmEvent
-rw-r--r--source/blender/compositor/nodes/COM_ScaleNode.cpp6
-rw-r--r--source/blender/editors/include/ED_clip.h3
-rw-r--r--source/blender/editors/include/ED_image.h3
-rw-r--r--source/blender/editors/include/ED_mask.h2
-rw-r--r--source/blender/editors/mask/mask_add.c4
-rw-r--r--source/blender/editors/mask/mask_edit.c9
-rw-r--r--source/blender/editors/mask/mask_ops.c6
-rw-r--r--source/blender/editors/mask/mask_select.c4
-rw-r--r--source/blender/editors/space_clip/clip_editor.c5
-rw-r--r--source/blender/editors/space_clip/clip_ops.c8
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c6
-rw-r--r--source/blender/editors/space_clip/tracking_select.c2
-rw-r--r--source/blender/editors/space_image/image_edit.c7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c6
14 files changed, 36 insertions, 35 deletions
diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp
index 95b048b6cad..c51782b77af 100644
--- a/source/blender/compositor/nodes/COM_ScaleNode.cpp
+++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp
@@ -64,7 +64,7 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
break;
case CMP_SCALE_RENDERPERCENT: {
- const RenderData *data = context->getRenderData();
+ const RenderData *rd = context->getRenderData();
ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation();
/* framing options */
@@ -72,8 +72,8 @@ void ScaleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
operation->setIsCrop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0);
operation->setOffset(bnode->custom3, bnode->custom4);
- operation->setNewWidth(data->xsch * data->size / 100.0f);
- operation->setNewHeight(data->ysch * data->size / 100.0f);
+ operation->setNewWidth(rd->xsch * rd->size / 100.0f);
+ operation->setNewHeight(rd->ysch * rd->size / 100.0f);
inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
outputSocket->relinkConnections(operation->getOutputSocket(0));
operation->getInputSocket(0)->getConnection()->setIgnoreResizeCheck(true);
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 8c4eb5c3879..3a1d63574a6 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -39,7 +39,6 @@ struct Main;
struct Mask;
struct MovieClip;
struct SpaceClip;
-struct wmEvent;
/* ** clip_editor.c ** */
@@ -69,7 +68,7 @@ int ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, int fit
void ED_clip_point_undistorted_pos(struct SpaceClip *sc, const float co[2], float r_co[2]);
void ED_clip_point_stable_pos(struct SpaceClip *sc, struct ARegion *ar, float x, float y, float *xr, float *yr);
void ED_clip_point_stable_pos__reverse(struct SpaceClip *sc, struct ARegion *ar, const float co[2], float r_co[2]);
-void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *ar, struct wmEvent *event, float co[2]);
+void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *ar, const int mval[2], float co[2]);
int ED_space_clip_check_show_trackedit(struct SpaceClip *sc);
int ED_space_clip_check_show_maskedit(struct SpaceClip *sc);
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index 830a6104770..ae30b646db0 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -39,7 +39,6 @@ struct ToolSettings;
struct uiBlock;
struct wmWindowManager;
struct ARegion;
-struct wmEvent;
/* image_edit.c, exported for transform */
struct Image *ED_space_image(struct SpaceImage *sima);
@@ -63,7 +62,7 @@ void ED_space_image_uv_sculpt_update(struct wmWindowManager *wm, struct ToolSett
void ED_image_get_size(struct Image *ima, int *width, int *height);
void ED_image_get_aspect(struct Image *ima, float *aspx, float *aspy);
void ED_image_get_uv_aspect(struct Image *ima, float *aspx, float *aspy);
-void ED_image_mouse_pos(struct SpaceImage *sima, struct ARegion *ar, struct wmEvent *event, float co[2]);
+void ED_image_mouse_pos(struct SpaceImage *sima, struct ARegion *ar, const int mval[2], float co[2]);
void ED_image_point_pos(struct SpaceImage *sima, struct ARegion *ar, float x, float y, float *xr, float *yr);
void ED_image_point_pos__reverse(struct SpaceImage *sima, struct ARegion *ar, const float co[2], float r_co[2]);
diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h
index 72be9cc2726..9dd25114957 100644
--- a/source/blender/editors/include/ED_mask.h
+++ b/source/blender/editors/include/ED_mask.h
@@ -42,7 +42,7 @@ void ED_mask_zoom(struct ScrArea *sa, struct ARegion *ar, float *zoomx, float *z
void ED_mask_get_aspect(struct ScrArea *sa, struct ARegion *ar, float *aspx, float *aspy);
void ED_mask_pixelspace_factor(struct ScrArea *sa, struct ARegion *ar, float *scalex, float *scaley);
-void ED_mask_mouse_pos(struct ScrArea *sa, struct ARegion *ar, struct wmEvent *event, float co[2]);
+void ED_mask_mouse_pos(struct ScrArea *sa, struct ARegion *ar, const int mval[2], float co[2]);
void ED_mask_point_pos(struct ScrArea *sa, struct ARegion *ar, float x, float y, float *xr, float *yr);
void ED_mask_point_pos__reverse(struct ScrArea *sa, struct ARegion *ar,
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index 48c81894b55..958fad56b0c 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -621,7 +621,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
float co[2];
- ED_mask_mouse_pos(sa, ar, event, co);
+ ED_mask_mouse_pos(sa, ar, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
@@ -695,7 +695,7 @@ static int add_feather_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event
float co[2];
- ED_mask_mouse_pos(sa, ar, event, co);
+ ED_mask_mouse_pos(sa, ar, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index dc41424b1d9..85a8ae11111 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -90,20 +90,21 @@ int ED_maskedit_mask_poll(bContext *C)
/********************** registration *********************/
-void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, wmEvent *event, float co[2])
+/* takes event->mval */
+void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, const int mval[2], float co[2])
{
if (sa) {
switch (sa->spacetype) {
case SPACE_CLIP:
{
SpaceClip *sc = sa->spacedata.first;
- ED_clip_mouse_pos(sc, ar, event, co);
+ ED_clip_mouse_pos(sc, ar, mval, co);
BKE_mask_coord_from_movieclip(sc->clip, &sc->user, co, co);
break;
}
case SPACE_SEQ:
{
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+ UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &co[0], &co[1]);
break;
}
case SPACE_IMAGE:
@@ -111,7 +112,7 @@ void ED_mask_mouse_pos(ScrArea *sa, ARegion *ar, wmEvent *event, float co[2])
float frame_size[2];
SpaceImage *sima = sa->spacedata.first;
ED_space_image_get_size_fl(sima, frame_size);
- ED_image_mouse_pos(sima, ar, event, co);
+ ED_image_mouse_pos(sima, ar, mval, co);
BKE_mask_coord_from_frame(co, co, frame_size);
break;
}
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index 116c3dcede1..b1b3e0cf6c8 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -446,7 +446,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
float co[2], cv_score, feather_score;
const float threshold = 19;
- ED_mask_mouse_pos(sa, ar, event, co);
+ ED_mask_mouse_pos(sa, ar, event->mval, co);
ED_mask_get_size(sa, &width, &height);
cv_point = ED_mask_point_find_nearest(C, mask, co, threshold, &cv_masklay, &cv_spline, &is_handle, &cv_score);
@@ -511,7 +511,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, wmEvent *event)
copy_m3_m3(customdata->vec, point->bezt.vec);
if (BKE_mask_point_has_handle(point))
BKE_mask_point_handle(point, customdata->handle);
- ED_mask_mouse_pos(sa, ar, event, customdata->co);
+ ED_mask_mouse_pos(sa, ar, event->mval, customdata->co);
}
return customdata;
@@ -652,7 +652,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, wmEvent *event)
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
- ED_mask_mouse_pos(sa, ar, event, co);
+ ED_mask_mouse_pos(sa, ar, event->mval, co);
sub_v2_v2v2(dco, co, data->co);
if (data->action == SLIDE_ACTION_HANDLE) {
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index 81cfbb9b586..9c1b4f0fd42 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -348,7 +348,7 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
float co[2];
- ED_mask_mouse_pos(sa, ar, event, co);
+ ED_mask_mouse_pos(sa, ar, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
@@ -688,7 +688,7 @@ static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *
const float threshold = 19;
int change = FALSE;
- ED_mask_mouse_pos(sa, ar, event, co);
+ ED_mask_mouse_pos(sa, ar, event->mval, co);
point = ED_mask_point_find_nearest(C, mask, co, threshold, &masklay, &spline, &is_handle, NULL);
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 1cde271e599..54ee691b63b 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -439,9 +439,10 @@ void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, const float c
r_co[1] = (pos[1] * height * zoomy) + (float)sy;
}
-void ED_clip_mouse_pos(SpaceClip *sc, ARegion *ar, wmEvent *event, float co[2])
+/* takes event->mval */
+void ED_clip_mouse_pos(SpaceClip *sc, ARegion *ar, const int mval[2], float co[2])
{
- ED_clip_point_stable_pos(sc, ar, event->mval[0], event->mval[1], &co[0], &co[1]);
+ ED_clip_point_stable_pos(sc, ar, mval[0], mval[1], &co[0], &co[1]);
}
int ED_space_clip_check_show_trackedit(SpaceClip *sc)
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 1dabef75c21..f7222dae75f 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -119,7 +119,7 @@ static void sclip_zoom_set_factor_exec(bContext *C, wmEvent *event, float factor
if (event) {
SpaceClip *sc = CTX_wm_space_clip(C);
- ED_clip_mouse_pos(sc, ar, event, location);
+ ED_clip_mouse_pos(sc, ar, event->mval, location);
mpos = location;
}
@@ -483,7 +483,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
vpd->zoom = sc->zoom;
vpd->event_type = event->type;
- ED_clip_mouse_pos(sc, ar, event, vpd->location);
+ ED_clip_mouse_pos(sc, ar, event->mval, vpd->location);
WM_event_add_modal_handler(C, op);
}
@@ -605,7 +605,7 @@ static int view_zoom_in_invoke(bContext *C, wmOperator *op, wmEvent *event)
float location[2];
- ED_clip_mouse_pos(sc, ar, event, location);
+ ED_clip_mouse_pos(sc, ar, event->mval, location);
RNA_float_set_array(op->ptr, "location", location);
return view_zoom_in_exec(C, op);
@@ -648,7 +648,7 @@ static int view_zoom_out_invoke(bContext *C, wmOperator *op, wmEvent *event)
float location[2];
- ED_clip_mouse_pos(sc, ar, event, location);
+ ED_clip_mouse_pos(sc, ar, event->mval, location);
RNA_float_set_array(op->ptr, "location", location);
return view_zoom_out_exec(C, op);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 6821acc5f5a..77c4b527a11 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -132,7 +132,7 @@ static int add_marker_invoke(bContext *C, wmOperator *op, wmEvent *event)
float co[2];
- ED_clip_mouse_pos(sc, ar, event, co);
+ ED_clip_mouse_pos(sc, ar, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
@@ -543,7 +543,7 @@ MovieTrackingTrack *tracking_marker_check_slide(bContext *C, wmEvent *event, int
if (width == 0 || height == 0)
return NULL;
- ED_clip_mouse_pos(sc, ar, event, co);
+ ED_clip_mouse_pos(sc, ar, event->mval, co);
track = tracksbase->first;
while (track) {
@@ -641,7 +641,7 @@ static void *slide_marker_customdata(bContext *C, wmEvent *event)
if (width == 0 || height == 0)
return NULL;
- ED_clip_mouse_pos(sc, ar, event, co);
+ ED_clip_mouse_pos(sc, ar, event->mval, co);
track = tracking_marker_check_slide(C, event, &area, &action, &corner);
if (track) {
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index 26a596ead07..9581d7708fb 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -302,7 +302,7 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
}
- ED_clip_mouse_pos(sc, ar, event, co);
+ ED_clip_mouse_pos(sc, ar, event->mval, co);
RNA_float_set_array(op->ptr, "location", co);
return select_exec(C, op);
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index 65df6f98efb..81423560fb5 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -260,7 +260,8 @@ void ED_image_get_uv_aspect(Image *ima, float *aspx, float *aspy)
*aspy *= (float)h;
}
-void ED_image_mouse_pos(SpaceImage *sima, ARegion *ar, wmEvent *event, float co[2])
+/* takes event->mval */
+void ED_image_mouse_pos(SpaceImage *sima, ARegion *ar, const int mval[2], float co[2])
{
int sx, sy, width, height;
float zoomx, zoomy;
@@ -270,8 +271,8 @@ void ED_image_mouse_pos(SpaceImage *sima, ARegion *ar, wmEvent *event, float co[
UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
- co[0] = ((event->mval[0] - sx) / zoomx) / width;
- co[1] = ((event->mval[1] - sy) / zoomy) / height;
+ co[0] = ((mval[0] - sx) / zoomx) / width;
+ co[1] = ((mval[1] - sy) / zoomy) / height;
}
void ED_image_point_pos(SpaceImage *sima, ARegion *ar, float x, float y, float *xr, float *yr)
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 92c0f785ccb..057382549b6 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2140,13 +2140,13 @@ void SEQUENCER_OT_view_all_preview(wmOperatorType *ot)
static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
{
- RenderData *r = &CTX_data_scene(C)->r;
+ RenderData *rd = &CTX_data_scene(C)->r;
View2D *v2d = UI_view2d_fromcontext(C);
float ratio = RNA_float_get(op->ptr, "ratio");
- float winx = (int)(r->size * r->xsch) / 100;
- float winy = (int)(r->size * r->ysch) / 100;
+ float winx = (int)(rd->size * rd->xsch) / 100;
+ float winy = (int)(rd->size * rd->ysch) / 100;
float facx = (v2d->mask.xmax - v2d->mask.xmin) / winx;
float facy = (v2d->mask.ymax - v2d->mask.ymin) / winy;