Merge pull request #96713 from Nazarwadim/thread_local_bones_backup

Use `thread_local` for `bones_backup`
This commit is contained in:
Rémi Verschelde 2025-01-07 10:14:15 +01:00
commit 7c49ae253e
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 4 additions and 4 deletions

View File

@ -270,8 +270,6 @@ void Skeleton3D::_update_process_order() const {
}
}
bones_backup.resize(bones.size());
concatenated_bone_names = StringName();
_update_bones_nested_set();
@ -339,11 +337,14 @@ void Skeleton3D::_notification(int p_what) {
thread_local LocalVector<bool> bone_global_pose_dirty_backup;
// Process modifiers.
thread_local LocalVector<BonePoseBackup> bones_backup;
_find_modifiers();
if (!modifiers.is_empty()) {
bones_backup.resize(bones.size());
// Store unmodified bone poses.
for (uint32_t i = 0; i < bones.size(); i++) {
bones_backup[i].save(bones[i]);
bones_backup[i].save(bonesptr[i]);
}
// Store dirty flags for global bone poses.
bone_global_pose_dirty_backup = bone_global_pose_dirty;

View File

@ -183,7 +183,6 @@ private:
void _process_modifiers();
void _process_changed();
void _make_modifiers_dirty();
mutable LocalVector<BonePoseBackup> bones_backup;
// Global bone pose calculation.
mutable LocalVector<int> nested_set_offset_to_bone_index; // Map from Bone::nested_set_offset to bone index.