[Bf-blender-cvs] [68064592462] master: UI: hide Viewport Display Bounds for object types that dont have bounding boxes

Philipp Oeser noreply at git.blender.org
Tue Aug 10 17:37:52 CEST 2021


Commit: 6806459246255440aade69bc0e00a40325dfd95c
Author: Philipp Oeser
Date:   Fri May 21 16:51:37 2021 +0200
Branches: master
https://developer.blender.org/rB6806459246255440aade69bc0e00a40325dfd95c

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

===================================================================

M	release/scripts/startup/bl_ui/properties_object.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index e93b0b0d0a1..52af4fafd09 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -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):



More information about the Bf-blender-cvs mailing list