diff options
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_extra.c | 5 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_common.c | 9 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 8 |
3 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index 8211b2f0490..5d80ab3d0ea 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -1485,10 +1485,11 @@ static void OVERLAY_volume_extra(OVERLAY_ExtraCallBuffers *cb, static void OVERLAY_object_center(OVERLAY_ExtraCallBuffers *cb, Object *ob, OVERLAY_PrivateData *pd, + const Scene *scene, ViewLayer *view_layer) { const bool is_library = ID_REAL_USERS(&ob->id) > 1 || ID_IS_LINKED(ob); - + BKE_view_layer_synced_ensure(scene, view_layer); if (ob == BKE_view_layer_active_object_get(view_layer)) { DRW_buffer_add_entry(cb->center_active, ob->obmat[3]); } @@ -1573,7 +1574,7 @@ void OVERLAY_extra_cache_populate(OVERLAY_Data *vedata, Object *ob) /* don't show object extras in set's */ if (!from_dupli) { if (draw_obcenters) { - OVERLAY_object_center(cb, ob, pd, view_layer); + OVERLAY_object_center(cb, ob, pd, scene, view_layer); } if (draw_relations) { OVERLAY_relationship_lines(cb, draw_ctx->depsgraph, draw_ctx->scene, ob); diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index de56b34df78..c1b4c3c1f81 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -280,10 +280,11 @@ int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color { const DRWContextState *draw_ctx = DRW_context_state_get(); const bool is_edit = (draw_ctx->object_mode & OB_MODE_EDIT) && (ob->mode & OB_MODE_EDIT); - const bool active = view_layer->basact && - ((ob->base_flag & BASE_FROM_DUPLI) ? - (DRW_object_get_dupli_parent(ob) == view_layer->basact->object) : - (view_layer->basact->object == ob)); + BKE_view_layer_synced_ensure(draw_ctx->scene, view_layer); + const Base *base = BKE_view_layer_active_base_get(view_layer); + const bool active = base && ((ob->base_flag & BASE_FROM_DUPLI) ? + (DRW_object_get_dupli_parent(ob) == base->object) : + (base->object == ob)); /* confusing logic here, there are 2 methods of setting the color * 'colortab[colindex]' and 'theme_id', colindex overrides theme_id. diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 493fa4d5744..9761aa8c789 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1324,6 +1324,7 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx) /* Reset before using it. */ drw_state_prepare_clean_for_draw(&DST); + BKE_view_layer_synced_ensure(scene, view_layer); DST.draw_ctx = (DRWContextState){ .region = region, .rv3d = rv3d, @@ -1377,6 +1378,7 @@ static void drw_notify_view_update_offscreen(struct Depsgraph *depsgraph, /* Reset before using it. */ drw_state_prepare_clean_for_draw(&DST); + BKE_view_layer_synced_ensure(scene, view_layer); DST.draw_ctx = (DRWContextState){ .region = region, .rv3d = rv3d, @@ -1629,6 +1631,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph, ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); RegionView3D *rv3d = region->regiondata; + BKE_view_layer_synced_ensure(scene, view_layer); DST.draw_ctx.evil_C = evil_C; DST.draw_ctx = (DRWContextState){ .region = region, @@ -2143,6 +2146,7 @@ void DRW_draw_render_loop_2d_ex(struct Depsgraph *depsgraph, Scene *scene = DEG_get_evaluated_scene(depsgraph); ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); + BKE_view_layer_synced_ensure(scene, view_layer); DST.draw_ctx.evil_C = evil_C; DST.draw_ctx = (DRWContextState){ .region = region, @@ -2349,6 +2353,8 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, Scene *scene = DEG_get_evaluated_scene(depsgraph); RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type); ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); + + BKE_view_layer_synced_ensure(scene, view_layer); Object *obact = BKE_view_layer_active_object_get(view_layer); Object *obedit = use_obedit_skip ? NULL : OBEDIT_FROM_OBACT(obact); #ifndef USE_GPU_SELECT @@ -2580,6 +2586,7 @@ static void drw_draw_depth_loop_impl(struct Depsgraph *depsgraph, DST.options.is_depth = true; /* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */ + BKE_view_layer_synced_ensure(scene, view_layer); DST.draw_ctx = (DRWContextState){ .region = region, .rv3d = rv3d, @@ -2713,6 +2720,7 @@ void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, cons drw_state_prepare_clean_for_draw(&DST); /* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */ + BKE_view_layer_synced_ensure(scene, view_layer); DST.draw_ctx = (DRWContextState){ .region = region, .rv3d = region->regiondata, |