UI: Hide asset shelf toggles if not available #113063
|
@ -3398,6 +3398,9 @@ class WM_MT_region_toggle_pie(Menu):
|
|||
region_by_type = {}
|
||||
|
||||
for region in context.area.regions:
|
||||
if region.poll_failed:
|
||||
continue
|
||||
|
||||
region_type = region.type
|
||||
attr = cls._region_info.get(region_type, None)
|
||||
if attr is None:
|
||||
|
|
|
@ -1338,6 +1338,11 @@ class VIEW3D_MT_uv_map(Menu):
|
|||
|
||||
# ********** View menus **********
|
||||
|
||||
def asset_shelf_available(context):
|
||||
for region in context.area.regions:
|
||||
if region.type == 'ASSET_SHELF' and not region.poll_failed:
|
||||
return True
|
||||
return False
|
||||
|
||||
class VIEW3D_MT_view(Menu):
|
||||
bl_label = "View"
|
||||
|
@ -1350,7 +1355,8 @@ class VIEW3D_MT_view(Menu):
|
|||
layout.prop(view, "show_region_toolbar")
|
||||
layout.prop(view, "show_region_ui")
|
||||
layout.prop(view, "show_region_tool_header")
|
||||
layout.prop(view, "show_region_asset_shelf")
|
||||
if asset_shelf_available(context):
|
||||
layout.prop(view, "show_region_asset_shelf")
|
||||
layout.prop(view, "show_region_hud")
|
||||
|
||||
layout.separator()
|
||||
|
|
|
@ -523,6 +523,12 @@ static void rna_def_region(BlenderRNA *brna)
|
|||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Region Type", "Type of this region");
|
||||
|
||||
prop = RNA_def_property(srna, "poll_failed", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", RGN_FLAG_POLL_FAILED);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "", "If true, the region is not available in the current context");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
||||
prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "winrct.xmin");
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
|
|
Loading…
Reference in New Issue