Lattice's bounding_box doesn't update #45735

Closed
opened 2015-08-08 16:59:03 +02:00 by Ray Mairlot · 13 comments

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 Lattice bounding box bug.blend to see the edited lattice but with the bounding box still a cube.

  2. Run the script in the open text editor to print the '0.0' bounding box corner coordinates of the selected object to the console.

**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 [Lattice bounding box bug.blend](https://archive.blender.org/developer/F221795/Lattice_bounding_box_bug.blend) to see the edited lattice but with the bounding box still a cube. 2. Run the script in the open text editor to print the '0.0' bounding box corner coordinates of the selected object to the console.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @RayMairlot

Added subscriber: @RayMairlot

Added subscriber: @sindra1961

Added subscriber: @sindra1961

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

I think that it is not a bug. I think that you should check Lattice object. [class bpy.types.Lattice ](http://www.blender.org/api/blender_python_api_2_75_3/bpy.types.Lattice.html#bpy.types.Lattice)
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

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 = bpy.context.object.data.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))
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 = bpy.context.object.data.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)) ```
Author

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

@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.

@sindra1961 I'm not sure what I should be looking at on that page. @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.
Member

@RayMairlot: the page @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...

@RayMairlot: the page @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...
Author

@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).

@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).

Added subscriber: @mont29

Added subscriber: @mont29

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2015-08-12 16:12:36 +02:00

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.

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.
Member

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)

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)](https://archive.blender.org/developer/D1460)
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#45735
No description provided.