UI: Object Types Visibility Popover Tweaks #111285
|
@ -6098,8 +6098,8 @@ class VIEW3D_PT_collections(Panel):
|
|||
class VIEW3D_PT_object_type_visibility(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = "View Object Types"
|
||||
bl_ui_units_x = 7
|
||||
bl_label = "Selectability & Visibility"
|
||||
bl_ui_units_x = 8
|
||||
|
||||
# Allows derived classes to pass view data other than context.space_data.
|
||||
# This is used by the official VR add-on, which passes XrSessionSettings
|
||||
|
@ -6109,33 +6109,30 @@ class VIEW3D_PT_object_type_visibility(Panel):
|
|||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
layout.label(text="Object Types Visibility")
|
||||
layout.label(text="Selectability & Visibility")
|
||||
layout.separator()
|
||||
col = layout.column()
|
||||
col = layout.column(align=True)
|
||||
|
||||
attr_object_types = (
|
||||
# Geometry
|
||||
("mesh", "Mesh"),
|
||||
("curve", "Curve"),
|
||||
("surf", "Surface"),
|
||||
("meta", "Meta"),
|
||||
("font", "Text"),
|
||||
("curves", "Hair Curves"),
|
||||
("pointcloud", "Point Cloud"),
|
||||
("volume", "Volume"),
|
||||
("grease_pencil", "Grease Pencil"),
|
||||
(None, None),
|
||||
# Other
|
||||
("armature", "Armature"),
|
||||
("lattice", "Lattice"),
|
||||
("empty", "Empty"),
|
||||
("light", "Light"),
|
||||
("light_probe", "Light Probe"),
|
||||
("camera", "Camera"),
|
||||
("speaker", "Speaker"),
|
||||
("mesh", "Mesh", "OUTLINER_OB_MESH"),
|
||||
("curve", "Curve", "OUTLINER_OB_CURVE"),
|
||||
("surf", "Surface", "OUTLINER_OB_SURFACE"),
|
||||
("meta", "Meta", "OUTLINER_OB_META"),
|
||||
("font", "Text", "OUTLINER_OB_FONT"),
|
||||
("curves", "Hair Curves", "OUTLINER_OB_CURVES"),
|
||||
("pointcloud", "Point Cloud", "OUTLINER_OB_POINTCLOUD"),
|
||||
("volume", "Volume", "OUTLINER_OB_VOLUME"),
|
||||
("grease_pencil", "Grease Pencil", "OUTLINER_OB_GREASEPENCIL"),
|
||||
("armature", "Armature", "OUTLINER_OB_ARMATURE"),
|
||||
("lattice", "Lattice", "OUTLINER_OB_LATTICE"),
|
||||
("empty", "Empty", "OUTLINER_OB_EMPTY"),
|
||||
("light", "Light", "OUTLINER_OB_LIGHT"),
|
||||
("light_probe", "Light Probe", "OUTLINER_OB_LIGHTPROBE"),
|
||||
("camera", "Camera", "OUTLINER_OB_CAMERA"),
|
||||
("speaker", "Speaker", "OUTLINER_OB_SPEAKER"),
|
||||
)
|
||||
|
||||
for attr, attr_name in attr_object_types:
|
||||
for attr, attr_name, attr_icon in attr_object_types:
|
||||
if attr is None:
|
||||
col.separator()
|
||||
continue
|
||||
|
@ -6149,10 +6146,7 @@ class VIEW3D_PT_object_type_visibility(Panel):
|
|||
icon_v = 'HIDE_OFF' if getattr(view, attr_v) else 'HIDE_ON'
|
||||
|
||||
row = col.row(align=True)
|
||||
row.alignment = 'RIGHT'
|
||||
|
||||
row.label(text=attr_name)
|
||||
row.prop(view, attr_v, text="", icon=icon_v, emboss=False)
|
||||
row.label(text=attr_name, icon=attr_icon)
|
||||
|
||||
if show_select:
|
||||
attr_s = "show_object_select_" + attr
|
||||
|
@ -6162,6 +6156,9 @@ class VIEW3D_PT_object_type_visibility(Panel):
|
|||
rowsub.active = getattr(view, attr_v)
|
||||
rowsub.prop(view, attr_s, text="", icon=icon_s, emboss=False)
|
||||
|
||||
row.prop(view, attr_v, text="", icon=icon_v, emboss=False)
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
view = context.space_data
|
||||
self.draw_ex(context, view, True)
|
||||
|
|
|
@ -130,39 +130,72 @@ void rna_def_object_type_visibility_flags_common(StructRNA *srna,
|
|||
const char *name;
|
||||
int type_mask;
|
||||
const char *identifier[2];
|
||||
const char *description[2];
|
||||
} info[] = {
|
||||
{"Mesh", (1 << OB_MESH), {"show_object_viewport_mesh", "show_object_select_mesh"}},
|
||||
{"Mesh",
|
||||
(1 << OB_MESH),
|
||||
{"show_object_viewport_mesh", "show_object_select_mesh"},
|
||||
{"Show mesh objects", "Allow selection of mesh objects"}},
|
||||
{"Curve",
|
||||
(1 << OB_CURVES_LEGACY),
|
||||
{"show_object_viewport_curve", "show_object_select_curve"}},
|
||||
{"Surface", (1 << OB_SURF), {"show_object_viewport_surf", "show_object_select_surf"}},
|
||||
{"Meta", (1 << OB_MBALL), {"show_object_viewport_meta", "show_object_select_meta"}},
|
||||
{"Font", (1 << OB_FONT), {"show_object_viewport_font", "show_object_select_font"}},
|
||||
{"show_object_viewport_curve", "show_object_select_curve"},
|
||||
{"Show curves", "Allow selection of curves"}},
|
||||
{"Surface",
|
||||
(1 << OB_SURF),
|
||||
{"show_object_viewport_surf", "show_object_select_surf"},
|
||||
{"Show surfaces", "Allow selection of surfaces"}},
|
||||
{"Meta",
|
||||
(1 << OB_MBALL),
|
||||
{"show_object_viewport_meta", "show_object_select_meta"},
|
||||
{"Show metaballs", "Allow selection of metaballs"}},
|
||||
{"Font",
|
||||
(1 << OB_FONT),
|
||||
{"show_object_viewport_font", "show_object_select_font"},
|
||||
{"Show text objects", "Allow selection of text objects"}},
|
||||
{"Hair Curves",
|
||||
(1 << OB_CURVES),
|
||||
{"show_object_viewport_curves", "show_object_select_curves"}},
|
||||
{"show_object_viewport_curves", "show_object_select_curves"},
|
||||
{"Show hair curves", "Allow selection of hair curves"}},
|
||||
{"Point Cloud",
|
||||
(1 << OB_POINTCLOUD),
|
||||
{"show_object_viewport_pointcloud", "show_object_select_pointcloud"}},
|
||||
{"Volume", (1 << OB_VOLUME), {"show_object_viewport_volume", "show_object_select_volume"}},
|
||||
{"show_object_viewport_pointcloud", "show_object_select_pointcloud"},
|
||||
{"Show point clouds", "Allow selection of point clouds"}},
|
||||
{"Volume",
|
||||
(1 << OB_VOLUME),
|
||||
{"show_object_viewport_volume", "show_object_select_volume"},
|
||||
{"Show volumes", "Allow selection of volumes"}},
|
||||
{"Armature",
|
||||
(1 << OB_ARMATURE),
|
||||
{"show_object_viewport_armature", "show_object_select_armature"}},
|
||||
{"show_object_viewport_armature", "show_object_select_armature"},
|
||||
{"Show armatures", "Allow selection of armatures"}},
|
||||
{"Lattice",
|
||||
(1 << OB_LATTICE),
|
||||
{"show_object_viewport_lattice", "show_object_select_lattice"}},
|
||||
{"Empty", (1 << OB_EMPTY), {"show_object_viewport_empty", "show_object_select_empty"}},
|
||||
{"show_object_viewport_lattice", "show_object_select_lattice"},
|
||||
{"Show lattices", "Allow selection of lattices"}},
|
||||
{"Empty",
|
||||
(1 << OB_EMPTY),
|
||||
{"show_object_viewport_empty", "show_object_select_empty"},
|
||||
{"Show empties", "Allow selection of empties"}},
|
||||
{"Grease Pencil",
|
||||
(1 << OB_GPENCIL_LEGACY),
|
||||
{"show_object_viewport_grease_pencil", "show_object_select_grease_pencil"}},
|
||||
{"Camera", (1 << OB_CAMERA), {"show_object_viewport_camera", "show_object_select_camera"}},
|
||||
{"Light", (1 << OB_LAMP), {"show_object_viewport_light", "show_object_select_light"}},
|
||||
{"show_object_viewport_grease_pencil", "show_object_select_grease_pencil"},
|
||||
{"Show grease pencil objects", "Allow selection of grease pencil objects"}},
|
||||
{"Camera",
|
||||
(1 << OB_CAMERA),
|
||||
{"show_object_viewport_camera", "show_object_select_camera"},
|
||||
{"Show cameras", "Allow selection of cameras"}},
|
||||
{"Light",
|
||||
(1 << OB_LAMP),
|
||||
{"show_object_viewport_light", "show_object_select_light"},
|
||||
{"Show lights", "Allow selection of lights"}},
|
||||
{"Speaker",
|
||||
(1 << OB_SPEAKER),
|
||||
{"show_object_viewport_speaker", "show_object_select_speaker"}},
|
||||
{"show_object_viewport_speaker", "show_object_select_speaker"},
|
||||
{"Show speakers", "Allow selection of speakers"}},
|
||||
{"Light Probe",
|
||||
(1 << OB_LIGHTPROBE),
|
||||
{"show_object_viewport_light_probe", "show_object_select_light_probe"}},
|
||||
{"show_object_viewport_light_probe", "show_object_select_light_probe"},
|
||||
{"Show light probes", "Allow selection of light probes"}},
|
||||
};
|
||||
|
||||
const char *view_mask_member[2] = {
|
||||
|
@ -175,7 +208,8 @@ void rna_def_object_type_visibility_flags_common(StructRNA *srna,
|
|||
srna, info[type_index].identifier[mask_index], PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(
|
||||
prop, nullptr, view_mask_member[mask_index], info[type_index].type_mask);
|
||||
RNA_def_property_ui_text(prop, info[type_index].name, "");
|
||||
RNA_def_property_ui_text(
|
||||
prop, info[type_index].name, info[type_index].description[mask_index]);
|
||||
RNA_def_property_update(prop, noteflag, update_func);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue