diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-11-29 19:49:26 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-11-29 19:49:26 +0300 |
commit | ae16f465738b538964e5f00c1506582d47ead7d1 (patch) | |
tree | 6609ad15de8a7f2021be22e3d260ec88376aee5b /source/blender/editors | |
parent | 3b72584b7dd71737099184bc5a981874a7b4fa21 (diff) |
Fix CLICK event for modal operators.
modal operators should return RUNNING_MODAL|PASSTHROUGH for unhandled events to be able to receive clicks correctly (this needs to be fixed for other modal operators).
Maybe it's time to have "handled" flag in event instead.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/transform/transform.c | 21 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.h | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 8 |
3 files changed, 24 insertions, 7 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index cd267f51601..ce7076c691f 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -560,10 +560,11 @@ void transform_modal_keymap(wmKeyConfig *keyconf) } -void transformEvent(TransInfo *t, wmEvent *event) +int transformEvent(TransInfo *t, wmEvent *event) { float mati[3][3] = {{1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}}; char cmode = constraintModeToChar(t); + int handled = 1; t->redraw |= handleMouseInput(t, &t->mouse, event); @@ -641,6 +642,9 @@ void transformEvent(TransInfo *t, wmEvent *event) t->modifiers ^= MOD_SNAP; t->redraw = 1; break; + default: + handled = 0; + break; } } /* else do non-mapped events */ @@ -898,6 +902,9 @@ void transformEvent(TransInfo *t, wmEvent *event) // case NDOFMOTION: // viewmoveNDOF(1); // break; + default: + handled = 0; + break; } // Numerical input events @@ -935,7 +942,9 @@ void transformEvent(TransInfo *t, wmEvent *event) case NDOF_REFRESH: t->redraw = 1; break; - + default: + handled = 0; + break; } // Snapping events @@ -964,6 +973,9 @@ void transformEvent(TransInfo *t, wmEvent *event) //// if (t->options & CTX_TWEAK) // t->state = TRANS_CONFIRM; // break; + default: + handled = 0; + break; } /* confirm transform if launch key is released after mouse move */ @@ -977,6 +989,11 @@ void transformEvent(TransInfo *t, wmEvent *event) // Per transform event, if present if (t->handleEvent) t->redraw |= t->handleEvent(t, event); + + if (handled || t->redraw) + return 0; + else + return OPERATOR_PASS_THROUGH; } int calculateTransformCenter(bContext *C, wmEvent *event, int centerMode, float *vec) diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 1d284d2cc5b..bf3562cbe65 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -429,7 +429,7 @@ void TFM_OT_transform(struct wmOperatorType *ot); int initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, struct wmEvent *event, int mode); void saveTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op); -void transformEvent(TransInfo *t, struct wmEvent *event); +int transformEvent(TransInfo *t, struct wmEvent *event); void transformApply(struct bContext *C, TransInfo *t); int transformEnd(struct bContext *C, TransInfo *t); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 0c54b5273e3..1b8b331af62 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -293,16 +293,16 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event) TransInfo *t = op->customdata; - transformEvent(t, event); + exit_code = transformEvent(t, event); transformApply(C, t); + exit_code |= transformEnd(C, t); - exit_code = transformEnd(C, t); - - if (exit_code != OPERATOR_RUNNING_MODAL) + if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) { transformops_exit(C, op); + exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */ } return exit_code; |