DRW: Add back wireframe mode

This is using the existing engine (workbench forward) with 0.0 xray_alpha
and forcing wireframes on all objects.

There is no workflow/shortcut changes in this commit.
This commit is contained in:
2018-09-21 14:10:06 +02:00
parent 6934b246d1
commit 3523958de9
5 changed files with 50 additions and 30 deletions

View File

@@ -363,11 +363,21 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
/* Checker Depth */
{
float blend_threshold = 0.0f;
if (draw_ctx->v3d->shading.flag & V3D_SHADING_XRAY) {
blend_threshold = 0.75f - wpd->shading.xray_alpha * 0.5f;
}
if (draw_ctx->v3d->shading.type == OB_WIRE) {
wpd->shading.xray_alpha = 0.0f;
}
int state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS;
psl->checker_depth_pass = DRW_pass_create("Checker Depth", state);
grp = DRW_shgroup_create(e_data.checker_depth_sh, psl->checker_depth_pass);
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
DRW_shgroup_uniform_float_copy(grp, "threshold", 0.75f - wpd->shading.xray_alpha * 0.5f);
DRW_shgroup_uniform_float_copy(grp, "threshold", blend_threshold);
}
}

View File

@@ -1164,6 +1164,7 @@ static void drw_engines_enable_from_engine(RenderEngineType *engine_type, int dr
{
switch (drawtype) {
case OB_WIRE:
use_drw_engine(&draw_engine_workbench_transparent);
break;
case OB_SOLID:

View File

@@ -236,6 +236,7 @@ static void overlay_cache_populate(void *vedata, Object *ob)
}
if ((stl->g_data->overlay.flag & V3D_OVERLAY_WIREFRAMES) ||
(v3d->shading.type == OB_WIRE) ||
(ob->dtx & OB_DRAWWIRE) ||
(ob->dt == OB_WIRE))
{

View File

@@ -238,9 +238,10 @@ static const EnumPropertyItem autosnap_items[] = {
#endif
const EnumPropertyItem rna_enum_shading_type_items[] = {
{OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display in solid mode"},
{OB_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "LookDev", "Display in LookDev mode"},
{OB_RENDER, "RENDERED", ICON_SMOOTH, "Rendered", "Display render preview"},
{OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"},
{OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display in solid mode"},
{OB_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "LookDev", "Display in LookDev mode"},
{OB_RENDER, "RENDERED", ICON_SMOOTH, "Rendered", "Display render preview"},
{0, NULL, 0, NULL, NULL}
};
@@ -769,6 +770,7 @@ static const EnumPropertyItem *rna_3DViewShading_type_itemf(
EnumPropertyItem *item = NULL;
int totitem = 0;
RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_WIRE);
RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_SOLID);
if (BKE_scene_uses_blender_eevee(scene)) {