Commit: a72220ecf097d9d23d64c5afc774fcedc353f81c
Author: Campbell Barton
Date:   Wed Dec 19 10:55:53 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBa72220ecf097d9d23d64c5afc774fcedc353f81c

DNA: move back-face culling to shading popover

Overlay options shouldn't be used when overlays are disabled.

Move to shading popover, reported as T58070.

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

M       release/scripts/startup/bl_ui/space_view3d.py
M       source/blender/blenloader/intern/versioning_280.c
M       source/blender/draw/engines/basic/basic_engine.c
M       source/blender/draw/engines/eevee/eevee_materials.c
M       source/blender/draw/engines/workbench/workbench_deferred.c
M       source/blender/draw/engines/workbench/workbench_forward.c
M       source/blender/makesdna/DNA_view3d_types.h
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 3c713de9a71..e8fb17258d1 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4547,6 +4547,9 @@ class VIEW3D_PT_shading_options(Panel):
             )
 
             col = layout.column()
+
+            col.prop(shading, "show_backface_culling")
+
             row = col.row()
             row.active = not shading.show_xray
             row.prop(shading, "show_cavity")
@@ -4766,13 +4769,9 @@ class VIEW3D_PT_overlay_geometry(Panel):
         col = layout.column(align=True)
         col.active = display_all
 
-        split = col.split()
-        sub = split.column(align=True)
-        sub.prop(overlay, "show_backface_culling")
+        col.prop(overlay, "show_face_orientation")
 
-        sub = split.column(align=True)
-        #sub.prop(overlay, "show_onion_skins")
-        sub.prop(overlay, "show_face_orientation")
+        # sub.prop(overlay, "show_onion_skins")
 
 
 class VIEW3D_PT_overlay_motion_tracking(Panel):
diff --git a/source/blender/blenloader/intern/versioning_280.c 
b/source/blender/blenloader/intern/versioning_280.c
index a2a2c3fb738..0c9b9806425 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2743,5 +2743,24 @@ void blo_do_versions_280(FileData *fd, Library 
*UNUSED(lib), Main *bmain)
                                        SCE_SNAP_TRANSFORM_MODE_TRANSLATE;
                        }
                }
+
+               for (bScreen *screen = bmain->screen.first; screen; screen = 
screen->id.next) {
+                       for (ScrArea *area = screen->areabase.first; area; area 
= area->next) {
+                               for (SpaceLink *sl = area->spacedata.first; sl; 
sl = sl->next) {
+                                       switch (sl->spacetype) {
+                                               case SPACE_VIEW3D:
+                                               {
+                                                       enum { 
V3D_BACKFACE_CULLING = (1 << 10) };
+                                                       View3D *v3d = (View3D 
*)sl;
+                                                       if (v3d->flag2 & 
V3D_BACKFACE_CULLING) {
+                                                               v3d->flag2 &= 
~V3D_BACKFACE_CULLING;
+                                                               
v3d->shading.flag |= V3D_SHADING_BACKFACE_CULLING;
+                                                       }
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+               }
        }
 }
diff --git a/source/blender/draw/engines/basic/basic_engine.c 
b/source/blender/draw/engines/basic/basic_engine.c
index f64d345c52f..cf0605c7eda 100644
--- a/source/blender/draw/engines/basic/basic_engine.c
+++ b/source/blender/draw/engines/basic/basic_engine.c
@@ -160,7 +160,7 @@ static void basic_cache_populate(void *vedata, Object *ob)
 
        struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
        if (geom) {
-               const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->flag2 & 
V3D_BACKFACE_CULLING));
+               const bool do_cull = (draw_ctx->v3d && 
(draw_ctx->v3d->shading.flag & V3D_SHADING_BACKFACE_CULLING));
                /* Depth Prepass */
                DRW_shgroup_call_add((do_cull) ? stl->g_data->depth_shgrp_cull 
: stl->g_data->depth_shgrp, geom, ob->obmat);
        }
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c 
b/source/blender/draw/engines/eevee/eevee_materials.c
index f26920c2474..00b77eee19b 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -1439,7 +1439,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, 
EEVEE_ViewLayerData *sld
        Scene *scene = draw_ctx->scene;
        GHash *material_hash = stl->g_data->material_hash;
 
-       const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->flag2 & 
V3D_BACKFACE_CULLING));
+       const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->shading.flag & 
V3D_SHADING_BACKFACE_CULLING));
        const bool is_active = (ob == draw_ctx->obact);
        const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & 
OB_MODE_SCULPT) != 0;
        /* For now just force fully shaded with eevee when supported. */
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c 
b/source/blender/draw/engines/workbench/workbench_deferred.c
index 66a98ef2e00..0b7d840a589 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -487,7 +487,7 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
        /* Prepass */
        {
                DRWShadingGroup *grp;
-               const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->flag2 & 
V3D_BACKFACE_CULLING));
+               const bool do_cull = (draw_ctx->v3d && 
(draw_ctx->v3d->shading.flag & V3D_SHADING_BACKFACE_CULLING));
 
                int state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | 
DRW_STATE_DEPTH_LESS_EQUAL;
                psl->prepass_pass = DRW_pass_create("Prepass", (do_cull) ? 
state | DRW_STATE_CULL_BACK : state);
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c 
b/source/blender/draw/engines/workbench/workbench_forward.c
index 3b755b31156..7a0a5e20864 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -325,7 +325,7 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
        });
 
        workbench_volume_cache_init(vedata);
-       const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->flag2 & 
V3D_BACKFACE_CULLING));
+       const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->shading.flag & 
V3D_SHADING_BACKFACE_CULLING));
        const int cull_state = (do_cull) ? DRW_STATE_CULL_BACK : 0;
 
        /* Transparency Accum */
diff --git a/source/blender/makesdna/DNA_view3d_types.h 
b/source/blender/makesdna/DNA_view3d_types.h
index 242be7b75cc..1fc143ed71f 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -362,7 +362,7 @@ typedef struct View3D {
 #define V3D_SHOW_RECONSTRUCTION (1 << 7)
 #define V3D_SHOW_CAMERAPATH     (1 << 8)
 #define V3D_SHOW_BUNDLENAME     (1 << 9)
-#define V3D_BACKFACE_CULLING    (1 << 10)
+#define V3D_FLAG2_DEPRECATED_10 (1 << 10)  /* cleared */
 #define V3D_RENDER_BORDER       (1 << 11)
 #define V3D_FLAG2_DEPRECATED_12 (1 << 12)  /* cleared */
 #define V3D_FLAG2_DEPRECATED_13 (1 << 13)  /* cleared */
@@ -396,6 +396,7 @@ enum {
        V3D_SHADING_SCENE_WORLD         = (1 << 7),
        V3D_SHADING_XRAY_BONE           = (1 << 8),
        V3D_SHADING_WORLD_ORIENTATION   = (1 << 9),
+       V3D_SHADING_BACKFACE_CULLING    = (1 << 10),
 };
 
 /* View3DShading->color_type */
diff --git a/source/blender/makesrna/intern/rna_space.c 
b/source/blender/makesrna/intern/rna_space.c
index f3d2d5d805e..b77eed67d21 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2475,6 +2475,11 @@ static void rna_def_space_view3d_shading(BlenderRNA 
*brna)
        RNA_def_property_ui_text(prop, "World Space Lighting", "Make the 
lighting fixed and not follow the camera");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
+       prop = RNA_def_property(srna, "show_backface_culling", PROP_BOOLEAN, 
PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", 
V3D_SHADING_BACKFACE_CULLING);
+       RNA_def_property_ui_text(prop, "Backface Culling", "Use back face 
culling to hide the back side of faces");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
        prop = RNA_def_property(srna, "show_cavity", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_CAVITY);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -2726,12 +2731,6 @@ static void rna_def_space_view3d_overlay(BlenderRNA 
*brna)
                                 "Show dashed lines indicating parent or 
constraint relationships");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
 
-       /* TODO: this should become a per object setting? */
-       prop = RNA_def_property(srna, "show_backface_culling", PROP_BOOLEAN, 
PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag2", 
V3D_BACKFACE_CULLING);
-       RNA_def_property_ui_text(prop, "Backface Culling", "Use back face 
culling to hide the back side of faces");
-       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
        prop = RNA_def_property(srna, "show_cursor", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", 
V3D_OVERLAY_HIDE_CURSOR);
        RNA_def_property_ui_text(prop, "Show 3D Cursor", "Display 3D Cursor 
Overlay");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to