Page MenuHome

Fix T79651: Bounding box is wrong after duplicate object
ClosedPublic

Authored by Antonio Vazquez (antoniov) on Aug 13 2020, 7:21 PM.

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

Antonio Vazquez (antoniov) requested review of this revision.Aug 13 2020, 7:21 PM
Antonio Vazquez (antoniov) created this revision.
Antonio Vazquez (antoniov) retitled this revision from Fix T78065: OSL shader compilation fails on macOS to Fix T79651: Bounding box is wrong after duplicate object.
Antonio Vazquez (antoniov) edited the summary of this revision. (Show Details)

Updated due error in ARC patch creation

Bastien Montagne (mont29) requested changes to this revision.Aug 27 2020, 5:29 PM
Bastien Montagne (mont29) added inline comments.
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...

This revision now requires changes to proceed.Aug 27 2020, 5:29 PM

@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

Simplify the process and update the original bounding box data.

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.

This revision is now accepted and ready to land.Sep 13 2020, 11:51 AM