diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-15 08:42:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-15 08:42:23 +0300 |
commit | eb8458b064c5a7553a3bd51c214c9669aaf550f9 (patch) | |
tree | 85063dfae53b799f6bceca854ecb4f338458d833 /source/blender/editors/space_view3d | |
parent | acd7b81c2d3fa7828d28c1562fad10663d911783 (diff) |
Centralized operator UI drawing into a new function uiLayoutOperatorButs(),
Operator drawing calls were duplicated in file selector panel, redo panels, redo & dialog popups.
note, uiDefAutoButsRNA's column's argument was misleading, renamed to label_align.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_buttons.c | 27 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_toolbar.c | 24 |
2 files changed, 1 insertions, 50 deletions
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 0352996484a..d2775d7f03d 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1392,33 +1392,6 @@ static void view3d_panel_bonesketch_spaces(const bContext *C, Panel *pa) uiBlockEndAlign(block); } -static void view3d_panel_operator_redo(const bContext *C, Panel *pa) -{ - wmWindowManager *wm= CTX_wm_manager(C); - wmOperator *op; - PointerRNA ptr; - uiBlock *block; - - block= uiLayoutGetBlock(pa->layout); - - /* only for operators that are registered and did an undo push */ - for(op= wm->operators.last; op; op= op->prev) - if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO)) - break; - - if(op==NULL) - return; - - uiBlockSetFunc(block, ED_undo_operator_repeat_cb, op, NULL); - - if(!op->properties) { - IDPropertyTemplate val = {0}; - op->properties= IDP_New(IDP_GROUP, val, "wmOperatorProperties"); - } - - RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr); - uiDefAutoButsRNA(pa->layout, &ptr, 2); -} #endif // XXX not used void view3d_buttons_register(ARegionType *art) diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index a20397aa720..56ca1ce8280 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -78,29 +78,7 @@ static wmOperator *view3d_last_operator(const bContext *C) static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOperator *op) { - wmWindowManager *wm= CTX_wm_manager(C); - PointerRNA ptr; - - if(!op->properties) { - IDPropertyTemplate val = {0}; - 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; - op->type->ui((bContext*)C, op); - op->layout= NULL; - } - else - uiDefAutoButsRNA(pa->layout, &ptr, 1); + uiLayoutOperatorButs(C, pa->layout, op, NULL, 'V', 0); } static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa) |