summaryrefslogtreecommitdiff
path: root/editor/doc/doc_data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/doc/doc_data.cpp')
-rw-r--r--editor/doc/doc_data.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index 468819151f..6ee07d3661 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -248,21 +248,28 @@ void DocData::generate(bool p_basic_types) {
prop.setter = setter;
prop.getter = getter;
- if (ClassDB::can_instance(name)) { // Cannot get default value of classes that can't be instanced
- Variant default_value = ClassDB::class_get_default_property_value(name, E->get().name);
- prop.default_value = default_value.get_construct_string();
+ Variant default_value = Variant();
+ bool default_value_valid = false;
+
+ if (ClassDB::can_instance(name)) {
+ default_value = ClassDB::class_get_default_property_value(name, E->get().name, &default_value_valid);
} else {
+ // Cannot get default value of classes that can't be instanced
List<StringName> inheriting_classes;
ClassDB::get_direct_inheriters_from_class(name, &inheriting_classes);
for (List<StringName>::Element *E2 = inheriting_classes.front(); E2; E2 = E2->next()) {
if (ClassDB::can_instance(E2->get())) {
- Variant default_value = ClassDB::class_get_default_property_value(E2->get(), E->get().name);
- prop.default_value = default_value.get_construct_string();
- break;
+ default_value = ClassDB::class_get_default_property_value(E2->get(), E->get().name, &default_value_valid);
+ if (default_value_valid)
+ break;
}
}
}
+ if (default_value_valid) {
+ prop.default_value = default_value.get_construct_string();
+ }
+
bool found_type = false;
if (getter != StringName()) {
MethodBind *mb = ClassDB::get_method(name, getter);