Fix Object::notification order

Previously the `p_reversed` parameter didn't influence the order
in a correct way.
Also script overridden _notification functions were not called in
the correct order.

To fix this some `notification` functions had to add a `p_reversed`
parameter.

This made it necessary to adjust cpp-bindings.

Co-authored-by: David Snopek <dsnopek@gmail.com>
This commit is contained in:
Markus Sauermann 2023-06-24 03:07:22 +02:00
parent 247c3548d8
commit c4705a590b
14 changed files with 314 additions and 28 deletions

View file

@ -799,14 +799,30 @@ Variant Object::call_const(const StringName &p_method, const Variant **p_args, i
}
void Object::notification(int p_notification, bool p_reversed) {
_notificationv(p_notification, p_reversed);
if (script_instance) {
script_instance->notification(p_notification);
if (p_reversed) {
if (script_instance) {
script_instance->notification(p_notification, p_reversed);
}
} else {
_notificationv(p_notification, p_reversed);
}
if (_extension && _extension->notification) {
_extension->notification(_extension_instance, p_notification);
if (_extension) {
if (_extension->notification2) {
_extension->notification2(_extension_instance, p_notification, p_reversed);
#ifndef DISABLE_DEPRECATED
} else if (_extension->notification) {
_extension->notification(_extension_instance, p_notification);
#endif // DISABLE_DEPRECATED
}
}
if (p_reversed) {
_notificationv(p_notification, p_reversed);
} else {
if (script_instance) {
script_instance->notification(p_notification, p_reversed);
}
}
}