Merge pull request #206 from limbonaut/gdextension-print-workaround

Override _to_string() to give useful info about objects in GDExtension
This commit is contained in:
Serhii Snitsaruk 2024-09-05 13:48:57 +02:00 committed by GitHub
commit 6c86ce566c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 28 additions and 0 deletions

View File

@ -40,6 +40,10 @@ private:
protected:
static void _bind_methods();
#ifdef LIMBOAI_GDEXTENSION
String _to_string() const { return "<" + get_class() + "#" + itos(get_instance_id()) + ">"; }
#endif
public:
void set_parent(const Ref<Blackboard> &p_blackboard) { parent = p_blackboard; }
Ref<Blackboard> get_parent() const { return parent; }

View File

@ -55,6 +55,10 @@ protected:
bool _property_can_revert(const StringName &p_name) const;
bool _property_get_revert(const StringName &p_name, Variant &r_property) const;
#ifdef LIMBOAI_GDEXTENSION
String _to_string() const { return "<" + get_class() + "#" + itos(get_instance_id()) + ">"; }
#endif
public:
void set_base_plan(const Ref<BlackboardPlan> &p_base);
Ref<BlackboardPlan> get_base_plan() const { return base; }

View File

@ -43,6 +43,10 @@ private:
protected:
static void _bind_methods();
#ifdef LIMBOAI_GDEXTENSION
String _to_string() const { return "<" + get_class() + "#" + itos(get_instance_id()) + ">"; }
#endif
public:
#ifdef LIMBOAI_MODULE
virtual bool editor_can_reload_from_file() override { return false; }

View File

@ -37,6 +37,10 @@ private:
protected:
static void _bind_methods();
#ifdef LIMBOAI_GDEXTENSION
String _to_string() const { return "<" + get_class() + "#" + itos(get_instance_id()) + ">"; }
#endif
public:
_FORCE_INLINE_ Ref<BTTask> get_root_task() const { return root_task; }
_FORCE_INLINE_ Node *get_owner_node() const { return owner_node_id ? Object::cast_to<Node>(OBJECT_DB_GET_INSTANCE(owner_node_id)) : nullptr; }

View File

@ -56,6 +56,10 @@ protected:
void _notification(int p_notification);
#ifdef LIMBOAI_GDEXTENSION
String _to_string() const { return String(get_name()) + ":<" + get_class() + "#" + itos(get_instance_id()) + ">"; }
#endif
public:
void set_behavior_tree(const Ref<BehaviorTree> &p_tree);
Ref<BehaviorTree> get_behavior_tree() const { return behavior_tree; };

View File

@ -111,6 +111,10 @@ protected:
GDVIRTUAL1R(Status, _tick, double);
GDVIRTUAL0RC(PackedStringArray, _get_configuration_warnings);
#ifdef LIMBOAI_GDEXTENSION
String _to_string() const { return "<" + get_class() + "#" + itos(get_instance_id()) + ">"; }
#endif
public:
// TODO: GDExtension doesn't have this method hmm...

View File

@ -65,6 +65,10 @@ protected:
GDVIRTUAL0(_exit);
GDVIRTUAL1(_update, double);
#ifdef LIMBOAI_GDEXTENSION
String _to_string() const { return String(get_name()) + ":<" + get_class() + "#" + itos(get_instance_id()) + ">"; }
#endif
public:
void set_blackboard_plan(const Ref<BlackboardPlan> &p_plan);
_FORCE_INLINE_ Ref<BlackboardPlan> get_blackboard_plan() const { return blackboard_plan; }