summaryrefslogtreecommitdiff
path: root/editor/editor_help.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_help.cpp')
-rw-r--r--editor/editor_help.cpp104
1 files changed, 74 insertions, 30 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 9918b655fb..cd5d26e577 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -48,9 +48,9 @@ void EditorHelp::_init_colors() {
text_color = get_color("default_color", "RichTextLabel");
headline_color = get_color("headline_color", "EditorHelp");
base_type_color = title_color.linear_interpolate(text_color, 0.5);
- comment_color = text_color * Color(1, 1, 1, 0.6);
+ comment_color = text_color * Color(1, 1, 1, 0.4);
symbol_color = comment_color;
- value_color = text_color * Color(1, 1, 1, 0.4);
+ value_color = text_color * Color(1, 1, 1, 0.6);
qualifier_color = text_color * Color(1, 1, 1, 0.8);
type_color = get_color("accent_color", "Editor").linear_interpolate(text_color, 0.5);
class_desc->add_color_override("selection_color", get_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
@@ -258,9 +258,11 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
if (p_method.arguments[j].default_value != "") {
class_desc->push_color(symbol_color);
- class_desc->add_text("=");
+ class_desc->add_text(" = ");
class_desc->pop();
+ class_desc->push_color(value_color);
_add_text(_fix_constant(p_method.arguments[j].default_value));
+ class_desc->pop();
}
class_desc->pop();
@@ -471,23 +473,37 @@ void EditorHelp::_update_doc() {
if (cd.properties[i].description != "") {
describe = true;
}
+
class_desc->push_cell();
+ class_desc->push_font(doc_code_font);
+ class_desc->push_color(headline_color);
+
if (describe) {
class_desc->push_meta("@member " + cd.properties[i].name);
}
- class_desc->push_font(doc_code_font);
- class_desc->push_color(headline_color);
_add_text(cd.properties[i].name);
- class_desc->pop();
- class_desc->pop();
-
if (describe) {
class_desc->pop();
property_descr = true;
}
+ if (cd.properties[i].default_value != "") {
+ class_desc->push_color(symbol_color);
+ class_desc->add_text(" [default: ");
+ class_desc->pop();
+ class_desc->push_color(value_color);
+ _add_text(_fix_constant(cd.properties[i].default_value));
+ class_desc->pop();
+ class_desc->push_color(symbol_color);
+ class_desc->add_text("]");
+ class_desc->pop();
+ }
+
+ class_desc->pop();
+ class_desc->pop();
+
class_desc->pop();
}
@@ -613,6 +629,19 @@ void EditorHelp::_update_doc() {
class_desc->push_color(headline_color);
_add_text(cd.theme_properties[i].name);
class_desc->pop();
+
+ if (cd.theme_properties[i].default_value != "") {
+ class_desc->push_color(symbol_color);
+ class_desc->add_text(" [default: ");
+ class_desc->pop();
+ class_desc->push_color(value_color);
+ _add_text(_fix_constant(cd.theme_properties[i].default_value));
+ class_desc->pop();
+ class_desc->push_color(symbol_color);
+ class_desc->add_text("]");
+ class_desc->pop();
+ }
+
class_desc->pop();
if (cd.theme_properties[i].description != "") {
@@ -671,7 +700,7 @@ void EditorHelp::_update_doc() {
if (cd.signals[i].arguments[j].default_value != "") {
class_desc->push_color(symbol_color);
- class_desc->add_text("=");
+ class_desc->add_text(" = ");
class_desc->pop();
_add_text(cd.signals[i].arguments[j].default_value);
}
@@ -777,7 +806,7 @@ void EditorHelp::_update_doc() {
class_desc->add_text(" = ");
class_desc->pop();
class_desc->push_color(value_color);
- _add_text(enum_list[i].value);
+ _add_text(_fix_constant(enum_list[i].value));
class_desc->pop();
class_desc->pop();
if (enum_list[i].description != "") {
@@ -843,7 +872,7 @@ void EditorHelp::_update_doc() {
class_desc->add_text(" = ");
class_desc->pop();
class_desc->push_color(value_color);
- _add_text(constants[i].value);
+ _add_text(_fix_constant(constants[i].value));
class_desc->pop();
class_desc->pop();
@@ -963,6 +992,21 @@ void EditorHelp::_update_doc() {
class_desc->push_color(headline_color);
_add_text(cd.properties[i].name);
class_desc->pop(); // color
+
+ if (cd.properties[i].default_value != "") {
+ class_desc->push_color(symbol_color);
+ class_desc->add_text(" [default: ");
+ class_desc->pop(); // color
+
+ class_desc->push_color(value_color);
+ _add_text(_fix_constant(cd.properties[i].default_value));
+ class_desc->pop(); // color
+
+ class_desc->push_color(symbol_color);
+ class_desc->add_text("]");
+ class_desc->pop(); // color
+ }
+
class_desc->pop(); // font
class_desc->pop(); // cell
@@ -1290,7 +1334,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
end = bbcode.length();
String image = bbcode.substr(brk_end + 1, end - brk_end - 1);
- Ref<Texture> texture = ResourceLoader::load(base_path + "/" + image, "Texture");
+ Ref<Texture> texture = ResourceLoader::load(base_path.plus_file(image), "Texture");
if (texture.is_valid())
p_rt->add_image(texture);
@@ -1304,39 +1348,39 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
if (col.begins_with("#"))
color = Color::html(col);
else if (col == "aqua")
- color = Color::html("#00FFFF");
+ color = Color(0, 1, 1);
else if (col == "black")
- color = Color::html("#000000");
+ color = Color(0, 0, 0);
else if (col == "blue")
- color = Color::html("#0000FF");
+ color = Color(0, 0, 1);
else if (col == "fuchsia")
- color = Color::html("#FF00FF");
+ color = Color(1, 0, 1);
else if (col == "gray" || col == "grey")
- color = Color::html("#808080");
+ color = Color(0.5, 0.5, 0.5);
else if (col == "green")
- color = Color::html("#008000");
+ color = Color(0, 0.5, 0);
else if (col == "lime")
- color = Color::html("#00FF00");
+ color = Color(0, 1, 0);
else if (col == "maroon")
- color = Color::html("#800000");
+ color = Color(0.5, 0, 0);
else if (col == "navy")
- color = Color::html("#000080");
+ color = Color(0, 0, 0.5);
else if (col == "olive")
- color = Color::html("#808000");
+ color = Color(0.5, 0.5, 0);
else if (col == "purple")
- color = Color::html("#800080");
+ color = Color(0.5, 0, 0.5);
else if (col == "red")
- color = Color::html("#FF0000");
+ color = Color(1, 0, 0);
else if (col == "silver")
- color = Color::html("#C0C0C0");
+ color = Color(0.75, 0.75, 0.75);
else if (col == "teal")
- color = Color::html("#008008");
+ color = Color(0, 0.5, 0.5);
else if (col == "white")
- color = Color::html("#FFFFFF");
+ color = Color(1, 1, 1);
else if (col == "yellow")
- color = Color::html("#FFFF00");
+ color = Color(1, 1, 0);
else
- color = Color(0, 0, 0, 1); //base_color;
+ color = Color(0, 0, 0); //base_color;
p_rt->push_color(color);
pos = brk_end + 1;
@@ -1346,7 +1390,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
String fnt = tag.substr(5, tag.length());
- Ref<Font> font = ResourceLoader::load(base_path + "/" + fnt, "Font");
+ Ref<Font> font = ResourceLoader::load(base_path.plus_file(fnt), "Font");
if (font.is_valid())
p_rt->push_font(font);
else {