mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Fix Skeleton doesn't update skin after deactivating modifiers
This commit is contained in:
parent
e65a23762b
commit
5d1a2a4216
@ -1032,6 +1032,10 @@ Ref<SkinReference> Skeleton3D::register_skin(const Ref<Skin> &p_skin) {
|
||||
return skin_ref;
|
||||
}
|
||||
|
||||
void Skeleton3D::force_update_deferred() {
|
||||
_make_dirty();
|
||||
}
|
||||
|
||||
void Skeleton3D::force_update_all_dirty_bones() {
|
||||
if (!dirty) {
|
||||
return;
|
||||
|
@ -284,6 +284,7 @@ public:
|
||||
void force_update_all_dirty_bones();
|
||||
void force_update_all_bone_transforms();
|
||||
void force_update_bone_children_transforms(int bone_idx);
|
||||
void force_update_deferred();
|
||||
|
||||
void set_modifier_callback_mode_process(ModifierCallbackModeProcess p_mode);
|
||||
ModifierCallbackModeProcess get_modifier_callback_mode_process() const;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ protected:
|
||||
|
||||
void _update_skeleton();
|
||||
void _update_skeleton_path();
|
||||
void _force_update_skeleton_skin();
|
||||
|
||||
virtual void _skeleton_changed(Skeleton3D *p_old, Skeleton3D *p_new);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user