summaryrefslogtreecommitdiffstats
path: root/scene/3d/skeleton_modifier_3d.cpp
diff options
context:
space:
mode:
authorSilc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com>2024-10-26 06:31:51 +0900
committerSilc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com>2024-11-12 04:41:08 +0900
commit5d1a2a421685dbdcf0e77cb05a01eae79302d98f (patch)
tree2281fa00a8f60eabc5acc001a3771092af67da5e /scene/3d/skeleton_modifier_3d.cpp
parente65a23762b36b564eb94672031f37fdadba72333 (diff)
downloadredot-engine-5d1a2a421685dbdcf0e77cb05a01eae79302d98f.tar.gz
Fix Skeleton doesn't update skin after deactivating modifiers
Diffstat (limited to 'scene/3d/skeleton_modifier_3d.cpp')
-rw-r--r--scene/3d/skeleton_modifier_3d.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/scene/3d/skeleton_modifier_3d.cpp b/scene/3d/skeleton_modifier_3d.cpp
index d5c603112e..e8a8e517a2 100644
--- a/scene/3d/skeleton_modifier_3d.cpp
+++ b/scene/3d/skeleton_modifier_3d.cpp
@@ -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;
}
}