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:
authorAntony Riakiotakis <kalast@gmail.com>2013-04-11 18:15:25 +0400
committerAntony Riakiotakis <kalast@gmail.com>2013-04-11 18:15:25 +0400
commit5c4a080021ef565611f52ea5ebc37e30224b3b3f (patch)
tree625c43fa0ed7681519da36fe9efb202795583c3b /source/blender/editors/sculpt_paint/paint_ops.c
parent4d7db8e59e02bc7281e54222a9e169719b183121 (diff)
Fix #34954, due to hardcoded key release it was impossible to change key
for sample color and exit the operator. Also tweaked stencil to behave similarly, so it is now possible to assign custom keys to stencil control.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_ops.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index f03c88bfb75..d5c5d9ee150 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -470,6 +470,7 @@ typedef struct {
StencilControlMode mode;
StencilConstraint constrain_mode;
Brush *br;
+ short event_type;
} StencilControlData;
static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -490,6 +491,7 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev
scd->init_rot = br->mtex.rot;
scd->init_angle = atan2(mdiff[1], mdiff[0]);
scd->mode = RNA_enum_get(op->ptr, "mode");
+ scd->event_type = event->type;
op->customdata = scd;
WM_event_add_modal_handler(C, op);
@@ -554,17 +556,16 @@ 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) {
+ MEM_freeN(op->customdata);
+ WM_event_add_notifier(C, NC_WINDOW, NULL);
+ return OPERATOR_FINISHED;
+ }
+
switch (event->type) {
case MOUSEMOVE:
stencil_control_calculate(scd, event->mval);
break;
- /* XXX hardcoded! */
- case RIGHTMOUSE:
- if (event->val == KM_RELEASE) {
- MEM_freeN(op->customdata);
- WM_event_add_notifier(C, NC_WINDOW, NULL);
- return OPERATOR_FINISHED;
- }
case ESCKEY:
if (event->val == KM_PRESS) {
stencil_control_cancel(C, op);