diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-08-21 17:12:55 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-08-21 17:13:16 -0300 |
commit | 0a8ac1a57c00db32464b7ea30dd9fd6404936948 (patch) | |
tree | 0e452e7fe49c534f5ea7e7cab3cae88b09dbd6b7 | |
parent | ed10ff65fd741263ab44eeb75b198b3a41c2eb67 (diff) |
display some constants as hex
-rw-r--r-- | editor/editor_help.cpp | 18 | ||||
-rw-r--r-- | editor/editor_help.h | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 65c41ef579..50b3810e52 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -624,6 +624,22 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { class_desc->pop(); } +String EditorHelp::_fix_constant(const String &p_constant) const { + + if (p_constant.strip_edges() == "4294967295") { + return "0xFFFFFFFF"; + } + + if (p_constant.strip_edges() == "2147483647") { + return "0x7FFFFFFF"; + } + if (p_constant.strip_edges() == "1048575") { + return "0xfffff"; + } + + return p_constant; +} + void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview) { method_line[p_method.name] = class_desc->get_line_count() - 2; //gets overridden if description @@ -673,7 +689,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview class_desc->push_color(symbol_color); class_desc->add_text("="); class_desc->pop(); - _add_text(p_method.arguments[j].default_value); + _add_text(_fix_constant(p_method.arguments[j].default_value)); } class_desc->pop(); diff --git a/editor/editor_help.h b/editor/editor_help.h index dbea97e98b..ad81a39945 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -244,6 +244,8 @@ class EditorHelp : public VBoxContainer { void _unhandled_key_input(const Ref<InputEvent> &p_ev); + String _fix_constant(const String &p_constant) const; + protected: void _notification(int p_what); static void _bind_methods(); |