diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-05-23 07:58:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-23 07:58:27 +0200 |
commit | c088386c5b5e7631ce670cb4fa0e6563d29d0973 (patch) | |
tree | 1ae4f1cb3c9d1aae5aa406811472a5d6a902fc07 /scene | |
parent | 1acc918166e653eb4121868e8000991e9485ac83 (diff) | |
parent | 88153fbb6109f897ec3eac2180cdb757502aebb4 (diff) |
Merge pull request #29109 from RandomShaper/fix_onion_skinning
Fix onion skinning
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/skeleton_2d.h | 6 | ||||
-rw-r--r-- | scene/animation/animation_player.cpp | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h index cf9877e6f8..d24c0a1561 100644 --- a/scene/2d/skeleton_2d.h +++ b/scene/2d/skeleton_2d.h @@ -39,6 +39,9 @@ class Bone2D : public Node2D { GDCLASS(Bone2D, Node2D) friend class Skeleton2D; +#ifdef TOOLS_ENABLED + friend class AnimatedValuesBackup; +#endif Bone2D *parent_bone; Skeleton2D *skeleton; @@ -71,6 +74,9 @@ class Skeleton2D : public Node2D { GDCLASS(Skeleton2D, Node2D); friend class Bone2D; +#ifdef TOOLS_ENABLED + friend class AnimatedValuesBackup; +#endif struct Bone { bool operator<(const Bone &p_bone) const { diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index a5955d57f7..75088c79fe 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -37,12 +37,20 @@ #ifdef TOOLS_ENABLED #include "editor/editor_settings.h" +#include "scene/2d/skeleton_2d.h" void AnimatedValuesBackup::update_skeletons() { for (int i = 0; i < entries.size(); i++) { if (entries[i].bone_idx != -1) { + // 3D bone Object::cast_to<Skeleton>(entries[i].object)->notification(Skeleton::NOTIFICATION_UPDATE_SKELETON); + } else { + Bone2D *bone = Object::cast_to<Bone2D>(entries[i].object); + if (bone && bone->skeleton) { + // 2D bone + bone->skeleton->_update_transform(); + } } } } |