Fix rest update process by dirty flag to not take into account pose dirty flag in Skeleton3D#105920
Merged
Merged
Conversation
Skeleton3D
TokageItLab
commented
Apr 29, 2025
Comment on lines
+1119
to
+1124
| if (rest_dirty) { | ||
| int current_bone_idx = nested_set_offset_to_bone_index[offset]; | ||
| Bone &b = bonesptr[current_bone_idx]; | ||
| b.global_rest = b.parent >= 0 ? bonesptr[b.parent].global_rest * b.rest : b.rest; // Rest needs update apert from pose. | ||
| } | ||
|
|
Member
Author
There was a problem hiding this comment.
Suggested change
| if (rest_dirty) { | |
| int current_bone_idx = nested_set_offset_to_bone_index[offset]; | |
| Bone &b = bonesptr[current_bone_idx]; | |
| b.global_rest = b.parent >= 0 ? bonesptr[b.parent].global_rest * b.rest : b.rest; // Rest needs update apert from pose. | |
| } | |
| int current_bone_idx = nested_set_offset_to_bone_index[offset]; | |
| Bone &b = bonesptr[current_bone_idx]; | |
| bool bone_enabled = b.enabled && !show_rest_only; | |
| if (rest_dirty) { | |
| b.global_rest = b.parent >= 0 ? bonesptr[b.parent].global_rest * b.rest : b.rest; // Rest needs update apert from pose. | |
| } | |
current_bone_idx and &b are defined again immediately below.
I think we wanted to skip access to the arrays for improved performance if there is no pose change, so I put them inside the if block to account for the frequency of rest dirty (since it should be few), but the code would look cleaner if we put them outside. Which would be better?
Member
There was a problem hiding this comment.
so I put them inside the if block to account for the frequency of rest dirty (since it should be few)
I wonder if we can see the performance on a graph.
lyuma
approved these changes
May 16, 2025
Contributor
|
Thanks! |
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.
There is a problem where the flags have the wrong priority and when rest is changed, rest is not updated if there is no change in the pose, fixed.