Page MenuHome

Lattice's bounding_box doesn't update
Closed, InvalidPublic


System Information
Windows 7 64-bit, Nvidia GTX 570

Blender Version
Broken: official 2.74a and fef31aa (latest win 64-bit build)
Worked: -

Short description of error

The lattice object's bounding_box doesn't update when the lattice object is edited in edit mode, it stays a cube shape.

I don't know whether this is a separate issue, or just my own misunderstanding, but it also always reports that the bounding box corner values are all at '0.0' when using the script in the attached blend file to print them out. This also happens with cameras and empties, I haven't tested other objects.

Exact steps for others to reproduce the error

  1. Open the blend to see the edited lattice but with the bounding box still a cube.
  1. Run the script in the open text editor to print the '0.0' bounding box corner coordinates of the selected object to the console.

Event Timeline

Ray Mairlot (madog) raised the priority of this task from to 90.
Ray Mairlot (madog) updated the task description. (Show Details)
Ray Mairlot (madog) edited a custom field.

I think that it is not a bug.
I think that you should check Lattice object.
class bpy.types.Lattice

Getting Lattices' BoundingBoxes is smiply not implemented afaik (see BKE_object_boundbox_get())
[implementing this could be a simple TODO/QuickHack, maybe? -- there is already stuff like BKE_lattice_minmax...]

as a workaround you could get it in python

import bpy
from operator import attrgetter

points =

xmin = min(points, key=attrgetter('co_deform.x')).co_deform.x
xmax = max(points, key=attrgetter('co_deform.x')).co_deform.x
ymin = min(points, key=attrgetter('co_deform.y')).co_deform.y
ymax = max(points, key=attrgetter('co_deform.y')).co_deform.y
zmin = min(points, key=attrgetter('co_deform.z')).co_deform.z
zmax = max(points, key=attrgetter('co_deform.z')).co_deform.z

print("xmin:%f xmax:%f ymin:%f ymax:%f zmin:%f zmax:%f " % (xmin, xmax, ymin, ymax, zmin, zmax))

@perfection cat (sindra1961) I'm not sure what I should be looking at on that page.

@Philipp Oeser (lichtwerk) Just seems a little odd that the bound_box display option can be enabled on the object properties for a lattice if it doesn't update and it's values can't be accessed.

@Ray Mairlot (madog): the page @perfection cat (sindra1961) was linking to gives you info on how to access the points on the lattice (thus enabling you to calculate your own bbox in python/bpy -- like in my python example)
I know its a little odd to have the display option... can have a look at implementing bbox access for lattices later...

@Philipp Oeser (lichtwerk) Yes, I understand I can access the points and calculate the bounding box manually, the main point of this report was to say that if the bounding box option is available I expect it to update and if 'bound_box' is available in the api, I expect that to return correct values (which I also expect for the other object types I mentioned).

Bastien Montagne (mont29) changed the task status from Unknown Status to Unknown Status.Aug 12 2015, 4:12 PM
Bastien Montagne (mont29) claimed this task.

Thanks for the report, but no bug here really, all object types do not support bbox, in which case a 'null' one is returned (and a default unit cube is drawn if requested). Same goes for intrinsically dimension-less types (camera, empty, speaker, etc.), only real geometry-types do have a meaningful bbox.

we were drawing armature boundingboxes as well, so I still think there might be some use to this for lattices as well... here is D1460: lattice boundingboxes (and armature boundingbox cleanup)