diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-07-25 18:54:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-25 18:54:25 +0200 |
commit | 6f292f906e749f30ceb7f922df5639add61a5f88 (patch) | |
tree | b644dba35d501c40bd144c767351822f0290b9fa /editor/doc_data.cpp | |
parent | 58bde149cc461b5fafa254f765ad370a7291ffb5 (diff) | |
parent | 0181c3dde12d2bcfdcbb463dcf90cf47f0b88fee (diff) |
Merge pull request #38900 from bruvzg/docs_ignore_os_spec_def_vals
Docs: Ignore OS specific values (constants, project settings, properties)
Diffstat (limited to 'editor/doc_data.cpp')
-rw-r--r-- | editor/doc_data.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/editor/doc_data.cpp b/editor/doc_data.cpp index 54acbe9559..75b16b4510 100644 --- a/editor/doc_data.cpp +++ b/editor/doc_data.cpp @@ -321,12 +321,13 @@ void DocData::generate(bool p_basic_types) { continue; } if (E->get().usage & PROPERTY_USAGE_EDITOR) { - default_value = ProjectSettings::get_singleton()->property_get_revert(E->get().name); - default_value_valid = true; + if (!ProjectSettings::get_singleton()->get_ignore_value_in_docs(E->get().name)) { + default_value = ProjectSettings::get_singleton()->property_get_revert(E->get().name); + default_value_valid = true; + } } } else { default_value = get_documentation_default_value(name, E->get().name, default_value_valid); - if (inherited) { bool base_default_value_valid = false; Variant base_default_value = get_documentation_default_value(ClassDB::get_parent_class(name), E->get().name, base_default_value_valid); @@ -478,6 +479,7 @@ void DocData::generate(bool p_basic_types) { ConstantDoc constant; constant.name = E->get(); constant.value = itos(ClassDB::get_integer_constant(name, E->get())); + constant.is_value_valid = true; constant.enumeration = ClassDB::get_integer_constant_enum(name, E->get()); c.constants.push_back(constant); } @@ -620,6 +622,7 @@ void DocData::generate(bool p_basic_types) { constant.name = E->get(); Variant value = Variant::get_constant_value(Variant::Type(i), E->get()); constant.value = value.get_type() == Variant::INT ? itos(value) : value.get_construct_string(); + constant.is_value_valid = true; c.constants.push_back(constant); } } @@ -635,7 +638,12 @@ void DocData::generate(bool p_basic_types) { for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) { ConstantDoc cd; cd.name = GlobalConstants::get_global_constant_name(i); - cd.value = itos(GlobalConstants::get_global_constant_value(i)); + if (!GlobalConstants::get_ignore_value_in_docs(i)) { + cd.value = itos(GlobalConstants::get_global_constant_value(i)); + cd.is_value_valid = true; + } else { + cd.is_value_valid = false; + } cd.enumeration = GlobalConstants::get_global_constant_enum(i); c.constants.push_back(cd); } @@ -715,6 +723,7 @@ void DocData::generate(bool p_basic_types) { ConstantDoc cd; cd.name = E->get().first; cd.value = E->get().second; + cd.is_value_valid = true; c.constants.push_back(cd); } @@ -989,6 +998,7 @@ Error DocData::_load(Ref<XMLParser> parser) { constant2.name = parser->get_attribute_value("name"); ERR_FAIL_COND_V(!parser->has_attribute("value"), ERR_FILE_CORRUPT); constant2.value = parser->get_attribute_value("value"); + constant2.is_value_valid = true; if (parser->has_attribute("enum")) { constant2.enumeration = parser->get_attribute_value("enum"); } @@ -1178,10 +1188,18 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri for (int i = 0; i < c.constants.size(); i++) { const ConstantDoc &k = c.constants[i]; - if (k.enumeration != String()) { - _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\" enum=\"" + k.enumeration + "\">"); + if (k.is_value_valid) { + if (k.enumeration != String()) { + _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\" enum=\"" + k.enumeration + "\">"); + } else { + _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\">"); + } } else { - _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\">"); + if (k.enumeration != String()) { + _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"platform-dependent\" enum=\"" + k.enumeration + "\">"); + } else { + _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"platform-dependent\">"); + } } _write_string(f, 3, k.description.strip_edges().xml_escape()); _write_string(f, 2, "</constant>"); |