Fix 2D bones ignored by onion skinning
Fixes #27819.
(cherry picked from commit 88153fbb61)
This commit is contained in:
committed by
Rémi Verschelde
parent
340f542e49
commit
aacefcb7dc
@ -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 {
|
||||
|
||||
@ -35,11 +35,20 @@
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/audio/audio_stream.h"
|
||||
#ifdef TOOLS_ENABLED
|
||||
#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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user