Backported from godot 4: Make SkeletonIk3D node usable

- warriormaster12

ddf93f3f59
This commit is contained in:
Relintai 2024-09-30 18:55:39 +02:00
parent 506a0756c5
commit a59cb3956b
2 changed files with 3 additions and 9 deletions

View File

@ -52,24 +52,18 @@ void SkeletonIKEditorPlugin::_play() {
skeleton_ik->start(); skeleton_ik->start();
} else { } else {
skeleton_ik->stop(); skeleton_ik->stop();
skeleton_ik->get_parent_skeleton()->clear_bones_global_pose_override();
} }
} }
void SkeletonIKEditorPlugin::edit(Object *p_object) { void SkeletonIKEditorPlugin::edit(Object *p_object) {
if (p_object != skeleton_ik) {
if (skeleton_ik) {
play_btn->set_pressed(false);
_play();
}
}
SkeletonIK *s = Object::cast_to<SkeletonIK>(p_object); SkeletonIK *s = Object::cast_to<SkeletonIK>(p_object);
if (!s) { if (!s) {
return; return;
} }
skeleton_ik = s; skeleton_ik = s;
play_btn->set_pressed(skeleton_ik->is_running());
} }
bool SkeletonIKEditorPlugin::handles(Object *p_object) const { bool SkeletonIKEditorPlugin::handles(Object *p_object) const {

View File

@ -425,7 +425,7 @@ void SkeletonIK::_notification(int p_what) {
} break; } break;
case NOTIFICATION_EXIT_TREE: { case NOTIFICATION_EXIT_TREE: {
reload_chain(); stop();
} break; } break;
} }
} }