[Bf-blender-cvs] [3523958de9f] blender2.8: DRW: Add back wireframe mode

Clément Foucault noreply at git.blender.org
Fri Sep 21 16:08:15 CEST 2018


Commit: 3523958de9f129e260a8a31260ef9459a10cc3cc
Author: Clément Foucault
Date:   Fri Sep 21 14:10:06 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB3523958de9f129e260a8a31260ef9459a10cc3cc

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.

===================================================================

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/draw/engines/workbench/workbench_forward.c
M	source/blender/draw/intern/draw_manager.c
M	source/blender/draw/modes/overlay_mode.c
M	source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 8f6f3f7f4bf..095bac456d2 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3963,6 +3963,11 @@ class VIEW3D_PT_shading_lighting(Panel):
     bl_label = "Lighting"
     bl_parent_id = 'VIEW3D_PT_shading'
 
+    @classmethod
+    def poll(cls, context):
+        shading = VIEW3D_PT_shading.get_shading(context)
+        return shading.type in {'SOLID', 'MATERIAL'}
+
     def draw(self, context):
         layout = self.layout
         shading = VIEW3D_PT_shading.get_shading(context)
@@ -4028,7 +4033,7 @@ class VIEW3D_PT_shading_color(Panel):
     @classmethod
     def poll(cls, context):
         shading = VIEW3D_PT_shading.get_shading(context)
-        return shading.type == 'SOLID'
+        return shading.type in {'WIREFRAME', 'SOLID'}
 
     def _draw_color_type(self, context):
         layout = self.layout
@@ -4061,7 +4066,7 @@ class VIEW3D_PT_shading_options(Panel):
     @classmethod
     def poll(cls, context):
         shading = VIEW3D_PT_shading.get_shading(context)
-        return shading.type == 'SOLID'
+        return shading.type in {'WIREFRAME', 'SOLID'}
 
     def draw(self, context):
         layout = self.layout
@@ -4079,34 +4084,35 @@ class VIEW3D_PT_shading_options(Panel):
         sub.active = is_xray
         sub.prop(shading, "xray_alpha", text="X-Ray")
 
-        row = col.row()
-        row.prop(shading, "show_shadows", text="")
-        row.active = not is_xray
-        sub = row.row(align=True)
-        sub.active = is_shadows
-        sub.prop(shading, "shadow_intensity", text="Shadow")
-        sub.popover(
-            panel="VIEW3D_PT_shading_options_shadow",
-            icon='SCRIPTWIN',
-            text=""
-        )
-
-        col = layout.column()
-        row = col.row()
-        row.active = not is_xray
-        row.prop(shading, "show_cavity")
-
-        if shading.show_cavity:
-            sub = col.row(align=True)
-            sub.active = not shading.show_xray and shading.show_cavity
-            sub.prop(shading, "cavity_ridge_factor")
-            sub.prop(shading, "cavity_valley_factor")
+        if shading.type == 'SOLID':
+            row = col.row()
+            row.prop(shading, "show_shadows", text="")
+            row.active = not is_xray
+            sub = row.row(align=True)
+            sub.active = is_shadows
+            sub.prop(shading, "shadow_intensity", text="Shadow")
             sub.popover(
-                panel="VIEW3D_PT_shading_options_ssao",
+                panel="VIEW3D_PT_shading_options_shadow",
                 icon='SCRIPTWIN',
                 text=""
             )
 
+            col = layout.column()
+            row = col.row()
+            row.active = not is_xray
+            row.prop(shading, "show_cavity")
+
+            if shading.show_cavity:
+                sub = col.row(align=True)
+                sub.active = not shading.show_xray and shading.show_cavity
+                sub.prop(shading, "cavity_ridge_factor")
+                sub.prop(shading, "cavity_valley_factor")
+                sub.popover(
+                    panel="VIEW3D_PT_shading_options_ssao",
+                    icon='SCRIPTWIN',
+                    text=""
+                )
+
         row = layout.split()
         row.prop(shading, "show_object_outline")
         sub = row.row()
@@ -4114,7 +4120,7 @@ class VIEW3D_PT_shading_options(Panel):
         sub.prop(shading, "object_outline_color", text="")
 
         col = layout.column()
-        if not shading.light == 'MATCAP':
+        if shading.light not in {'WIREFRAME', 'MATCAP'}:
             col.prop(shading, "show_specular_highlight")
 
 
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index 2df81314cf4..938852c764e 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -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);
 	}
 }
 
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index f1d92736f54..73e2c4920b8 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -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:
diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c
index c6a5e9b8335..53934de9d0e 100644
--- a/source/blender/draw/modes/overlay_mode.c
+++ b/source/blender/draw/modes/overlay_mode.c
@@ -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))
 	{
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index c757f648f4d..8552d8ea731 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -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)) {



More information about the Bf-blender-cvs mailing list