From 4eba6d1892b81a8f2a7e4627b9feab1b926db2a4 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sat, 15 Mar 2025 16:12:47 -0700 Subject: [PATCH] Update BoneAttachment3D transform when setting the bone index --- scene/3d/bone_attachment_3d.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scene/3d/bone_attachment_3d.cpp b/scene/3d/bone_attachment_3d.cpp index 59647457d8..2b66d36d21 100644 --- a/scene/3d/bone_attachment_3d.cpp +++ b/scene/3d/bone_attachment_3d.cpp @@ -143,7 +143,7 @@ void BoneAttachment3D::_check_bind() { if (bone_idx != -1) { sk->connect(SceneStringName(skeleton_updated), callable_mp(this, &BoneAttachment3D::on_skeleton_update)); bound = true; - callable_mp(this, &BoneAttachment3D::on_skeleton_update); + on_skeleton_update(); } } } @@ -220,7 +220,7 @@ void BoneAttachment3D::set_bone_idx(const int &p_idx) { Skeleton3D *sk = get_skeleton(); if (sk) { if (bone_idx <= -1 || bone_idx >= sk->get_bone_count()) { - WARN_PRINT("Bone index out of range! Cannot connect BoneAttachment to node!"); + WARN_PRINT("Bone index " + itos(bone_idx) + " out of range! Cannot connect BoneAttachment to node!"); bone_idx = -1; } else { bone_name = sk->get_bone_name(bone_idx); @@ -229,6 +229,8 @@ void BoneAttachment3D::set_bone_idx(const int &p_idx) { if (is_inside_tree()) { _check_bind(); + } else { + on_skeleton_update(); } notify_property_list_changed(); @@ -336,6 +338,7 @@ void BoneAttachment3D::on_skeleton_update() { } updating = false; } + #ifdef TOOLS_ENABLED void BoneAttachment3D::notify_skeleton_bones_renamed(Node *p_base_scene, Skeleton3D *p_skeleton, Dictionary p_rename_map) { const Skeleton3D *parent = nullptr;