From acd7b81c2d3fa7828d28c1562fad10663d911783 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 15 Dec 2010 04:06:19 +0000 Subject: bugfix [#25230] Quick extrude Ctrl-LMB : wrong behaviour of 'RotateSource' option. Problem is is with operator redo which click-extrude exposed. Check if redo operator can run, otherwise lock the UI and add a label that the operator doesn't support redo. This is clunky but IMHO better then failing silently and leaving the user confused. - Merged redo functions into ED_undo_operator_repeat(), code was duplicated in a few places. - added WM_operator_repeat_check to check if WM_operator_repeat() can run, avoids an undo call when redo work. Unrelated changes - GHOST_SystemWin32.cpp set to utf8 encoding. - cmake_consistency_check.py now checks source files are utf8. --- .../blender/editors/space_view3d/view3d_toolbar.c | 41 +++++----------------- 1 file changed, 8 insertions(+), 33 deletions(-) (limited to 'source/blender/editors/space_view3d/view3d_toolbar.c') diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index 1064611b84f..a20397aa720 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -63,38 +63,6 @@ /* ******************* view3d space & buttons ************** */ - -/* op->exec */ -/* XXX DUPLICATE CODE */ -static void redo_cb(bContext *C, void *arg_op, void *UNUSED(arg2)) -{ - wmOperator *lastop= arg_op; - - if(lastop) { - ARegion *ar= CTX_wm_region(C); - ARegion *ar1= BKE_area_find_region_type(CTX_wm_area(C), RGN_TYPE_WINDOW); - int retval; - - if(ar1) - CTX_wm_region_set(C, ar1); - - if (G.f & G_DEBUG) - printf("operator redo %s\n", lastop->type->name); - - ED_undo_pop_op(C, lastop); - retval= WM_operator_repeat(C, lastop); - - if((retval & OPERATOR_FINISHED)==0) { - if (G.f & G_DEBUG) - printf("operator redo failed %s\n", lastop->type->name); - ED_undo_redo(C); - } - - /* set region back */ - CTX_wm_region_set(C, ar); - } -} - static wmOperator *view3d_last_operator(const bContext *C) { wmWindowManager *wm= CTX_wm_manager(C); @@ -118,6 +86,13 @@ static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOper op->properties= IDP_New(IDP_GROUP, val, "wmOperatorProperties"); } + /* poll() on this operator may still fail, at the moment there is no nice feedback when this happens + * just fails silently */ + if(!WM_operator_repeat_check(C, op)) { + uiBlockSetButLock(uiLayoutGetBlock(pa->layout), TRUE, "Operator cannot redo"); + uiItemL(pa->layout, "* Redo Unsupported *", 0); // XXX, could give some nicer feedback or not show redo panel at all? + } + RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); if(op->type->ui) { op->layout= pa->layout; @@ -161,7 +136,7 @@ static void view3d_panel_operator_redo(const bContext *C, Panel *pa) block= uiLayoutGetBlock(pa->layout); - uiBlockSetFunc(block, redo_cb, op, NULL); + uiBlockSetFunc(block, ED_undo_operator_repeat_cb, op, NULL); view3d_panel_operator_redo_operator(C, pa, op); } -- cgit v1.2.3