diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-07-30 00:39:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-30 00:39:16 +0200 |
commit | 9094262a6b9f3d7fc5aa8a8dd582ec1058bfce71 (patch) | |
tree | 2a48ee31f75edb2db4e0e28c470b1e177bea28cb /editor/doc_tools.cpp | |
parent | 335fc2a94675de9c063743301fe4ce02bf344d63 (diff) | |
parent | 63ce655e75e9d46c8b588ff258c3f50d5290c553 (diff) |
Merge pull request #48548 from Calinou/editor-help-add-editor-settings
Add support for documenting most editor settings in the class reference
Diffstat (limited to 'editor/doc_tools.cpp')
-rw-r--r-- | editor/doc_tools.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index 773fcc5017..a819458417 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -39,6 +39,7 @@ #include "core/object/script_language.h" #include "core/string/translation.h" #include "core/version.h" +#include "editor/editor_settings.h" #include "scene/resources/theme.h" // Used for a hack preserving Mono properties on non-Mono builds. @@ -363,8 +364,15 @@ void DocTools::generate(bool p_basic_types) { List<PropertyInfo> properties; List<PropertyInfo> own_properties; - if (name == "ProjectSettings") { - // Special case for project settings, so settings can be documented. + + // Special case for editor and project settings, so they can be documented. + if (name == "EditorSettings") { + // We don't create the full blown EditorSettings (+ config file) with `create()`, + // instead we just make a local instance to get default values. + Ref<EditorSettings> edset = memnew(EditorSettings); + edset->get_property_list(&properties); + own_properties = properties; + } else if (name == "ProjectSettings") { ProjectSettings::get_singleton()->get_property_list(&properties); own_properties = properties; } else { @@ -402,6 +410,13 @@ void DocTools::generate(bool p_basic_types) { bool default_value_valid = false; Variant default_value; + if (name == "EditorSettings") { + if (E.name == "resource_local_to_scene" || E.name == "resource_name" || E.name == "resource_path" || E.name == "script") { + // Don't include spurious properties in the generated EditorSettings class reference. + continue; + } + } + if (name == "ProjectSettings") { // Special case for project settings, so that settings are not taken from the current project's settings if (E.name == "script" || !ProjectSettings::get_singleton()->is_builtin_setting(E.name)) { @@ -424,8 +439,6 @@ void DocTools::generate(bool p_basic_types) { } } - //used to track uninitialized values using valgrind - //print_line("getting default value for " + String(name) + "." + String(E.name)); if (default_value_valid && default_value.get_type() != Variant::OBJECT) { prop.default_value = default_value.get_construct_string().replace("\n", " "); } |