UI: hide Viewport Display Bounds for object types that dont have

bounding boxes

These are namely 'LIGHT', 'CAMERA', 'EMPTY', 'SPEAKER' and 'LIGHTPROBE'.

Note that Empties are included here despite the fact that they have
instancing capabilities ('Display As' can be 'Bounds' for example which
then displays all instanced geometry with boundingboxes -- this however
is not meant to work with the 'Bounds' checkbox and the display bounds
type, these are only affective for the object itself, not its instances)

Issue came up in T88443.

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11344
This commit is contained in:
Philipp Oeser 2021-05-21 16:51:37 +02:00
parent b6538e1492
commit 6806459246
Notes: blender-bot 2023-02-13 18:37:36 +01:00
Referenced by issue #88443, Lattice still shows edges with "Bounds" display type.
1 changed files with 11 additions and 9 deletions

View File

@ -216,6 +216,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel):
obj = context.object
obj_type = obj.type
is_geometry = (obj_type in {'MESH', 'CURVE', 'SURFACE', 'META', 'FONT', 'VOLUME', 'HAIR', 'POINTCLOUD'})
has_bounds = (is_geometry or obj_type in {'LATTICE', 'ARMATURE'})
is_wire = (obj_type in {'CAMERA', 'EMPTY'})
is_empty_image = (obj_type == 'EMPTY' and obj.empty_display_type == 'IMAGE')
is_dupli = (obj.instance_type != 'NONE')
@ -247,15 +248,16 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel):
# Only useful with object having faces/materials...
col.prop(obj, "color")
col = layout.column(align=False, heading="Bounds")
col.use_property_decorate = False
row = col.row(align=True)
sub = row.row(align=True)
sub.prop(obj, "show_bounds", text="")
sub = sub.row(align=True)
sub.active = obj.show_bounds or (obj.display_type == 'BOUNDS')
sub.prop(obj, "display_bounds_type", text="")
row.prop_decorator(obj, "display_bounds_type")
if has_bounds:
col = layout.column(align=False, heading="Bounds")
col.use_property_decorate = False
row = col.row(align=True)
sub = row.row(align=True)
sub.prop(obj, "show_bounds", text="")
sub = sub.row(align=True)
sub.active = obj.show_bounds or (obj.display_type == 'BOUNDS')
sub.prop(obj, "display_bounds_type", text="")
row.prop_decorator(obj, "display_bounds_type")
class OBJECT_PT_instancing(ObjectButtonsPanel, Panel):