From 7963e63165e4bd9d188eb13d33a300778d5ad57c Mon Sep 17 00:00:00 2001 From: Chris Cranford Date: Fri, 26 Jul 2024 23:53:13 -0400 Subject: [PATCH] Expose ClassDB methods `get_property_setter` / `get_property_getter` --- core/core_bind.cpp | 10 ++++++++++ core/core_bind.h | 2 ++ doc/classes/ClassDB.xml | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/core/core_bind.cpp b/core/core_bind.cpp index a1b7b81111d..a15085bcde5 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -1440,6 +1440,14 @@ TypedArray ClassDB::class_get_property_list(const StringName &p_clas return ret; } +StringName ClassDB::class_get_property_getter(const StringName &p_class, const StringName &p_property) { + return ::ClassDB::get_property_getter(p_class, p_property); +} + +StringName ClassDB::class_get_property_setter(const StringName &p_class, const StringName &p_property) { + return ::ClassDB::get_property_setter(p_class, p_property); +} + Variant ClassDB::class_get_property(Object *p_object, const StringName &p_property) const { Variant ret; ::ClassDB::get_property(p_object, p_property, ret); @@ -1601,6 +1609,8 @@ void ClassDB::_bind_methods() { ::ClassDB::bind_method(D_METHOD("class_get_signal_list", "class", "no_inheritance"), &ClassDB::class_get_signal_list, DEFVAL(false)); ::ClassDB::bind_method(D_METHOD("class_get_property_list", "class", "no_inheritance"), &ClassDB::class_get_property_list, DEFVAL(false)); + ::ClassDB::bind_method(D_METHOD("class_get_property_getter", "class", "property"), &ClassDB::class_get_property_getter); + ::ClassDB::bind_method(D_METHOD("class_get_property_setter", "class", "property"), &ClassDB::class_get_property_setter); ::ClassDB::bind_method(D_METHOD("class_get_property", "object", "property"), &ClassDB::class_get_property); ::ClassDB::bind_method(D_METHOD("class_set_property", "object", "property", "value"), &ClassDB::class_set_property); diff --git a/core/core_bind.h b/core/core_bind.h index b142a2fbbd9..69a359e4ed5 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -447,6 +447,8 @@ public: TypedArray class_get_signal_list(const StringName &p_class, bool p_no_inheritance = false) const; TypedArray class_get_property_list(const StringName &p_class, bool p_no_inheritance = false) const; + StringName class_get_property_getter(const StringName &p_class, const StringName &p_property); + StringName class_get_property_setter(const StringName &p_class, const StringName &p_property); Variant class_get_property(Object *p_object, const StringName &p_property) const; Error class_set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const; diff --git a/doc/classes/ClassDB.xml b/doc/classes/ClassDB.xml index 59ed0b8fe7f..66b67d1a59d 100644 --- a/doc/classes/ClassDB.xml +++ b/doc/classes/ClassDB.xml @@ -99,6 +99,14 @@ Returns the default value of [param property] of [param class] or its ancestor classes. + + + + + + Returns the getter method name of [param property] of [param class]. + + @@ -107,6 +115,14 @@ Returns an array with all the properties of [param class] or its ancestry if [param no_inheritance] is [code]false[/code]. + + + + + + Returns the setter method name of [param property] of [param class]. + +