summaryrefslogtreecommitdiff
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-08-10 12:57:20 -0300
committerGitHub <noreply@github.com>2018-08-10 12:57:20 -0300
commitc76f444c4ec6971d5797568787b346ffde411c4a (patch)
tree125ee147aa053cc4299a92772a8a7a313fea8f5d /editor/editor_help.cpp
parentb4006f68b35d4270a0f3555d9baa2d8622bfc1e5 (diff)
parentba974b8d1e245818d819791bd628e70ec3b92de3 (diff)
Merge pull request #14704 from poke1024/colorconstants
Allow some non-integer built-in constants in gdscript
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r--editor/editor_help.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 727383b960..b7a5f67870 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -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);