1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Fix console errors and crash in cleanup code for PhysicalBoneSimulator3D

This commit is contained in:
Mike Estee
2025-03-02 13:40:27 -08:00
committed by Rémi Verschelde
parent 827f9d95f2
commit d39003c0bf
3 changed files with 23 additions and 5 deletions

View File

@@ -838,6 +838,13 @@ bool Skeleton3D::is_show_rest_only() const {
void Skeleton3D::clear_bones() {
bones.clear();
name_to_bone_index.clear();
// All these structures contain references to now invalid bone indices.
skin_bindings.clear();
bone_global_pose_dirty.clear();
parentless_bones.clear();
nested_set_offset_to_bone_index.clear();
process_order_dirty = true;
version++;
_make_dirty();
@@ -1091,6 +1098,8 @@ void Skeleton3D::_force_update_bone_children_transforms(int p_bone_idx) const {
const int bone_size = bones.size();
ERR_FAIL_INDEX(p_bone_idx, bone_size);
_update_process_order();
Bone *bonesptr = bones.ptr();
// Loop through nested set.