Merge pull request #101729 from TokageItLab/indivisual-spring

Fix failure to load joints with individual config in SpringBone
This commit is contained in:
Thaddeus Crews 2025-01-20 10:05:40 -06:00
commit 76ecc10969
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84

View file

@ -1357,12 +1357,12 @@ void SpringBoneSimulator3D::_make_collisions_dirty() {
void SpringBoneSimulator3D::_update_joint_array(int p_index) { void SpringBoneSimulator3D::_update_joint_array(int p_index) {
_make_joints_dirty(p_index); _make_joints_dirty(p_index);
set_joint_count(p_index, 0);
Skeleton3D *sk = get_skeleton(); Skeleton3D *sk = get_skeleton();
int current_bone = settings[p_index]->end_bone; int current_bone = settings[p_index]->end_bone;
int root_bone = settings[p_index]->root_bone; int root_bone = settings[p_index]->root_bone;
if (!sk || current_bone < 0 || root_bone < 0) { if (!sk || current_bone < 0 || root_bone < 0) {
set_joint_count(p_index, 0);
return; return;
} }
@ -1375,7 +1375,11 @@ void SpringBoneSimulator3D::_update_joint_array(int p_index) {
} }
current_bone = sk->get_bone_parent(current_bone); current_bone = sk->get_bone_parent(current_bone);
} }
ERR_FAIL_COND_EDMSG(!valid, "End bone must be the same as or a child of root bone.");
if (!valid) {
set_joint_count(p_index, 0);
ERR_FAIL_EDMSG("End bone must be the same as or a child of root bone.");
}
Vector<int> new_joints; Vector<int> new_joints;
current_bone = settings[p_index]->end_bone; current_bone = settings[p_index]->end_bone;
@ -1401,6 +1405,7 @@ void SpringBoneSimulator3D::_update_joints() {
continue; continue;
} }
if (settings[i]->individual_config) { if (settings[i]->individual_config) {
settings[i]->simulation_dirty = true;
settings[i]->joints_dirty = false; settings[i]->joints_dirty = false;
continue; // Abort. continue; // Abort.
} }