UI: Shading: Move Cavity properties into a subpanel

Move cavity properties to a separate subpanel, instead of being
in-between unrelated settings.

Avoids issues with add-ons appending to the "Options" subpanel, which
would push cavity properties back to the middle.

Properties are now greyed out (instead of hidden) when unavailable
due to X-Ray being enabled.

More details and screenshots in pull request.

Pull Request: https://projects.blender.org/blender/blender/pulls/133944
This commit is contained in:
Nika Kutsniashvili
2025-02-05 17:08:55 +01:00
committed by Pablo Vazquez
parent 55de54557c
commit 9627bdfab3

View File

@@ -6687,32 +6687,6 @@ class VIEW3D_PT_shading_options(Panel):
text="",
)
col = layout.column()
row = col.row()
row.active = not xray_active
row.prop(shading, "show_cavity")
if shading.show_cavity and not xray_active:
row.prop(shading, "cavity_type", text="Type")
if shading.cavity_type in {'WORLD', 'BOTH'}:
col.label(text="World Space")
sub = col.row(align=True)
sub.prop(shading, "cavity_ridge_factor", text="Ridge")
sub.prop(shading, "cavity_valley_factor", text="Valley")
sub.popover(
panel="VIEW3D_PT_shading_options_ssao",
icon='PREFERENCES',
text="",
)
if shading.cavity_type in {'SCREEN', 'BOTH'}:
col.label(text="Screen Space")
sub = col.row(align=True)
sub.prop(shading, "curvature_ridge_factor", text="Ridge")
sub.prop(shading, "curvature_valley_factor", text="Valley")
row = col.row()
row.active = not xray_active
row.prop(shading, "use_dof", text="Depth of Field")
@@ -6764,6 +6738,57 @@ class VIEW3D_PT_shading_options_ssao(Panel):
col.prop(scene.display, "matcap_ssao_attenuation")
class VIEW3D_PT_shading_cavity(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
bl_label = "Cavity"
bl_parent_id = "VIEW3D_PT_shading"
@classmethod
def poll(cls, context):
shading = VIEW3D_PT_shading.get_shading(context)
return shading.type in {'SOLID'}
def draw_header(self, context):
layout = self.layout
shading = VIEW3D_PT_shading.get_shading(context)
xray_active = shading.show_xray and shading.xray_alpha != 1
row = layout.row()
row.active = not xray_active
row.prop(shading, "show_cavity")
if shading.show_cavity:
row.prop(shading, "cavity_type", text="Type")
def draw(self, context):
layout = self.layout
shading = VIEW3D_PT_shading.get_shading(context)
xray_active = shading.show_xray and shading.xray_alpha != 1
col = layout.column()
col.active = not xray_active
if shading.show_cavity:
if shading.cavity_type in {'WORLD', 'BOTH'}:
row = col.row()
row.label(text="World Space")
row.popover(
panel="VIEW3D_PT_shading_options_ssao",
icon='PREFERENCES',
text="",
)
row = col.row()
row.prop(shading, "cavity_ridge_factor", text="Ridge")
row.prop(shading, "cavity_valley_factor", text="Valley")
if shading.cavity_type in {'SCREEN', 'BOTH'}:
col.label(text="Screen Space")
row = col.row()
row.prop(shading, "curvature_ridge_factor", text="Ridge")
row.prop(shading, "curvature_valley_factor", text="Valley")
class VIEW3D_PT_shading_render_pass(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
@@ -9082,6 +9107,7 @@ classes = (
VIEW3D_PT_shading_options,
VIEW3D_PT_shading_options_shadow,
VIEW3D_PT_shading_options_ssao,
VIEW3D_PT_shading_cavity,
VIEW3D_PT_shading_render_pass,
VIEW3D_PT_shading_compositor,
VIEW3D_PT_gizmo_display,