Skip to content

Commit 996c9a6

Browse files
committed
Merge pull request #113176 from xuhuisheng/dev/ske-mod-error
Fix empty 2D skeleton modification keeps printing error messages
2 parents 725cf51 + 37a6043 commit 996c9a6

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

scene/resources/2d/skeleton/skeleton_modification_2d_ccdik.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ void SkeletonModification2DCCDIK::_draw_editor_gizmo() {
253253
if (!ccdik_data_chain[i].editor_draw_gizmo) {
254254
continue;
255255
}
256+
if (ccdik_data_chain[i].bone_idx < 0) {
257+
continue;
258+
}
256259

257260
Bone2D *operation_bone = stack->skeleton->get_bone(ccdik_data_chain[i].bone_idx);
258261
editor_draw_angle_constraints(operation_bone, ccdik_data_chain[i].constraint_angle_min, ccdik_data_chain[i].constraint_angle_max,

scene/resources/2d/skeleton/skeleton_modification_2d_lookat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void SkeletonModification2DLookAt::_setup_modification(SkeletonModificationStack
180180
}
181181

182182
void SkeletonModification2DLookAt::_draw_editor_gizmo() {
183-
if (!enabled || !is_setup) {
183+
if (!enabled || !is_setup || bone_idx < 0) {
184184
return;
185185
}
186186

scene/resources/2d/skeleton/skeleton_modification_2d_twoboneik.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void SkeletonModification2DTwoBoneIK::_setup_modification(SkeletonModificationSt
217217
}
218218

219219
void SkeletonModification2DTwoBoneIK::_draw_editor_gizmo() {
220-
if (!enabled || !is_setup) {
220+
if (!enabled || !is_setup || joint_one_bone_idx < 0) {
221221
return;
222222
}
223223

0 commit comments

Comments
 (0)