diff options
author | Juan Linietsky <reduzio@gmail.com> | 2021-08-26 08:42:06 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-26 08:42:06 -0300 |
commit | 34e286d6a3efd101f04e7bcc84cea33a8d39452d (patch) | |
tree | b51d3c0274430f559be9eab5a592149da7ed6f8a /editor/editor_help.cpp | |
parent | 6e87d628735cb201cb3de49a723baaf60d9c942d (diff) | |
parent | 96f8254b24109884bdc3f6a7e224a8045b27ee15 (diff) |
Merge pull request #52077 from reduz/error-ret-doc
Implement error return documentation
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r-- | editor/editor_help.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 16151e36de..24b6ba1a14 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -30,6 +30,7 @@ #include "editor_help.h" +#include "core/core_constants.h" #include "core/input/input.h" #include "core/os/keyboard.h" #include "doc_data_compressed.gen.h" @@ -695,7 +696,7 @@ void EditorHelp::_update_doc() { class_desc->pop(); //cell } - if (m[i].description != "") { + if (m[i].description != "" || m[i].errors_returned.size() > 0) { method_descr = true; } @@ -1227,6 +1228,31 @@ void EditorHelp::_update_doc() { class_desc->push_color(text_color); class_desc->push_font(doc_font); class_desc->push_indent(1); + if (methods_filtered[i].errors_returned.size()) { + class_desc->append_bbcode(TTR("Error codes returned:")); + class_desc->add_newline(); + class_desc->push_list(0, RichTextLabel::LIST_DOTS, false); + for (int j = 0; j < methods_filtered[i].errors_returned.size(); j++) { + if (j > 0) { + class_desc->add_newline(); + } + int val = methods_filtered[i].errors_returned[j]; + String text = itos(val); + for (int k = 0; k < CoreConstants::get_global_constant_count(); k++) { + if (CoreConstants::get_global_constant_value(k) == val && CoreConstants::get_global_constant_enum(k) == SNAME("Error")) { + text = CoreConstants::get_global_constant_name(k); + break; + } + } + + class_desc->push_bold(); + class_desc->append_bbcode(text); + class_desc->pop(); + } + class_desc->pop(); + class_desc->add_newline(); + class_desc->add_newline(); + } if (!methods_filtered[i].description.strip_edges().is_empty()) { _add_text(DTR(methods_filtered[i].description)); } else { |