MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / get_documentation_default_value

Function get_documentation_default_value

editor/doc/doc_tools.cpp:386–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386static Variant get_documentation_default_value(const StringName &p_class_name, const StringName &p_property_name, bool &r_default_value_valid) {
387 Variant default_value = Variant();
388 r_default_value_valid = false;
389
390 if (ClassDB::can_instantiate(p_class_name) && !ClassDB::is_virtual(p_class_name)) { // Keep this condition in sync with ClassDB::class_get_default_property_value.
391 default_value = ClassDB::class_get_default_property_value(p_class_name, p_property_name, &r_default_value_valid);
392 } else {
393 // Cannot get default value of classes that can't be instantiated
394 List<StringName> inheriting_classes;
395 ClassDB::get_direct_inheriters_from_class(p_class_name, &inheriting_classes);
396 for (const StringName &class_name : inheriting_classes) {
397 if (ClassDB::can_instantiate(class_name)) {
398 default_value = ClassDB::class_get_default_property_value(class_name, p_property_name, &r_default_value_valid);
399 if (r_default_value_valid) {
400 break;
401 }
402 }
403 }
404 }
405
406 return default_value;
407}
408
409void DocTools::generate(BitField<GenerateFlags> p_flags) {
410 // This may involve instantiating classes that are only usable from the main thread

Callers 1

generateMethod · 0.85

Calls 1

VariantClass · 0.50

Tested by

no test coverage detected