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
path: root/source
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-01-20 19:33:10 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-01-20 19:33:10 +0300
commit89b6a7bae9160d762f085eff8e927bdac1a60801 (patch)
treec0a9985e5902d91d19d6341e537d737bbb76526d /source
parent587ca9e69b85195827fea372c880f6ba45ca83b7 (diff)
parent31e2786707049c40b9d8639639fd16a5cc0dce13 (diff)
Merge remote-tracking branch 'origin/blender-v2.82-release'
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c6
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c9
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c6
-rw-r--r--source/blender/editors/space_clip/clip_ops.c12
-rw-r--r--source/blender/editors/space_clip/tracking_ops_plane.c6
-rw-r--r--source/blender/editors/space_image/image_ops.c12
-rw-r--r--source/blender/windowmanager/intern/wm_operator_utils.c11
8 files changed, 46 insertions, 22 deletions
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index 02e4d0eb708..42fa3db7c57 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -95,6 +95,7 @@ typedef struct {
uint ob_store_len;
/* modal only */
+ int launch_event;
float mcenter[2];
void *draw_handle_pixel;
short gizmo_flag;
@@ -520,6 +521,8 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
opdata = op->customdata;
+ opdata->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
+
/* initialize mouse values */
if (!calculateTransformCenter(C, V3D_AROUND_CENTER_MEDIAN, center_3d, opdata->mcenter)) {
/* in this case the tool will likely do nothing,
@@ -710,7 +713,8 @@ static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
short eval = event->val;
/* When activated from toolbar, need to convert leftmouse release to confirm */
- if (etype == LEFTMOUSE && eval == KM_RELEASE && RNA_boolean_get(op->ptr, "release_confirm")) {
+ if (ELEM(etype, LEFTMOUSE, opdata->launch_event) && (eval == KM_RELEASE) &&
+ RNA_boolean_get(op->ptr, "release_confirm")) {
etype = EVT_MODAL_MAP;
eval = BEV_MODAL_CONFIRM;
}
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index 9e004f3e289..a1b1ea31ead 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -72,6 +72,7 @@ typedef struct {
uint ob_store_len;
/* modal only */
+ int launch_event;
float mcenter[2];
void *draw_handle_pixel;
short gizmo_flag;
@@ -348,6 +349,8 @@ static int edbm_inset_invoke(bContext *C, wmOperator *op, const wmEvent *event)
opdata = op->customdata;
+ opdata->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
+
/* initialize mouse values */
if (!calculateTransformCenter(C, V3D_AROUND_CENTER_MEDIAN, center_3d, opdata->mcenter)) {
/* in this case the tool will likely do nothing,
@@ -389,6 +392,12 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
}
}
+ else if ((event->type == opdata->launch_event) && (event->val == KM_RELEASE) &&
+ RNA_boolean_get(op->ptr, "release_confirm")) {
+ edbm_inset_calc(op);
+ edbm_inset_exit(C, op);
+ return OPERATOR_FINISHED;
+ }
else {
bool handled = false;
switch (event->type) {
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index de09a52258f..6d1a32d1c45 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -939,7 +939,7 @@ void PAINT_OT_grab_clone(wmOperatorType *ot)
/******************** sample color operator ********************/
typedef struct {
bool show_cursor;
- short event_type;
+ short launch_event;
float initcolor[3];
bool sample_palette;
} SampleColorData;
@@ -1000,7 +1000,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event
ARegion *ar = CTX_wm_region(C);
wmWindow *win = CTX_wm_window(C);
- data->event_type = event->type;
+ data->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
data->show_cursor = ((paint->flags & PAINT_SHOW_BRUSH) != 0);
copy_v3_v3(data->initcolor, BKE_brush_color_get(scene, brush));
data->sample_palette = false;
@@ -1036,7 +1036,7 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
Paint *paint = BKE_paint_get_active_from_context(C);
Brush *brush = BKE_paint_brush(paint);
- if ((event->type == data->event_type) && (event->val == KM_RELEASE)) {
+ if ((event->type == data->launch_event) && (event->val == KM_RELEASE)) {
if (data->show_cursor) {
paint->flags |= PAINT_SHOW_BRUSH;
}
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 6252741799a..7863e18394c 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -562,7 +562,7 @@ typedef struct {
float *dim_target;
float *rot_target;
float *pos_target;
- short event_type;
+ short launch_event;
} StencilControlData;
static void stencil_set_target(StencilControlData *scd)
@@ -626,7 +626,7 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev
stencil_set_target(scd);
scd->mode = RNA_enum_get(op->ptr, "mode");
- scd->event_type = event->type;
+ scd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
scd->area_size[0] = ar->winx;
scd->area_size[1] = ar->winy;
@@ -709,7 +709,7 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve
{
StencilControlData *scd = op->customdata;
- if (event->type == scd->event_type && event->val == KM_RELEASE) {
+ if (event->type == scd->launch_event && event->val == KM_RELEASE) {
MEM_freeN(op->customdata);
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 4a4b85cbf8f..3ede0158f7a 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -374,7 +374,7 @@ void CLIP_OT_reload(wmOperatorType *ot)
typedef struct ViewPanData {
float x, y;
float xof, yof, xorig, yorig;
- int event_type;
+ int launch_event;
bool own_cursor;
float *vec;
} ViewPanData;
@@ -406,7 +406,7 @@ static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event)
copy_v2_v2(&vpd->xof, vpd->vec);
copy_v2_v2(&vpd->xorig, &vpd->xof);
- vpd->event_type = event->type;
+ vpd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
WM_event_add_modal_handler(C, op);
}
@@ -493,7 +493,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_FINISHED;
default:
- if (event->type == vpd->event_type && event->val == KM_RELEASE) {
+ if (event->type == vpd->launch_event && event->val == KM_RELEASE) {
view_pan_exit(C, op, 0);
return OPERATOR_FINISHED;
@@ -548,7 +548,7 @@ void CLIP_OT_view_pan(wmOperatorType *ot)
typedef struct ViewZoomData {
float x, y;
float zoom;
- int event_type;
+ int launch_event;
float location[2];
wmTimer *timer;
double timer_lastdraw;
@@ -579,7 +579,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
vpd->x = event->x;
vpd->y = event->y;
vpd->zoom = sc->zoom;
- vpd->event_type = event->type;
+ vpd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
ED_clip_mouse_pos(sc, ar, event->mval, vpd->location);
@@ -697,7 +697,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
view_zoom_apply(C, vpd, op, event, use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS));
break;
default:
- if (event->type == vpd->event_type && event->val == KM_RELEASE) {
+ if (event->type == vpd->launch_event && event->val == KM_RELEASE) {
view_zoom_exit(C, op, 0);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_clip/tracking_ops_plane.c b/source/blender/editors/space_clip/tracking_ops_plane.c
index 7d2324d3f48..03fe1c74e2a 100644
--- a/source/blender/editors/space_clip/tracking_ops_plane.c
+++ b/source/blender/editors/space_clip/tracking_ops_plane.c
@@ -98,7 +98,7 @@ void CLIP_OT_create_plane_track(wmOperatorType *ot)
/********************** Slide plane marker corner operator *********************/
typedef struct SlidePlaneMarkerData {
- int event_type;
+ int launch_event;
MovieTrackingPlaneTrack *plane_track;
MovieTrackingPlaneMarker *plane_marker;
int width, height;
@@ -195,7 +195,7 @@ static void *slide_plane_marker_customdata(bContext *C, const wmEvent *event)
customdata = MEM_callocN(sizeof(SlidePlaneMarkerData), "slide plane marker data");
- customdata->event_type = event->type;
+ customdata->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
plane_marker = BKE_tracking_plane_marker_ensure(plane_track, framenr);
@@ -345,7 +345,7 @@ static int slide_plane_marker_modal(bContext *C, wmOperator *op, const wmEvent *
case LEFTMOUSE:
case RIGHTMOUSE:
- if (event->type == data->event_type && event->val == KM_RELEASE) {
+ if (event->type == data->launch_event && event->val == KM_RELEASE) {
/* Marker is now keyframed. */
data->plane_marker->flag &= ~PLANE_MARKER_TRACKED;
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 061ed978acd..2ed8b8c87ff 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -305,7 +305,7 @@ static bool image_sample_poll(bContext *C)
typedef struct ViewPanData {
float x, y;
float xof, yof;
- int event_type;
+ int launch_event;
bool own_cursor;
} ViewPanData;
@@ -327,7 +327,7 @@ static void image_view_pan_init(bContext *C, wmOperator *op, const wmEvent *even
vpd->y = event->y;
vpd->xof = sima->xof;
vpd->yof = sima->yof;
- vpd->event_type = event->type;
+ vpd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
WM_event_add_modal_handler(C, op);
}
@@ -398,7 +398,7 @@ static int image_view_pan_modal(bContext *C, wmOperator *op, const wmEvent *even
image_view_pan_exec(C, op);
break;
default:
- if (event->type == vpd->event_type && event->val == KM_RELEASE) {
+ if (event->type == vpd->launch_event && event->val == KM_RELEASE) {
image_view_pan_exit(C, op, false);
return OPERATOR_FINISHED;
}
@@ -452,7 +452,7 @@ void IMAGE_OT_view_pan(wmOperatorType *ot)
typedef struct ViewZoomData {
float origx, origy;
float zoom;
- int event_type;
+ int launch_event;
float location[2];
/* needed for continuous zoom */
@@ -483,7 +483,7 @@ static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *eve
vpd->origx = event->x;
vpd->origy = event->y;
vpd->zoom = sima->zoom;
- vpd->event_type = event->type;
+ vpd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
UI_view2d_region_to_view(
&ar->v2d, event->mval[0], event->mval[1], &vpd->location[0], &vpd->location[1]);
@@ -633,7 +633,7 @@ static int image_view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *eve
else if (event->type == MOUSEMOVE) {
event_code = VIEW_APPLY;
}
- else if (event->type == vpd->event_type && event->val == KM_RELEASE) {
+ else if (event->type == vpd->launch_event && event->val == KM_RELEASE) {
event_code = VIEW_CONFIRM;
}
diff --git a/source/blender/windowmanager/intern/wm_operator_utils.c b/source/blender/windowmanager/intern/wm_operator_utils.c
index 856c85d4554..44afa708136 100644
--- a/source/blender/windowmanager/intern/wm_operator_utils.c
+++ b/source/blender/windowmanager/intern/wm_operator_utils.c
@@ -148,6 +148,7 @@ static bool interactive_value_update(ValueInteraction *inter,
* \{ */
struct ObCustomData_ForEditMode {
+ int launch_event;
bool wait_for_input;
bool is_active;
bool is_first;
@@ -211,6 +212,7 @@ static int op_generic_value_invoke(bContext *C, wmOperator *op, const wmEvent *e
}
struct ObCustomData_ForEditMode *cd = MEM_callocN(sizeof(*cd), __func__);
+ cd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
cd->wait_for_input = RNA_boolean_get(op->ptr, "wait_for_input");
cd->is_active = !cd->wait_for_input;
cd->is_first = true;
@@ -239,6 +241,15 @@ static int op_generic_value_invoke(bContext *C, wmOperator *op, const wmEvent *e
static int op_generic_value_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
struct ObCustomData_ForEditMode *cd = op->customdata;
+
+ /* Special case, check if we release the event that activated this operator. */
+ if ((event->type == cd->launch_event) && (event->val == KM_RELEASE)) {
+ if (cd->wait_for_input == false) {
+ op_generic_value_exit(op);
+ return OPERATOR_FINISHED;
+ }
+ }
+
switch (event->type) {
case MOUSEMOVE:
case LEFTCTRLKEY: