diff options
Diffstat (limited to 'source/blender/draw/engines/overlay/overlay_engine.c')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_engine.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c index 4533a321909..0fa3b17e7a5 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.c +++ b/source/blender/draw/engines/overlay/overlay_engine.c @@ -52,8 +52,6 @@ static void OVERLAY_engine_init(void *vedata) const View3D *v3d = draw_ctx->v3d; const Scene *scene = draw_ctx->scene; const ToolSettings *ts = scene->toolsettings; - const SpaceImage *sima = (SpaceImage *)draw_ctx->space_data; - BLI_assert(v3d || sima); OVERLAY_shader_library_ensure(); @@ -63,15 +61,21 @@ static void OVERLAY_engine_init(void *vedata) } OVERLAY_PrivateData *pd = stl->pd; - pd->is_image_editor = sima != NULL; + pd->space_type = v3d != NULL ? SPACE_VIEW3D : draw_ctx->space_data->spacetype; - if (pd->is_image_editor) { + if (pd->space_type == SPACE_IMAGE) { + const SpaceImage *sima = (SpaceImage *)draw_ctx->space_data; pd->hide_overlays = (sima->overlay.flag & SI_OVERLAY_SHOW_OVERLAYS) == 0; pd->clipping_state = 0; OVERLAY_grid_init(data); OVERLAY_edit_uv_init(data); return; } + if (pd->space_type == SPACE_NODE) { + pd->hide_overlays = true; + pd->clipping_state = 0; + return; + } pd->hide_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) != 0; pd->ctx_mode = CTX_data_mode_enum_ex( @@ -140,12 +144,16 @@ static void OVERLAY_cache_init(void *vedata) OVERLAY_StorageList *stl = data->stl; OVERLAY_PrivateData *pd = stl->pd; - if (pd->is_image_editor) { + if (pd->space_type == SPACE_IMAGE) { OVERLAY_background_cache_init(vedata); OVERLAY_grid_cache_init(vedata); OVERLAY_edit_uv_cache_init(vedata); return; } + if (pd->space_type == SPACE_NODE) { + OVERLAY_background_cache_init(vedata); + return; + } switch (pd->ctx_mode) { case CTX_MODE_EDIT_MESH: @@ -289,7 +297,7 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob) OVERLAY_Data *data = vedata; OVERLAY_PrivateData *pd = data->stl->pd; - if (pd->is_image_editor) { + if (pd->space_type == SPACE_IMAGE) { if (ob->type == OB_MESH) { OVERLAY_edit_uv_cache_populate(vedata, ob); } @@ -481,7 +489,7 @@ static void OVERLAY_cache_finish(void *vedata) { OVERLAY_Data *data = vedata; OVERLAY_PrivateData *pd = data->stl->pd; - if (pd->is_image_editor) { + if (ELEM(pd->space_type, SPACE_IMAGE, SPACE_NODE)) { return; } @@ -511,17 +519,21 @@ static void OVERLAY_draw_scene(void *vedata) DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); /* Needs to be done first as it modifies the scene color and depth buffer. */ - if (!pd->is_image_editor) { + if (pd->space_type == SPACE_VIEW3D) { OVERLAY_image_scene_background_draw(vedata); } if (DRW_state_is_fbo()) { - const float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; GPU_framebuffer_bind(dfbl->overlay_only_fb); - GPU_framebuffer_clear_color(dfbl->overlay_only_fb, clear_col); + /* Don't clear background for the node editor. The node editor draws the background and we + * need to mask out the image from the already drawn overlay color buffer. */ + if (pd->space_type != SPACE_NODE) { + const float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + GPU_framebuffer_clear_color(dfbl->overlay_only_fb, clear_col); + } } - if (pd->is_image_editor) { + if (pd->space_type == SPACE_IMAGE) { OVERLAY_background_draw(data); OVERLAY_grid_draw(data); if (DRW_state_is_fbo()) { @@ -530,6 +542,10 @@ static void OVERLAY_draw_scene(void *vedata) OVERLAY_edit_uv_draw(data); return; } + if (pd->space_type == SPACE_NODE) { + OVERLAY_background_draw(data); + return; + } OVERLAY_image_background_draw(vedata); OVERLAY_background_draw(vedata); |