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.
This commit is contained in:
parent
d46d8e831c
commit
a72220ecf0
Notes:
blender-bot
2023-02-14 10:54:29 +01:00
Referenced by issue #58070, The Backface Culling option should move from Overlays to Shading
|
@ -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):
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue