Changeset View
Changeset View
Standalone View
Standalone View
source/blender/windowmanager/intern/wm_draw.c
| Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BIF_gl.h" | #include "BIF_gl.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_image.h" | #include "BKE_image.h" | ||||
| #include "BKE_scene.h" | |||||
| #include "BKE_workspace.h" | |||||
| #include "GHOST_C-api.h" | #include "GHOST_C-api.h" | ||||
| #include "ED_node.h" | #include "ED_node.h" | ||||
| #include "ED_view3d.h" | #include "ED_view3d.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "GPU_draw.h" | #include "GPU_draw.h" | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
| static bool wm_area_test_invalid_backbuf(ScrArea *sa) | static bool wm_area_test_invalid_backbuf(ScrArea *sa) | ||||
| { | { | ||||
| if (sa->spacetype == SPACE_VIEW3D) | if (sa->spacetype == SPACE_VIEW3D) | ||||
| return (((View3D *)sa->spacedata.first)->flag & V3D_INVALID_BACKBUF) != 0; | return (((View3D *)sa->spacedata.first)->flag & V3D_INVALID_BACKBUF) != 0; | ||||
| else | else | ||||
| return true; | return true; | ||||
| } | } | ||||
| static void wm_region_test_render_do_draw(const Scene *scene, ScrArea *sa, ARegion *ar) | static void wm_region_test_render_do_draw(const Scene *scene, const struct Depsgraph *depsgraph, | ||||
| ScrArea *sa, ARegion *ar) | |||||
| { | { | ||||
| /* tag region for redraw from render engine preview running inside of it */ | /* tag region for redraw from render engine preview running inside of it */ | ||||
| if (sa->spacetype == SPACE_VIEW3D) { | if (sa->spacetype == SPACE_VIEW3D) { | ||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| RenderEngine *engine = (rv3d) ? rv3d->render_engine : NULL; | RenderEngine *engine = (rv3d) ? rv3d->render_engine : NULL; | ||||
| GPUViewport *viewport = (rv3d) ? rv3d->viewport : NULL; | GPUViewport *viewport = (rv3d) ? rv3d->viewport : NULL; | ||||
| if (engine && (engine->flag & RE_ENGINE_DO_DRAW)) { | if (engine && (engine->flag & RE_ENGINE_DO_DRAW)) { | ||||
| View3D *v3d = sa->spacedata.first; | View3D *v3d = sa->spacedata.first; | ||||
| rcti border_rect; | rcti border_rect; | ||||
| /* do partial redraw when possible */ | /* do partial redraw when possible */ | ||||
| if (ED_view3d_calc_render_border(scene, v3d, ar, &border_rect)) | if (ED_view3d_calc_render_border(scene, depsgraph, v3d, ar, &border_rect)) | ||||
| ED_region_tag_redraw_partial(ar, &border_rect); | ED_region_tag_redraw_partial(ar, &border_rect); | ||||
| else | else | ||||
| ED_region_tag_redraw(ar); | ED_region_tag_redraw(ar); | ||||
| engine->flag &= ~RE_ENGINE_DO_DRAW; | engine->flag &= ~RE_ENGINE_DO_DRAW; | ||||
| } | } | ||||
| else if (viewport && GPU_viewport_do_update(viewport)) { | else if (viewport && GPU_viewport_do_update(viewport)) { | ||||
| ED_region_tag_redraw(ar); | ED_region_tag_redraw(ar); | ||||
| ▲ Show 20 Lines • Show All 719 Lines • ▼ Show 20 Lines | #endif | ||||
| wm_triple_copy_textures(win, triple_all); | wm_triple_copy_textures(win, triple_all); | ||||
| } | } | ||||
| /****************** main update call **********************/ | /****************** main update call **********************/ | ||||
| /* quick test to prevent changing window drawable */ | /* quick test to prevent changing window drawable */ | ||||
| static bool wm_draw_update_test_window(wmWindow *win) | static bool wm_draw_update_test_window(wmWindow *win) | ||||
| { | { | ||||
| const Scene *scene = WM_window_get_active_scene(win); | /*const*/ struct WorkSpace *workspace = WM_window_get_active_workspace(win); | ||||
| /*const*/ Scene *scene = WM_window_get_active_scene(win); | |||||
| /*const*/ ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene); | |||||
| struct Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); | |||||
| const bScreen *screen = WM_window_get_active_screen(win); | const bScreen *screen = WM_window_get_active_screen(win); | ||||
| ScrArea *sa; | ScrArea *sa; | ||||
| ARegion *ar; | ARegion *ar; | ||||
| bool do_draw = false; | bool do_draw = false; | ||||
| for (ar = screen->regionbase.first; ar; ar = ar->next) { | for (ar = screen->regionbase.first; ar; ar = ar->next) { | ||||
| if (ar->do_draw_overlay) { | if (ar->do_draw_overlay) { | ||||
| wm_tag_redraw_overlay(win, ar); | wm_tag_redraw_overlay(win, ar); | ||||
| ar->do_draw_overlay = false; | ar->do_draw_overlay = false; | ||||
| } | } | ||||
| if (ar->swinid && ar->do_draw) | if (ar->swinid && ar->do_draw) | ||||
| do_draw = true; | do_draw = true; | ||||
| } | } | ||||
| for (sa = screen->areabase.first; sa; sa = sa->next) { | for (sa = screen->areabase.first; sa; sa = sa->next) { | ||||
| for (ar = sa->regionbase.first; ar; ar = ar->next) { | for (ar = sa->regionbase.first; ar; ar = ar->next) { | ||||
| wm_region_test_render_do_draw(scene, sa, ar); | wm_region_test_render_do_draw(scene, depsgraph, sa, ar); | ||||
| if (ar->swinid && ar->do_draw) | if (ar->swinid && ar->do_draw) | ||||
| do_draw = true; | do_draw = true; | ||||
| } | } | ||||
| } | } | ||||
| if (do_draw) | if (do_draw) | ||||
| return true; | return true; | ||||
| ▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines | |||||