diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-01-28 15:36:23 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-01-29 17:52:53 +0300 |
commit | 0e37d3efc017151309b272e4562edd901bfbde7a (patch) | |
tree | 868a547025ef98ba33eb4e64280d514b325ad44e /source/blender/editors/space_view3d/space_view3d.c | |
parent | 087777f2b9b8c7cfc75458c6e6e714e92e2e2851 (diff) |
Fix T84717: missing 3D viewport updates when changing shading settings
Previously this relied on the dependency graph to detect changes in the screen
datablock, which would then notify the renderers. This was rather indirect an
not even really by design. Instead use notifiers to tag specific 3D viewports
to be updated.
Includes changes to BKE_scene_get_depsgraph to accept a const Scene pointer.
Testing if this works correctly requires adding back commits 81d444c and 088904d,
since those have been temporarily reverted.
Differential Revision: https://developer.blender.org/D10235
Diffstat (limited to 'source/blender/editors/space_view3d/space_view3d.c')
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 34d342ddd94..4c168c7a243 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -53,6 +53,7 @@ #include "BKE_screen.h" #include "BKE_workspace.h" +#include "ED_render.h" #include "ED_screen.h" #include "ED_space_api.h" #include "ED_transform.h" @@ -784,7 +785,7 @@ static void *view3d_main_region_duplicate(void *poin) } static void view3d_main_region_listener( - wmWindow *UNUSED(win), ScrArea *area, ARegion *region, wmNotifier *wmn, const Scene *scene) + wmWindow *win, ScrArea *area, ARegion *region, wmNotifier *wmn, const Scene *scene) { View3D *v3d = area->spacedata.first; RegionView3D *rv3d = region->regiondata; @@ -1001,11 +1002,17 @@ static void view3d_main_region_listener( if (wmn->subtype == NS_VIEW3D_GPU) { rv3d->rflag |= RV3D_GPULIGHT_UPDATE; } -#ifdef WITH_XR_OPENXR else if (wmn->subtype == NS_VIEW3D_SHADING) { +#ifdef WITH_XR_OPENXR ED_view3d_xr_shading_update(G_MAIN->wm.first, v3d, scene); - } #endif + + ViewLayer *view_layer = WM_window_get_active_view_layer(win); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer); + if (depsgraph) { + ED_render_view3d_update(depsgraph, win, area, true); + } + } ED_region_tag_redraw(region); WM_gizmomap_tag_refresh(gzmap); } |