Browse Source

Expose ClassDB methods `get_property_setter` / `get_property_getter`

Chris Cranford 1 year ago
parent
commit
7963e63165
3 changed files with 28 additions and 0 deletions
  1. 10 0
      core/core_bind.cpp
  2. 2 0
      core/core_bind.h
  3. 16 0
      doc/classes/ClassDB.xml

+ 10 - 0
core/core_bind.cpp

@@ -1440,6 +1440,14 @@ TypedArray<Dictionary> ClassDB::class_get_property_list(const StringName &p_clas
 	return ret;
 	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 ClassDB::class_get_property(Object *p_object, const StringName &p_property) const {
 	Variant ret;
 	Variant ret;
 	::ClassDB::get_property(p_object, p_property, 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_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_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_get_property", "object", "property"), &ClassDB::class_get_property);
 	::ClassDB::bind_method(D_METHOD("class_set_property", "object", "property", "value"), &ClassDB::class_set_property);
 	::ClassDB::bind_method(D_METHOD("class_set_property", "object", "property", "value"), &ClassDB::class_set_property);
 
 

+ 2 - 0
core/core_bind.h

@@ -447,6 +447,8 @@ public:
 	TypedArray<Dictionary> class_get_signal_list(const StringName &p_class, bool p_no_inheritance = false) const;
 	TypedArray<Dictionary> class_get_signal_list(const StringName &p_class, bool p_no_inheritance = false) const;
 
 
 	TypedArray<Dictionary> class_get_property_list(const StringName &p_class, bool p_no_inheritance = false) const;
 	TypedArray<Dictionary> 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;
 	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;
 	Error class_set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const;
 
 

+ 16 - 0
doc/classes/ClassDB.xml

@@ -99,6 +99,14 @@
 				Returns the default value of [param property] of [param class] or its ancestor classes.
 				Returns the default value of [param property] of [param class] or its ancestor classes.
 			</description>
 			</description>
 		</method>
 		</method>
+		<method name="class_get_property_getter">
+			<return type="StringName" />
+			<param index="0" name="class" type="StringName" />
+			<param index="1" name="property" type="StringName" />
+			<description>
+				Returns the getter method name of [param property] of [param class].
+			</description>
+		</method>
 		<method name="class_get_property_list" qualifiers="const">
 		<method name="class_get_property_list" qualifiers="const">
 			<return type="Dictionary[]" />
 			<return type="Dictionary[]" />
 			<param index="0" name="class" type="StringName" />
 			<param index="0" name="class" type="StringName" />
@@ -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 an array with all the properties of [param class] or its ancestry if [param no_inheritance] is [code]false[/code].
 			</description>
 			</description>
 		</method>
 		</method>
+		<method name="class_get_property_setter">
+			<return type="StringName" />
+			<param index="0" name="class" type="StringName" />
+			<param index="1" name="property" type="StringName" />
+			<description>
+				Returns the setter method name of [param property] of [param class].
+			</description>
+		</method>
 		<method name="class_get_signal" qualifiers="const">
 		<method name="class_get_signal" qualifiers="const">
 			<return type="Dictionary" />
 			<return type="Dictionary" />
 			<param index="0" name="class" type="StringName" />
 			<param index="0" name="class" type="StringName" />