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:
authorCampbell Barton <ideasman42@gmail.com>2018-06-12 17:49:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-12 17:50:27 +0300
commit2a3e7fe656e7a9d84b308439598cf9de53d78fff (patch)
tree04ebb71e829e0c734f44435805dfeaffb4f53300 /source/blender/windowmanager
parentdeb3d73eea3098c2222eeeca9926759f3ec86784 (diff)
UI: improve HUD ensure/clear logic
Running operators w/o redo now clears the HUD immediately.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index ebf771c4745..b3ff823dd2d 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -843,6 +843,7 @@ static bool wm_operator_register_check(wmWindowManager *wm, wmOperatorType *ot)
static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat, const bool store)
{
wmWindowManager *wm = CTX_wm_manager(C);
+ enum { NOP, SET, CLEAR, } hud_status = NOP;
op->customdata = NULL;
@@ -854,10 +855,15 @@ static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat,
* called from operators that already do an undo push. usually
* this will happen for python operators that call C operators */
if (wm->op_undo_depth == 0) {
- if (op->type->flag & OPTYPE_UNDO)
+ if (op->type->flag & OPTYPE_UNDO) {
ED_undo_push_op(C, op);
- else if (op->type->flag & OPTYPE_UNDO_GROUPED)
+ hud_status = CLEAR;
+ }
+ else if (op->type->flag & OPTYPE_UNDO_GROUPED) {
ED_undo_grouped_push_op(C, op);
+ hud_status = CLEAR;
+ }
+
}
if (repeat == 0) {
@@ -875,17 +881,27 @@ static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat,
WM_operator_region_active_win_set(C);
/* Show the redo panel. */
- {
- ScrArea *sa = CTX_wm_area(C);
- if (sa) {
- ED_area_type_hud_ensure(C, sa);
- }
- }
+ hud_status = SET;
}
else {
WM_operator_free(op);
}
}
+
+ if (hud_status != NOP) {
+ if (hud_status == SET) {
+ ScrArea *sa = CTX_wm_area(C);
+ if (sa) {
+ ED_area_type_hud_ensure(C, sa);
+ }
+ }
+ else if (hud_status == CLEAR) {
+ ED_area_type_hud_clear(wm, NULL);
+ }
+ else {
+ BLI_assert(0);
+ }
+ }
}
/* if repeat is true, it doesn't register again, nor does it free */