Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify allocation process of the PhysicalBoneSimulator in Skeleton3D #91122

Merged
merged 1 commit into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions scene/3d/skeleton_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,15 @@ void Skeleton3D::_update_process_order() {

#ifndef DISABLE_DEPRECATED
void Skeleton3D::setup_simulator() {
if (simulator && simulator->get_parent() == this) {
remove_child(simulator);
simulator->queue_free();
}
PhysicalBoneSimulator3D *sim = memnew(PhysicalBoneSimulator3D);
simulator = sim;
sim->is_compat = true;
sim->set_active(false); // Don't run unneeded process.
add_child(sim);
}

void Skeleton3D::remove_simulator() {
remove_child(simulator);
memdelete(simulator);
add_child(simulator);
}
#endif // _DISABLE_DEPRECATED

Expand All @@ -294,11 +293,6 @@ void Skeleton3D::_notification(int p_what) {
setup_simulator();
#endif // _DISABLE_DEPRECATED
} break;
#ifndef DISABLE_DEPRECATED
case NOTIFICATION_EXIT_TREE: {
remove_simulator();
} break;
#endif // _DISABLE_DEPRECATED
case NOTIFICATION_UPDATE_SKELETON: {
// Update bone transforms to apply unprocessed poses.
force_update_all_dirty_bones();
Expand Down
1 change: 0 additions & 1 deletion scene/3d/skeleton_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class Skeleton3D : public Node3D {
#ifndef DISABLE_DEPRECATED
Node *simulator = nullptr;
void setup_simulator();
void remove_simulator();
#endif // _DISABLE_DEPRECATED

public:
Expand Down
Loading