diff options
author | Hans Goudey <h.goudey@me.com> | 2020-07-17 22:18:54 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-07-17 22:18:54 +0300 |
commit | 69d14c0ddbfb6ccbc0e321169967c46389bfdd32 (patch) | |
tree | 5bea71f0f16d9ace9afbbdae11164902a4a880be | |
parent | 8b0df381d95312a3af3c6ec05e9b4b7ed81727e2 (diff) |
Fix T78959: Show current frame indicator when interface is locked
When the playhead drawing moved to an overlay, a check was added to keep
it from drawing with a locked interface. This is necessary for some overlays,
but not this one, so this removes the check, making it the responsibility of
the editor.
A context function is added to make that check easier in the future.
Differential Revision: https://developer.blender.org/D8313
-rw-r--r-- | source/blender/blenkernel/BKE_context.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_screen.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/context.c | 5 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 6 |
4 files changed, 14 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 70ca29d5795..7544789d864 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -312,6 +312,8 @@ int CTX_data_visible_gpencil_layers(const bContext *C, ListBase *list); int CTX_data_editable_gpencil_layers(const bContext *C, ListBase *list); int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list); +bool CTX_wm_interface_locked(const bContext *C); + /* Gets pointer to the dependency graph. * If it doesn't exist yet, it will be allocated. * diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 91f241018ec..13716ddb5c6 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -142,7 +142,13 @@ typedef struct ARegionType { void (*exit)(struct wmWindowManager *wm, struct ARegion *region); /* draw entirely, view changes should be handled here */ void (*draw)(const struct bContext *C, struct ARegion *region); - /* Handler to draw overlays. This handler is called every draw loop. */ + /** + * Handler to draw overlays. This handler is called every draw loop. + * + * \note Some editors should return early if the interface is locked + * (check with #CTX_wm_interface_locked) to avoid accessing scene data + * that another thread may be modifying + */ void (*draw_overlay)(const struct bContext *C, struct ARegion *region); /* optional, compute button layout before drawing for dynamic size */ void (*layout)(const struct bContext *C, struct ARegion *region); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 8de12139306..30f021b0e81 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -694,6 +694,11 @@ wmWindowManager *CTX_wm_manager(const bContext *C) return C->wm.manager; } +bool CTX_wm_interface_locked(const bContext *C) +{ + return (bool)C->wm.manager->is_interface_locked; +} + wmWindow *CTX_wm_window(const bContext *C) { return ctx_wm_python_context_get(C, "window", &RNA_Window, C->wm.window); diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 4cc30d65fdb..75580824d9c 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -138,12 +138,6 @@ static void wm_region_draw_overlay(bContext *C, ScrArea *area, ARegion *region) wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); - /* Don't draw overlay with locked interface. Drawing could access scene data that another thread - * may be modifying. */ - if (wm->is_interface_locked) { - return; - } - wmViewport(®ion->winrct); UI_SetTheme(area->spacetype, region->regiontype); region->type->draw_overlay(C, region); |