diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-30 21:18:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-30 21:18:19 +0200 |
commit | c24c67858a2317647470396e877f909097d0ad05 (patch) | |
tree | 6f5ce08ef92787350fb53f9a1743af13b1d50e6c /scene | |
parent | de5f13e9356c1c075ced91893a67164f062b36bc (diff) | |
parent | 28b11e216a4025081d9a7deffc82374408d572ab (diff) |
Merge pull request #65087 from TokageItLab/change-skeleton-3d-api
Clean-up/change some Skeleton3D API
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/skeleton_3d.cpp | 17 | ||||
-rw-r--r-- | scene/3d/skeleton_3d.h | 7 |
2 files changed, 13 insertions, 11 deletions
diff --git a/scene/3d/skeleton_3d.cpp b/scene/3d/skeleton_3d.cpp index 1bc138704e..e04e1866db 100644 --- a/scene/3d/skeleton_3d.cpp +++ b/scene/3d/skeleton_3d.cpp @@ -315,9 +315,7 @@ void Skeleton3D::_notification(int p_what) { rs->skeleton_bone_set_transform(skeleton, i, bonesptr[bone_index].pose_global * skin->get_bind_pose(i)); } } -#ifdef TOOLS_ENABLED emit_signal(SceneStringNames::get_singleton()->pose_updated); -#endif // TOOLS_ENABLED } break; #ifndef _3D_DISABLED @@ -603,18 +601,25 @@ void Skeleton3D::unparent_bone_and_rest(int p_bone) { int Skeleton3D::get_bone_parent(int p_bone) const { const int bone_size = bones.size(); ERR_FAIL_INDEX_V(p_bone, bone_size, -1); - + if (process_order_dirty) { + const_cast<Skeleton3D *>(this)->_update_process_order(); + } return bones[p_bone].parent; } -Vector<int> Skeleton3D::get_bone_children(int p_bone) { +Vector<int> Skeleton3D::get_bone_children(int p_bone) const { const int bone_size = bones.size(); ERR_FAIL_INDEX_V(p_bone, bone_size, Vector<int>()); + if (process_order_dirty) { + const_cast<Skeleton3D *>(this)->_update_process_order(); + } return bones[p_bone].child_bones; } -Vector<int> Skeleton3D::get_parentless_bones() { - _update_process_order(); +Vector<int> Skeleton3D::get_parentless_bones() const { + if (process_order_dirty) { + const_cast<Skeleton3D *>(this)->_update_process_order(); + } return parentless_bones; } diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h index 79feadf44f..5e49dfa1f4 100644 --- a/scene/3d/skeleton_3d.h +++ b/scene/3d/skeleton_3d.h @@ -191,11 +191,8 @@ public: void unparent_bone_and_rest(int p_bone); - Vector<int> get_bone_children(int p_bone); - void set_bone_children(int p_bone, Vector<int> p_children); - void add_bone_child(int p_bone, int p_child); - void remove_bone_child(int p_bone, int p_child); - Vector<int> get_parentless_bones(); + Vector<int> get_bone_children(int p_bone) const; + Vector<int> get_parentless_bones() const; int get_bone_count() const; |