Fix Skeleton doesn't update skin after deactivating modifiers

This commit is contained in:
Silc Lizard (Tokage) Renew
2024-10-26 06:31:51 +09:00
parent e65a23762b
commit 5d1a2a4216
4 changed files with 22 additions and 0 deletions

View File

@@ -75,6 +75,17 @@ void SkeletonModifier3D::_skeleton_changed(Skeleton3D *p_old, Skeleton3D *p_new)
//
}
void SkeletonModifier3D::_force_update_skeleton_skin() {
if (!is_inside_tree()) {
return;
}
Skeleton3D *skeleton = get_skeleton();
if (!skeleton) {
return;
}
skeleton->force_update_deferred();
}
/* Process */
void SkeletonModifier3D::set_active(bool p_active) {
@@ -83,6 +94,7 @@ void SkeletonModifier3D::set_active(bool p_active) {
}
active = p_active;
_set_active(active);
_force_update_skeleton_skin();
}
bool SkeletonModifier3D::is_active() const {
@@ -119,6 +131,10 @@ void SkeletonModifier3D::_notification(int p_what) {
case NOTIFICATION_PARENTED: {
_update_skeleton();
} break;
case NOTIFICATION_EXIT_TREE:
case NOTIFICATION_UNPARENTED: {
_force_update_skeleton_skin();
} break;
}
}