summaryrefslogtreecommitdiffstats
path: root/core/object/script_language_extension.h
diff options
context:
space:
mode:
authorMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2023-06-24 03:07:22 +0200
committerMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2023-08-30 00:15:55 +0200
commitc4705a590b5eb01d63afb907d6dad5c49d8f6fe1 (patch)
tree90dcb549205ed9c0d83ec77c3ab7b0cd473bb762 /core/object/script_language_extension.h
parent247c3548d810136ffe9c1694cd76db3236efaa90 (diff)
downloadredot-engine-c4705a590b5eb01d63afb907d6dad5c49d8f6fe1.tar.gz
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>
Diffstat (limited to 'core/object/script_language_extension.h')
-rw-r--r--core/object/script_language_extension.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h
index 6edbcdaeee..eca208a2bd 100644
--- a/core/object/script_language_extension.h
+++ b/core/object/script_language_extension.h
@@ -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;