Merge pull request #77 from limbonaut/fix-bbparam-null-default

Fix `BBParam` stored value defaulting to `null` in GDExtension
This commit is contained in:
Serhii Snitsaruk 2024-03-21 00:14:10 +01:00 committed by GitHub
commit 6edb7017b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 20 deletions

View File

@ -14,12 +14,6 @@
#include "../../util/limbo_utility.h" #include "../../util/limbo_utility.h"
#ifdef LIMBOAI_MODULE #ifdef LIMBOAI_MODULE
#include "core/core_bind.h"
#include "core/error/error_macros.h"
#include "core/object/class_db.h"
#include "core/object/object.h"
#include "core/variant/variant.h"
#include "core/variant/variant_utility.h"
#endif // LIMBOAI_MODULE #endif // LIMBOAI_MODULE
#ifdef LIMBOAI_GDEXTENSION #ifdef LIMBOAI_GDEXTENSION

View File

@ -17,16 +17,10 @@
#ifdef LIMBOAI_MODULE #ifdef LIMBOAI_MODULE
#include "core/io/resource.h" #include "core/io/resource.h"
#include "core/object/object.h"
#include "core/typedefs.h"
#include "core/variant/variant.h"
#endif // LIMBOAI_MODULE #endif // LIMBOAI_MODULE
#ifdef LIMBOAI_GDEXTENSION #ifdef LIMBOAI_GDEXTENSION
#include <godot_cpp/classes/object.hpp>
#include <godot_cpp/classes/resource.hpp> #include <godot_cpp/classes/resource.hpp>
#include <godot_cpp/core/type_info.hpp>
#include <godot_cpp/variant/variant.hpp>
#endif // LIMBOAI_GDEXTENSION #endif // LIMBOAI_GDEXTENSION
class BBParam : public Resource { class BBParam : public Resource {
@ -50,14 +44,7 @@ private:
protected: protected:
static void _bind_methods(); static void _bind_methods();
_FORCE_INLINE_ void _assign_default_value() { _FORCE_INLINE_ void _assign_default_value() { saved_value = VARIANT_DEFAULT(get_type()); }
#ifdef LIMBOAI_MODULE
Callable::CallError err;
Variant::construct(get_type(), saved_value, nullptr, 0, err);
#elif LIMBOAI_GDEXTENSION
saved_value.clear();
#endif
}
void _get_property_list(List<PropertyInfo> *p_list) const; void _get_property_list(List<PropertyInfo> *p_list) const;