From def15f275df4817408ec0e606e3122692540a9ef Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 30 Apr 2013 03:44:03 +0000 Subject: fix [#35156] Edge slide gg shortcut brings up wrong settings. switch operator types from transform, this would normally be problematic, but transform operators share callbacks so it can be supported. --- source/blender/editors/transform/transform_ops.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'source/blender/editors/transform/transform_ops.c') diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 546d02533fb..4f46e969c3c 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -339,6 +339,7 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event) int exit_code; TransInfo *t = op->customdata; + const enum TfmMode mode_prev = t->mode; #if 0 // stable 2D mouse coords map to different 3D coords while the 3D mouse is active @@ -362,6 +363,28 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event) transformops_exit(C, op); exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */ } + else { + if (mode_prev != t->mode) { + /* WARNING: this is not normal to switch operator types + * normally it would not be supported but transform happens + * to share callbacks between differernt operators. */ + wmOperatorType *ot_new = NULL; + TransformModeItem *item = transform_modes; + while (item->idname) { + if (item->mode == t->mode) { + ot_new = WM_operatortype_find(item->idname, false); + break; + } + item++; + } + + BLI_assert(ot_new != NULL); + if (ot_new) { + WM_operator_type_set(op, ot_new); + } + /* end suspicious code */ + } + } return exit_code; } -- cgit v1.2.3