Skip to content

Commit

Permalink
Fix failure to load joints with indivisual config in SpringBone
Browse files Browse the repository at this point in the history
  • Loading branch information
TokageItLab committed Jan 18, 2025
1 parent b3a44e8 commit ad636b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scene/3d/spring_bone_simulator_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1339,12 +1339,12 @@ void SpringBoneSimulator3D::_make_collisions_dirty() {

void SpringBoneSimulator3D::_update_joint_array(int p_index) {
_make_joints_dirty(p_index);
set_joint_count(p_index, 0);

Skeleton3D *sk = get_skeleton();
int current_bone = settings[p_index]->end_bone;
int root_bone = settings[p_index]->root_bone;
if (!sk || current_bone < 0 || root_bone < 0) {
set_joint_count(p_index, 0);
return;
}

Expand All @@ -1357,7 +1357,11 @@ void SpringBoneSimulator3D::_update_joint_array(int p_index) {
}
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;
current_bone = settings[p_index]->end_bone;
Expand All @@ -1383,6 +1387,7 @@ void SpringBoneSimulator3D::_update_joints() {
continue;
}
if (settings[i]->individual_config) {
settings[i]->simulation_dirty = true;
settings[i]->joints_dirty = false;
continue; // Abort.
}
Expand Down

0 comments on commit ad636b7

Please sign in to comment.