summaryrefslogtreecommitdiffstats
path: root/scene/3d/bone_attachment_3d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/bone_attachment_3d.cpp')
-rw-r--r--scene/3d/bone_attachment_3d.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/scene/3d/bone_attachment_3d.cpp b/scene/3d/bone_attachment_3d.cpp
index 76e89f24d8..221200284d 100644
--- a/scene/3d/bone_attachment_3d.cpp
+++ b/scene/3d/bone_attachment_3d.cpp
@@ -187,7 +187,7 @@ void BoneAttachment3D::_transform_changed() {
return;
}
- if (override_pose) {
+ if (override_pose && !overriding) {
Skeleton3D *sk = _get_skeleton3d();
ERR_FAIL_NULL_MSG(sk, "Cannot override pose: Skeleton not found!");
@@ -198,8 +198,11 @@ void BoneAttachment3D::_transform_changed() {
our_trans = sk->get_global_transform().affine_inverse() * get_global_transform();
}
- sk->set_bone_global_pose_override(bone_idx, our_trans, 1.0, true);
+ overriding = true;
+ sk->set_bone_global_pose(bone_idx, our_trans);
+ sk->force_update_all_dirty_bones();
}
+ overriding = false;
}
void BoneAttachment3D::set_bone_name(const String &p_name) {
@@ -246,14 +249,6 @@ void BoneAttachment3D::set_override_pose(bool p_override) {
override_pose = p_override;
set_notify_transform(override_pose);
set_process_internal(override_pose);
-
- if (!override_pose) {
- Skeleton3D *sk = _get_skeleton3d();
- if (sk) {
- sk->set_bone_global_pose_override(bone_idx, Transform3D(), 0.0, false);
- }
- _transform_changed();
- }
notify_property_list_changed();
}
@@ -314,6 +309,10 @@ void BoneAttachment3D::_notification(int p_what) {
}
void BoneAttachment3D::on_bone_pose_update(int p_bone_index) {
+ if (updating) {
+ return;
+ }
+ updating = true;
if (bone_idx == p_bone_index) {
Skeleton3D *sk = _get_skeleton3d();
if (sk) {
@@ -331,6 +330,7 @@ void BoneAttachment3D::on_bone_pose_update(int p_bone_index) {
}
}
}
+ updating = false;
}
#ifdef TOOLS_ENABLED
void BoneAttachment3D::notify_skeleton_bones_renamed(Node *p_base_scene, Skeleton3D *p_skeleton, Dictionary p_rename_map) {