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

Fix NOTIFICATION_POSTINITIALIZE sent twice to native parent classes #1447

Merged
merged 1 commit into from
May 17, 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
6 changes: 6 additions & 0 deletions include/godot_cpp/classes/wrapped.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class Wrapped {
::godot::List<::godot::PropertyInfo> plist_owned;

void _postinitialize();
virtual void _notificationv(int32_t p_what, bool p_reversed = false) {}

Wrapped(const StringName p_godot_class);
Wrapped(GodotObject *p_godot_object);
Expand Down Expand Up @@ -374,6 +375,11 @@ public:
_gde_binding_reference_callback, \
}; \
\
protected: \
virtual void _notificationv(int32_t p_what, bool p_reversed = false) override { \
m_class::notification_bind(this, p_what, p_reversed); \
} \
\
private:

// Don't use this for your classes, use GDCLASS() instead.
Expand Down
5 changes: 1 addition & 4 deletions src/classes/wrapped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ void Wrapped::_postinitialize() {
}
godot::internal::gdextension_interface_object_set_instance_binding(_owner, godot::internal::token, this, _get_bindings_callbacks());
if (extension_class) {
Object *obj = dynamic_cast<Object *>(this);
if (obj) {
obj->notification(Object::NOTIFICATION_POSTINITIALIZE);
}
_notificationv(Object::NOTIFICATION_POSTINITIALIZE);
}
}

Expand Down
Loading