1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Allow some non-integer built-in constants in gdscript

This commit is contained in:
Bernhard Liebl
2017-12-15 16:43:27 +01:00
parent 4e4702e386
commit ba974b8d1e
8 changed files with 104 additions and 18 deletions

View File

@@ -1214,6 +1214,18 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
constant_line[constants[i].name] = class_desc->get_line_count() - 2;
class_desc->push_font(doc_code_font);
if (constants[i].value.begins_with("Color(") && constants[i].value.ends_with(")")) {
String stripped = constants[i].value.replace(" ", "").replace("Color(", "").replace(")", "");
Vector<float> color = stripped.split_floats(",");
if (color.size() >= 3) {
class_desc->push_color(Color(color[0], color[1], color[2]));
static const CharType prefix[3] = { 0x25CF /* filled circle */, ' ', 0 };
class_desc->add_text(String(prefix));
class_desc->pop();
}
}
class_desc->push_color(headline_color);
_add_text(constants[i].name);
class_desc->pop();
@@ -1223,6 +1235,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_color(value_color);
_add_text(constants[i].value);
class_desc->pop();
class_desc->pop();
if (constants[i].description != "") {
class_desc->push_font(doc_font);