Object Mode: Add back support for the object "Maximum draw type" option

This commit is contained in:
Clément Foucault 2018-08-20 13:18:41 +02:00
parent 70e10d6207
commit 31a1c2b7d2
Notes: blender-bot 2023-02-14 05:25:40 +01:00
Referenced by issue #56474, DrawData memory leak when exiting Blender on 02_040_A.anim.blend
3 changed files with 12 additions and 5 deletions

View File

@ -152,6 +152,9 @@ bool DRW_object_is_renderable(Object *ob)
{
BLI_assert(BKE_object_is_visible(ob, OB_VISIBILITY_CHECK_UNKNOWN_RENDER_MODE));
if (ob->dt < OB_SOLID)
return false;
if (ob->type == OB_MESH) {
if ((ob == DST.draw_ctx.object_edit) || BKE_object_is_in_editmode(ob)) {
View3D *v3d = DST.draw_ctx.v3d;

View File

@ -2521,7 +2521,8 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
return;
}
const bool do_outlines = (draw_ctx->v3d->flag & V3D_SELECT_OUTLINE) && ((ob->base_flag & BASE_SELECTED) != 0);
const bool do_outlines = (draw_ctx->v3d->flag & V3D_SELECT_OUTLINE) && ((ob->base_flag & BASE_SELECTED) != 0) &&
(DRW_object_is_renderable(ob) || (ob->dt == OB_WIRE));
const bool show_relations = ((draw_ctx->v3d->flag & V3D_HIDE_HELPLINES) == 0);
const bool hide_object_extra = (v3d->overlay.flag & V3D_OVERLAY_HIDE_OBJECT_XTRAS) != 0;
@ -2711,7 +2712,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
DRW_shgroup_texture_space(sgl, ob, theme_id);
}
if (ob->dtx & OB_DRAWBOUNDOX) {
if (ob->dtx & OB_DRAWBOUNDOX || ob->dt == OB_BOUNDBOX) {
DRW_shgroup_bounds(sgl, ob, theme_id);
}

View File

@ -182,17 +182,20 @@ static void overlay_cache_populate(void *vedata, Object *ob)
if (!stl->g_data->show_overlays)
return;
if (!DRW_object_is_renderable(ob))
if (!DRW_object_is_renderable(ob) && (ob->dt != OB_WIRE))
return;
if (stl->g_data->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION) {
if (DRW_object_is_renderable(ob) && stl->g_data->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION) {
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
DRW_shgroup_call_add(pd->face_orientation_shgrp, geom, ob->obmat);
}
}
if ((stl->g_data->overlay.flag & V3D_OVERLAY_WIREFRAMES) || (ob->dtx & OB_DRAWWIRE)) {
if ((stl->g_data->overlay.flag & V3D_OVERLAY_WIREFRAMES) ||
(ob->dtx & OB_DRAWWIRE) ||
(ob->dt == OB_WIRE))
{
/* Don't do that in edit mode. */
if ((ob != draw_ctx->object_edit) && !BKE_object_is_in_editmode(ob)) {
int tri_count;