Expose ClassDB::class_get_property_default_value method

This commit is contained in:
Chris Cranford 2024-04-19 13:51:28 -04:00
parent f47f4a02c8
commit fdf31011a5
3 changed files with 21 additions and 0 deletions

View file

@ -1439,6 +1439,15 @@ Error ClassDB::class_set_property(Object *p_object, const StringName &p_property
return OK;
}
Variant ClassDB::class_get_property_default_value(const StringName &p_class, const StringName &p_property) const {
bool valid;
Variant ret = ::ClassDB::class_get_default_property_value(p_class, p_property, &valid);
if (valid) {
return ret;
}
return Variant();
}
bool ClassDB::class_has_method(const StringName &p_class, const StringName &p_method, bool p_no_inheritance) const {
return ::ClassDB::has_method(p_class, p_method, p_no_inheritance);
}
@ -1573,6 +1582,8 @@ void ClassDB::_bind_methods() {
::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_get_property_default_value", "class", "property"), &ClassDB::class_get_property_default_value);
::ClassDB::bind_method(D_METHOD("class_has_method", "class", "method", "no_inheritance"), &ClassDB::class_has_method, DEFVAL(false));
::ClassDB::bind_method(D_METHOD("class_get_method_argument_count", "class", "method", "no_inheritance"), &ClassDB::class_get_method_argument_count, DEFVAL(false));

View file

@ -446,6 +446,8 @@ public:
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;
Variant class_get_property_default_value(const StringName &p_class, const StringName &p_property) const;
bool class_has_method(const StringName &p_class, const StringName &p_method, bool p_no_inheritance = false) const;
int class_get_method_argument_count(const StringName &p_class, const StringName &p_method, bool p_no_inheritance = false) const;

View file

@ -91,6 +91,14 @@
Returns the value of [param property] of [param object] or its ancestry.
</description>
</method>
<method name="class_get_property_default_value" qualifiers="const">
<return type="Variant" />
<param index="0" name="class" type="StringName" />
<param index="1" name="property" type="StringName" />
<description>
Returns the default value of [param property] of [param class] or its ancestor classes.
</description>
</method>
<method name="class_get_property_list" qualifiers="const">
<return type="Dictionary[]" />
<param index="0" name="class" type="StringName" />