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
This commit is contained in:
Hans Goudey
2020-07-17 15:18:54 -04:00
parent 8b0df381d9
commit 69d14c0ddb
4 changed files with 14 additions and 7 deletions

View File

@@ -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.
*

View File

@@ -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);

View File

@@ -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);

View File

@@ -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(&region->winrct);
UI_SetTheme(area->spacetype, region->regiontype);
region->type->draw_overlay(C, region);