The bounding box is not updated and keeps wrong while the object is not edited or the file saved.
Details
Diff Detail
- Repository
- rB Blender
- Branch
- temp-fix-T79651 (branched from master)
- Build Status
Buildable 9508 Build 9508: arc lint + arc unit
Event Timeline
| source/blender/editors/object/object_add.c | ||
|---|---|---|
| 2955 | Please explain a bit more in details why this is needed with GPencil? What is different here than with other geometry types? I would not expect bbox of an object to become invalid when duplicating the object... | |
@Antonio Vazquez (antoniov) My 2 cents: if the BBox is invalid when duplicating, this maybe means the duplication procedure is not done properly.
I have found why is getting the problem. As GPencil calculates the bounding box by frame, not as a mesh does for the full object, the data is updated in the evaluated version of the object, so when you change the strokes, the bounding box was evaluated in the eval version of the object.
When you duplicated the object, the original data of the bounding box was what you had and it was only updated when edit and reload the data. I have tested, and the solution is simple, when the bounding box is calculated, just be sure the original data of the bounding box is updated. With this solution, you don't need tag anything or add any type of if in object_add.c
If you agree, I think I can commit this fix because is only GPencil code and don't change anything outside this module.
LGTM, besides nitpicky notes below.
| source/blender/blenkernel/intern/gpencil_geom.c | ||
|---|---|---|
| 182–184 | Move this below together with rest of the new code, no reason to call this function when not needed. | |
| 194 | Be a bit more explicit in your comments, everyone can see that this is a copy, but why is this copy needed? something like `Update orig object's boundbox with re-computed evaluated values.` or something like that. | |