Repository navigation
Conversation
NodeBBox_test covers how a node bbox is computed or kept: - computedBBoxFollowsObjects: without a given bbox, it is computed at init and follows the objects when they move; - bboxSetBeforeInitIsKept / bboxSetAfterInitIsKept: a bbox written after the node creation (e.g. `root.bbox = ...` from Python, or from a controller) is kept by init and by UpdateBoundingBoxVisitor; - bboxFromSceneAttributeIsKeptAndIncludedInParent: a bbox given as a scene attribute (Node::parse) is kept, and the computed bbox of the parent includes it along with its computed siblings. bboxSetBeforeInitIsKept and bboxSetAfterInitIsKept fail at this commit: a bbox written after the node creation is overwritten. Fixed by the next commit.
A node bbox was only considered fixed when given as a scene attribute (Node::parse sets m_bboxIsFixed). Writing the bbox Data afterwards, e.g. `root.bbox = ...` in a Python createScene or from a controller, was silently overwritten by InitVisitor/UpdateBoundingBoxVisitor, which recompute every non-fixed bbox from the objects and children. - Node::bboxIsFixed() is now also true when the bbox Data is set. - InitVisitor and UpdateBoundingBoxVisitor no longer touch a fixed bbox, and unset() the Data after writing a computed one, so that only an external write marks it as set (every Data write marks it set). Computed bboxes keep following the objects; scene attributes and addChild(name, bbox=...) behave as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixing the BBox in Node, episode 324325
With SofaPython3 bindings, setting the bbox for root in
createScene()was not working 💀A node bbox was only considered fixed when given as a scene attribute (Node::parse sets m_bboxIsFixed).
Writing the bbox Data afterwards, e.g.
root.bbox = ...in a Python createScene or from a controller, was silently overwritten by InitVisitor/UpdateBoundingBoxVisitor, which recompute every non-fixed bbox from the objects and children.[with-all-tests]
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if