diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_space_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_space_api.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_space_api.c b/source/blender/makesrna/intern/rna_space_api.c index 8f771eda99d..f1206b7130f 100644 --- a/source/blender/makesrna/intern/rna_space_api.c +++ b/source/blender/makesrna/intern/rna_space_api.c @@ -31,9 +31,12 @@ #ifdef RNA_RUNTIME +#include "BKE_global.h" + +#include "ED_screen.h" #include "ED_text.h" -static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d) +static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d, bContext *C) { bScreen *sc = (bScreen *)id; @@ -43,11 +46,20 @@ static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d) area_region_from_regiondata(sc, rv3d, &sa, &ar); if (sa && ar && sa->spacetype == SPACE_VIEW3D) { - View3D *v3d; - - v3d = (View3D *)sa->spacedata.first; - - ED_view3d_update_viewmat(sc->scene, v3d, ar, NULL, NULL, NULL); + View3D *v3d = sa->spacedata.first; + wmWindowManager *wm = CTX_wm_manager(C); + wmWindow *win; + + for (win = wm->windows.first; win; win = win->next) { + if (WM_window_get_active_screen(win) == sc) { + Scene *scene = WM_window_get_active_scene(win); + ViewLayer *view_layer = WM_window_get_active_view_layer(win); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true); + + ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, NULL, NULL, NULL); + break; + } + } } } @@ -71,7 +83,7 @@ void RNA_api_region_view3d(StructRNA *srna) FunctionRNA *func; func = RNA_def_function(srna, "update", "rna_RegionView3D_update"); - RNA_def_function_flag(func, FUNC_USE_SELF_ID); + RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Recalculate the view matrices"); } |