Skip to content

Commit

Permalink
Refactor skeleton change handling and notification logic
Browse files Browse the repository at this point in the history
  • Loading branch information
fire committed Apr 5, 2024
1 parent a73ccad commit 6cb79c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/many_bone_ik_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@ void ManyBoneIK3D::_process_modification() {
set_dirty();
}
if (is_dirty) {
_reload();
is_dirty = false;
}
if (bone_list.size()) {
Expand Down Expand Up @@ -720,7 +719,7 @@ void ManyBoneIK3D::_process_modification() {
_update_skeleton_bones_transform();
}

void ManyBoneIK3D::_skeleton_changed(Skeleton3D *p_skeleton) {
void ManyBoneIK3D::_skeleton_changed(Skeleton3D *p_skeleton, Skeleton3D *p_new) {
if (!p_skeleton) {
return;
}
Expand Down Expand Up @@ -838,7 +837,6 @@ void ManyBoneIK3D::_notification(int p_what) {
case NOTIFICATION_READY: {
set_process_priority(1);
set_notify_transform(true);
_reload();
} break;
case NOTIFICATION_ENTER_TREE: {
set_process_internal(true);
Expand Down
2 changes: 1 addition & 1 deletion src/many_bone_ik_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class ManyBoneIK3D : public SkeletonModifier3D {
String _get_pin_root_bone(int32_t p_pin_index) const;
bool _is_descendant_of(int bone_i, int parent_bone_i) const;
bool _is_ancestor_of(int potential_ancestor, int bone_idx) const;
void _skeleton_changed(Skeleton3D *p_old, Skeleton3D *p_new) override;

protected:
bool _set(const StringName &p_name, const Variant &p_value);
Expand All @@ -89,7 +90,6 @@ class ManyBoneIK3D : public SkeletonModifier3D {
static void _bind_methods();
virtual void _process_modification() override;
void _notification(int p_what);
virtual void _reload();

public:
void set_pin_bone_name(int32_t p_effector_index, StringName p_name) const;
Expand Down

0 comments on commit 6cb79c0

Please sign in to comment.