[Bugfix] Copy mesh before scaling if it was passed in as a parameter#80
Merged
AndrejOrsula merged 1 commit intoAndrejOrsula:masterfrom Nov 28, 2024
Merged
Conversation
AndrejOrsula
approved these changes
Nov 28, 2024
Owner
AndrejOrsula
left a comment
There was a problem hiding this comment.
Thanks for the catch! This is great.
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.
Description
#67 allowed users to pass in a preloaded mesh as a parameter, to avoid needing to keep reloading a mesh. That PR correctly realized that if the mesh is passed in as a parameter, we should copy it before scaling, to avoid destructively modifying the mesh that the user passed in. However, that PR had a bug in its implementation of that feature, resulting in it copying the mesh before scaling if the mesh was not passed in as a parameter. This PR addresses that.
Testing
I tested this PR on my local robot setup, where we pre-load a mesh and then add it multiple times with different scale values. Before the change, the mesh would keep scaling down until near-zero (because the pre-loaded mesh is what gets scaled). After the change, it properly applies the scale (because the pre-loaded mesh remains unmodified).
Let me know if you'd like me to create a test case within this repo / the simulated panda example for this PR. I figured since it is a one-word change, the above should be fine :)