Fix missing view layer sync in recent change to ED_view3d_datamask

Call BKE_view_layer_synced_ensure before getting the active object [0]
caused an assertion for tests in debug mode.

[0]: c158dd560e
This commit is contained in:
Campbell Barton 2023-01-15 22:16:15 +11:00
parent cc332264ae
commit fc9c818531
Notes: blender-bot 2023-03-01 04:18:45 +01:00
Referenced by issue #103866, Assert when running tests in debug build
4 changed files with 18 additions and 9 deletions

View File

@ -1104,13 +1104,15 @@ char ED_view3d_lock_view_from_index(int index);
char ED_view3d_axis_view_opposite(char view);
bool ED_view3d_lock(struct RegionView3D *rv3d);
void ED_view3d_datamask(const struct ViewLayer *view_layer,
void ED_view3d_datamask(const struct Scene *scene,
struct ViewLayer *view_layer,
const struct View3D *v3d,
struct CustomData_MeshMasks *r_cddata_masks);
/**
* Goes over all modes and view3d settings.
*/
void ED_view3d_screen_datamask(const struct ViewLayer *view_layer,
void ED_view3d_screen_datamask(const struct Scene *scene,
struct ViewLayer *view_layer,
const struct bScreen *screen,
struct CustomData_MeshMasks *r_cddata_masks);

View File

@ -808,8 +808,10 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
memset(&oglrender->scene->customdata_mask_modal,
0,
sizeof(oglrender->scene->customdata_mask_modal));
ED_view3d_datamask(
oglrender->view_layer, oglrender->v3d, &oglrender->scene->customdata_mask_modal);
ED_view3d_datamask(oglrender->scene,
oglrender->view_layer,
oglrender->v3d,
&oglrender->scene->customdata_mask_modal);
/* apply immediately in case we're rendering from a script,
* running notifiers again will overwrite */

View File

@ -2407,7 +2407,8 @@ void ED_view3d_depths_free(ViewDepths *depths)
/** \name Custom-data Utilities
* \{ */
void ED_view3d_datamask(const ViewLayer *view_layer,
void ED_view3d_datamask(const Scene *scene,
ViewLayer *view_layer,
const View3D *v3d,
CustomData_MeshMasks *r_cddata_masks)
{
@ -2428,6 +2429,7 @@ void ED_view3d_datamask(const ViewLayer *view_layer,
}
}
BKE_view_layer_synced_ensure(scene, view_layer);
Object *obact = BKE_view_layer_active_object_get(view_layer);
if (obact) {
switch (obact->type) {
@ -2450,7 +2452,8 @@ void ED_view3d_datamask(const ViewLayer *view_layer,
}
}
void ED_view3d_screen_datamask(const ViewLayer *view_layer,
void ED_view3d_screen_datamask(const Scene *scene,
ViewLayer *view_layer,
const bScreen *screen,
CustomData_MeshMasks *r_cddata_masks)
{
@ -2459,7 +2462,8 @@ void ED_view3d_screen_datamask(const ViewLayer *view_layer,
/* Check if we need UV or color data due to the view mode. */
LISTBASE_FOREACH (const ScrArea *, area, &screen->areabase) {
if (area->spacetype == SPACE_VIEW3D) {
ED_view3d_datamask(view_layer, static_cast<View3D *>(area->spacedata.first), r_cddata_masks);
ED_view3d_datamask(
scene, view_layer, static_cast<View3D *>(area->spacedata.first), r_cddata_masks);
}
}
}

View File

@ -423,10 +423,11 @@ void wm_event_do_depsgraph(bContext *C, bool is_after_open_file)
/* Combine data-masks so one window doesn't disable UVs in another T26448. */
CustomData_MeshMasks win_combine_v3d_datamask = {0};
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
const ViewLayer *view_layer = WM_window_get_active_view_layer(win);
const Scene *scene = WM_window_get_active_scene(win);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
const bScreen *screen = WM_window_get_active_screen(win);
ED_view3d_screen_datamask(view_layer, screen, &win_combine_v3d_datamask);
ED_view3d_screen_datamask(scene, view_layer, screen, &win_combine_v3d_datamask);
}
/* Update all the dependency graphs of visible view layers. */
LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {