From 0181c3dde12d2bcfdcbb463dcf90cf47f0b88fee Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Wed, 20 May 2020 22:49:39 +0300 Subject: Docs: Ignore OS specific values (constants, project settings, properties). --- editor/doc_data.cpp | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'editor/doc_data.cpp') 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 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"); + if (k.is_value_valid) { + if (k.enumeration != String()) { + _write_string(f, 2, ""); + } else { + _write_string(f, 2, ""); + } } else { - _write_string(f, 2, ""); + if (k.enumeration != String()) { + _write_string(f, 2, ""); + } else { + _write_string(f, 2, ""); + } } _write_string(f, 3, k.description.strip_edges().xml_escape()); _write_string(f, 2, ""); -- cgit v1.2.3