1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

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

@@ -630,7 +630,11 @@ VARIANT_ENUM_CAST(ScriptLanguageExtension::CodeCompletionLocation)
class ScriptInstanceExtension : public ScriptInstance {
public:
const GDExtensionScriptInstanceInfo *native_info;
const GDExtensionScriptInstanceInfo2 *native_info;
struct {
GDExtensionClassNotification notification_func;
} deprecated_native_info;
GDExtensionScriptInstanceDataPtr instance = nullptr;
// There should not be warnings on explicit casts.
@@ -746,11 +750,16 @@ public:
return ret;
}
virtual void notification(int p_notification) override {
virtual void notification(int p_notification, bool p_reversed = false) override {
if (native_info->notification_func) {
native_info->notification_func(instance, p_notification);
native_info->notification_func(instance, p_notification, p_reversed);
#ifndef DISABLE_DEPRECATED
} else if (deprecated_native_info.notification_func) {
deprecated_native_info.notification_func(instance, p_notification);
#endif // DISABLE_DEPRECATED
}
}
virtual String to_string(bool *r_valid) override {
if (native_info->to_string_func) {
GDExtensionBool valid;