From 0a57f964a357976e023b638e872397ba94123776 Mon Sep 17 00:00:00 2001 From: reduz Date: Thu, 28 Apr 2022 22:49:10 +0200 Subject: Implement missing Node & Resource placeholders Implemented by request of @neikeq to advance in the GDExtension version of Mono. * If a Resource type is missing upon load, it will be remembered together with its data (Unless manually overriden). * If a Node type is missing upon load, it will be also be remembered together with its data (unless deleted). This feature makes working with GDExtension much easier, as it ensures that missing types no longer cause data loss. --- core/object/object.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'core/object/object.cpp') diff --git a/core/object/object.cpp b/core/object/object.cpp index 1defd85a14..2b62041533 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -434,15 +434,6 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid } } - // Something inside the object... :| - bool success = _setv(p_name, p_value); - if (success) { - if (r_valid) { - *r_valid = true; - } - return; - } - #ifdef TOOLS_ENABLED if (script_instance) { bool valid; @@ -456,6 +447,15 @@ void Object::set(const StringName &p_name, const Variant &p_value, bool *r_valid } #endif + // Something inside the object... :| + bool success = _setv(p_name, p_value); + if (success) { + if (r_valid) { + *r_valid = true; + } + return; + } + if (r_valid) { *r_valid = false; } @@ -518,15 +518,6 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const { return ret; } else { - // Something inside the object... :| - bool success = _getv(p_name, ret); - if (success) { - if (r_valid) { - *r_valid = true; - } - return ret; - } - #ifdef TOOLS_ENABLED if (script_instance) { bool valid; @@ -539,6 +530,14 @@ Variant Object::get(const StringName &p_name, bool *r_valid) const { } } #endif + // Something inside the object... :| + bool success = _getv(p_name, ret); + if (success) { + if (r_valid) { + *r_valid = true; + } + return ret; + } if (r_valid) { *r_valid = false; -- cgit v1.2.3