summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/doc/doc_data.cpp206
-rw-r--r--editor/doc/doc_data.h4
-rw-r--r--editor/editor_help.cpp201
-rw-r--r--editor/editor_help.h3
4 files changed, 268 insertions, 146 deletions
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index 69d7475f4c..d46649f052 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -196,10 +196,40 @@ void DocData::generate(bool p_basic_types) {
prop.name = E->get().name;
prop.setter = setter;
prop.getter = getter;
- if (E->get().type == Variant::OBJECT && E->get().hint == PROPERTY_HINT_RESOURCE_TYPE)
- prop.type = E->get().hint_string;
- else
- prop.type = Variant::get_type_name(E->get().type);
+
+ bool found_type = false;
+ if (getter != StringName()) {
+ MethodBind *mb = ClassDB::get_method(name, getter);
+ if (mb) {
+ PropertyInfo retinfo = mb->get_return_info();
+
+ found_type = true;
+ if (retinfo.type == Variant::INT && retinfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
+ prop.enumeration = retinfo.class_name;
+ prop.type = "int";
+ } else if (retinfo.class_name != StringName()) {
+ prop.type = retinfo.class_name;
+ } else if (retinfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {
+
+ prop.type = retinfo.hint_string;
+ } else if (retinfo.type == Variant::NIL && retinfo.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
+
+ prop.type = "Variant";
+ } else if (retinfo.type == Variant::NIL) {
+ prop.type = "void";
+ } else {
+ prop.type = Variant::get_type_name(retinfo.type);
+ }
+ }
+ }
+
+ if (!found_type) {
+
+ if (E->get().type == Variant::OBJECT && E->get().hint == PROPERTY_HINT_RESOURCE_TYPE)
+ prop.type = E->get().hint_string;
+ else
+ prop.type = Variant::get_type_name(E->get().type);
+ }
c.properties.push_back(prop);
}
@@ -217,8 +247,6 @@ void DocData::generate(bool p_basic_types) {
method.name = E->get().name;
- MethodBind *m = ClassDB::get_method(name, E->get().name);
-
if (E->get().flags & METHOD_FLAG_VIRTUAL)
method.qualifiers = "virtual";
if (E->get().flags & METHOD_FLAG_CONST) {
@@ -234,122 +262,59 @@ void DocData::generate(bool p_basic_types) {
for (int i = -1; i < E->get().arguments.size(); i++) {
- PropertyInfo arginfo;
-
if (i == -1) {
- arginfo = E->get().return_val;
#ifdef DEBUG_METHODS_ENABLED
- if (m && m->get_return_type() != StringName())
- method.return_type = m->get_return_type();
- else if (method.name.find(":") != -1) {
- method.return_type = method.name.get_slice(":", 1);
- method.name = method.name.get_slice(":", 0);
- } else if (arginfo.type != Variant::NIL) // {
+ PropertyInfo retinfo = E->get().return_val;
+
+ if (retinfo.type == Variant::INT && retinfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
+ method.return_enum = retinfo.class_name;
+ method.return_type = "int";
+ } else if (retinfo.class_name != StringName()) {
+ method.return_type = retinfo.class_name;
+ } else if (retinfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {
+
+ method.return_type = retinfo.hint_string;
+ } else if (retinfo.type == Variant::NIL && retinfo.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
+
+ method.return_type = "Variant";
+ } else if (retinfo.type == Variant::NIL) {
+ method.return_type = "void";
+ } else {
+ method.return_type = Variant::get_type_name(retinfo.type);
+ }
#endif
- method.return_type = (arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE) ? arginfo.hint_string : Variant::get_type_name(arginfo.type);
- //}
} else {
ArgumentDoc argument;
- arginfo = E->get().arguments[i];
-
- String type_name;
-
- if (arginfo.name.find(":") != -1) {
- type_name = arginfo.name.get_slice(":", 1);
- arginfo.name = arginfo.name.get_slice(":", 0);
+ PropertyInfo arginfo = E->get().arguments[i];
+ if (arginfo.type == Variant::INT && arginfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
+ argument.enumeration = arginfo.class_name;
+ argument.type = "int";
+ } else if (arginfo.class_name != StringName()) {
+ argument.type = arginfo.class_name;
} else if (arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {
- type_name = arginfo.hint_string;
- } else if (arginfo.type == Variant::NIL)
- type_name = "Variant";
- else
- type_name = Variant::get_type_name(arginfo.type);
- if (arginfo.type == Variant::OBJECT) {
+ argument.type = arginfo.hint_string;
+ } else if (arginfo.type == Variant::NIL && arginfo.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
- //print_line("validate: "+cname+"::"+method.name);
- }
-
- if (m && m->has_default_argument(i)) {
- Variant default_arg = m->get_default_argument(i);
- String default_arg_text = m->get_default_argument(i);
-
- switch (default_arg.get_type()) {
-
- case Variant::NIL:
- default_arg_text = "NULL";
- break;
- // atomic types
- case Variant::BOOL:
- if (bool(default_arg))
- default_arg_text = "true";
- else
- default_arg_text = "false";
- break;
- case Variant::INT:
- case Variant::REAL:
- //keep it
- break;
- case Variant::STRING:
- case Variant::NODE_PATH:
- default_arg_text = "\"" + default_arg_text + "\"";
- break;
- case Variant::TRANSFORM:
- if (default_arg.operator Transform() == Transform()) {
- default_arg_text = "";
- }
-
- default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")";
- break;
-
- case Variant::RECT3:
- case Variant::COLOR:
- case Variant::PLANE:
- case Variant::POOL_BYTE_ARRAY:
- case Variant::POOL_INT_ARRAY:
- case Variant::POOL_REAL_ARRAY:
- case Variant::POOL_STRING_ARRAY:
- case Variant::POOL_VECTOR2_ARRAY:
- case Variant::POOL_VECTOR3_ARRAY:
- case Variant::POOL_COLOR_ARRAY:
- default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")";
- break;
- case Variant::VECTOR2:
- case Variant::RECT2:
- case Variant::VECTOR3:
- case Variant::QUAT:
- case Variant::BASIS:
- default_arg_text = Variant::get_type_name(default_arg.get_type()) + default_arg_text;
- break;
- case Variant::OBJECT:
- if (default_arg.is_zero()) {
- default_arg_text = "NULL";
- break;
- }
- case Variant::DICTIONARY: // 20
- case Variant::ARRAY:
- case Variant::_RID:
-
- default: {}
- }
-
- argument.type = type_name;
- argument.name = arginfo.name;
- argument.default_value = default_arg_text;
+ argument.type = "Variant";
+ } else if (arginfo.type == Variant::NIL) {
+ method.return_type = "void";
} else {
-
- argument.type = type_name;
- argument.name = arginfo.name;
+ argument.type = Variant::get_type_name(arginfo.type);
}
- if (arginfo.type == Variant::OBJECT) {
+ argument.name = E->get().arguments[i].name;
+ int darg_idx = i - (E->get().arguments.size() - E->get().default_arguments.size());
- //print_line("validate: "+cname+"::"+method.name);
+ if (darg_idx >= 0) {
+ Variant default_arg = E->get().default_arguments[darg_idx];
+ argument.default_value = default_arg.get_construct_string();
}
method.arguments.push_back(argument);
@@ -404,6 +369,7 @@ void DocData::generate(bool p_basic_types) {
ConstantDoc constant;
constant.name = E->get();
constant.value = itos(ClassDB::get_integer_constant(name, E->get()));
+ constant.enumeration = ClassDB::get_integer_constant_enum(name, E->get());
c.constants.push_back(constant);
}
@@ -565,6 +531,7 @@ void DocData::generate(bool p_basic_types) {
ConstantDoc cd;
cd.name = GlobalConstants::get_global_constant_name(i);
cd.value = itos(GlobalConstants::get_global_constant_value(i));
+ cd.enumeration = GlobalConstants::get_global_constant_enum(i);
c.constants.push_back(cd);
}
@@ -680,6 +647,9 @@ static Error _parse_methods(Ref<XMLParser> &parser, Vector<DocData::MethodDoc> &
argument.name = parser->get_attribute_value("name");
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
argument.type = parser->get_attribute_value("type");
+ if (parser->has_attribute("enum")) {
+ argument.enumeration = parser->get_attribute_value("enum");
+ }
method.arguments.push_back(argument);
@@ -803,7 +773,8 @@ Error DocData::_load(Ref<XMLParser> parser) {
prop.getter = parser->get_attribute_value("getter");
if (parser->has_attribute("brief"))
prop.brief_description = parser->get_attribute_value("brief").xml_unescape();
-
+ if (parser->has_attribute("enum"))
+ prop.enumeration = parser->get_attribute_value("enum");
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
prop.description = parser->get_node_data().strip_edges();
@@ -861,6 +832,9 @@ Error DocData::_load(Ref<XMLParser> parser) {
constant.name = parser->get_attribute_value("name");
ERR_FAIL_COND_V(!parser->has_attribute("value"), ERR_FILE_CORRUPT);
constant.value = parser->get_attribute_value("value");
+ if (parser->has_attribute("enum")) {
+ constant.enumeration = parser->get_attribute_value("enum");
+ }
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT)
constant.description = parser->get_node_data().strip_edges();
@@ -955,10 +929,16 @@ Error DocData::save(const String &p_path) {
for (int j = 0; j < m.arguments.size(); j++) {
ArgumentDoc &a = m.arguments[j];
+
+ String enum_text;
+ if (a.enumeration != String()) {
+ enum_text = "enum=\"" + a.enumeration + "\"";
+ }
+
if (a.default_value != "")
- _write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\" default=\"" + a.default_value.xml_escape(true) + "\">");
+ _write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\" " + enum_text + " default=\"" + a.default_value.xml_escape(true) + "\">");
else
- _write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\">");
+ _write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\" " + enum_text + ">");
_write_string(f, 3, "</argument>");
}
@@ -980,8 +960,12 @@ Error DocData::save(const String &p_path) {
for (int i = 0; i < c.properties.size(); i++) {
+ String enum_text;
+ if (c.properties[i].enumeration != String()) {
+ enum_text = "enum=\"" + c.properties[i].enumeration + "\"";
+ }
PropertyDoc &p = c.properties[i];
- _write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\" brief=\"" + p.brief_description.xml_escape(true) + "\">");
+ _write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\" brief=\"" + p.brief_description.xml_escape(true) + "\" " + enum_text + " >");
if (p.description != "")
_write_string(f, 3, p.description.xml_escape());
_write_string(f, 2, "</member>");
@@ -1021,7 +1005,11 @@ Error DocData::save(const String &p_path) {
for (int i = 0; i < c.constants.size(); i++) {
ConstantDoc &k = c.constants[i];
- _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\">");
+ if (k.enumeration != String()) {
+ _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\">");
+ } else {
+ _write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\" enum=\"" + k.enumeration + "\">");
+ }
if (k.description != "")
_write_string(f, 3, k.description.xml_escape());
_write_string(f, 2, "</constant>");
diff --git a/editor/doc/doc_data.h b/editor/doc/doc_data.h
index 41dfae428a..40141dd935 100644
--- a/editor/doc/doc_data.h
+++ b/editor/doc/doc_data.h
@@ -40,6 +40,7 @@ public:
String name;
String type;
+ String enumeration;
String default_value;
};
@@ -47,6 +48,7 @@ public:
String name;
String return_type;
+ String return_enum;
String qualifiers;
String description;
Vector<ArgumentDoc> arguments;
@@ -59,6 +61,7 @@ public:
String name;
String value;
+ String enumeration;
String description;
};
@@ -66,6 +69,7 @@ public:
String name;
String type;
+ String enumeration;
String brief_description;
String description;
String setter, getter;
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 89d70ee926..86f31d7589 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -582,7 +582,18 @@ void EditorHelp::_class_list_select(const String &p_select) {
void EditorHelp::_class_desc_select(const String &p_select) {
//print_line("LINK: "+p_select);
- if (p_select.begins_with("#")) {
+ if (p_select.begins_with("$")) { //enum
+ //_goto_desc(p_select.substr(1,p_select.length()));
+ String select = p_select.substr(1, p_select.length());
+ String class_name;
+ if (select.find(".") != -1) {
+ class_name = select.get_slice(".", 0);
+ } else {
+ class_name = "@Global Scope";
+ }
+ emit_signal("go_to_help", "class_enum:" + class_name + ":" + select);
+ return;
+ } else if (p_select.begins_with("#")) {
//_goto_desc(p_select.substr(1,p_select.length()));
emit_signal("go_to_help", "class_name:" + p_select.substr(1, p_select.length()));
return;
@@ -614,16 +625,28 @@ void EditorHelp::_class_desc_input(const Ref<InputEvent> &p_input) {
set_focused();
}
-void EditorHelp::_add_type(const String &p_type) {
+void EditorHelp::_add_type(const String &p_type, const String &p_enum) {
String t = p_type;
if (t == "")
t = "void";
- bool can_ref = (t != "int" && t != "real" && t != "bool" && t != "void");
+ bool can_ref = (t != "int" && t != "real" && t != "bool" && t != "void") || p_enum != String();
+ if (p_enum != String()) {
+ if (p_enum.get_slice_count(".") > 1) {
+ t = p_enum.get_slice(".", 1);
+ } else {
+ t = p_enum.get_slice(".", 0);
+ }
+ }
class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color"));
- if (can_ref)
- class_desc->push_meta("#" + t); //class
+ if (can_ref) {
+ if (p_enum == "") {
+ class_desc->push_meta("#" + t); //class
+ } else {
+ class_desc->push_meta("$" + p_enum); //class
+ }
+ }
class_desc->add_text(t);
if (can_ref)
class_desc->pop();
@@ -782,7 +805,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_cell();
class_desc->push_align(RichTextLabel::ALIGN_RIGHT);
class_desc->push_font(doc_code_font);
- _add_type(cd.properties[i].type);
+ _add_type(cd.properties[i].type, cd.properties[i].enumeration);
class_desc->add_text(" ");
class_desc->pop();
class_desc->pop();
@@ -875,7 +898,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
method_line[methods[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
class_desc->push_align(RichTextLabel::ALIGN_RIGHT);
class_desc->push_font(doc_code_font);
- _add_type(methods[i].return_type);
+ _add_type(methods[i].return_type, methods[i].return_enum);
//class_desc->add_text(" ");
class_desc->pop(); //align
class_desc->pop(); //font
@@ -899,7 +922,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
if (j > 0)
class_desc->add_text(", ");
- _add_type(methods[i].arguments[j].type);
+ _add_type(methods[i].arguments[j].type, methods[i].arguments[j].enumeration);
class_desc->add_text(" ");
_add_text(methods[i].arguments[j].name);
if (methods[i].arguments[j].default_value != "") {
@@ -1048,44 +1071,133 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
if (cd.constants.size()) {
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
- class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Constants:"));
- class_desc->pop();
- class_desc->pop();
- class_desc->push_indent(1);
-
- class_desc->add_newline();
- //class_desc->add_newline();
+ Map<String, Vector<DocData::ConstantDoc> > enums;
+ Vector<DocData::ConstantDoc> constants;
for (int i = 0; i < cd.constants.size(); i++) {
- constant_line[cd.constants[i].name] = class_desc->get_line_count() - 2;
- class_desc->push_font(doc_code_font);
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color"));
- _add_text(cd.constants[i].name);
+ if (cd.constants[i].enumeration != String()) {
+ if (!enums.has(cd.constants[i].enumeration)) {
+ enums[cd.constants[i].enumeration] = Vector<DocData::ConstantDoc>();
+ }
+
+ enums[cd.constants[i].enumeration].push_back(cd.constants[i]);
+ } else {
+
+ constants.push_back(cd.constants[i]);
+ }
+ }
+
+ if (enums.size()) {
+
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->push_font(doc_title_font);
+ class_desc->add_text(TTR("Enumerations:"));
class_desc->pop();
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
- class_desc->add_text(" = ");
class_desc->pop();
+ class_desc->push_indent(1);
+
+ class_desc->add_newline();
+ //class_desc->add_newline();
+
+ for (Map<String, Vector<DocData::ConstantDoc> >::Element *E = enums.front(); E; E = E->next()) {
+
+ enum_line[E->key()] = class_desc->get_line_count() - 2;
+
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->add_text(TTR("enum "));
+ class_desc->pop();
+ class_desc->push_font(doc_code_font);
+ String e = E->key();
+ if (e.get_slice_count(".")) {
+ e = e.get_slice(".", 1);
+ }
+
+ class_desc->add_text(e);
+ class_desc->pop();
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ class_desc->add_text(":");
+ class_desc->pop();
+ class_desc->add_newline();
+
+ class_desc->push_indent(1);
+ Vector<DocData::ConstantDoc> enum_list = E->get();
+
+ for (int i = 0; i < enum_list.size(); i++) {
+
+ class_desc->push_font(doc_code_font);
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color"));
+ _add_text(enum_list[i].name);
+ class_desc->pop();
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->add_text(" = ");
+ class_desc->pop();
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ _add_text(enum_list[i].value);
+ class_desc->pop();
+ class_desc->pop();
+ if (enum_list[i].description != "") {
+ class_desc->push_font(doc_font);
+ class_desc->add_text(" ");
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
+ _add_text(enum_list[i].description);
+ class_desc->pop();
+ class_desc->pop();
+ }
+
+ class_desc->add_newline();
+ }
+
+ class_desc->pop();
+
+ class_desc->add_newline();
+ }
+
+ class_desc->pop();
+ class_desc->add_newline();
+ }
+
+ if (constants.size()) {
+
class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
- _add_text(cd.constants[i].value);
+ class_desc->push_font(doc_title_font);
+ class_desc->add_text(TTR("Constants:"));
class_desc->pop();
class_desc->pop();
- if (cd.constants[i].description != "") {
- class_desc->push_font(doc_font);
- class_desc->add_text(" ");
- class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
- _add_text(cd.constants[i].description);
+ class_desc->push_indent(1);
+
+ class_desc->add_newline();
+ //class_desc->add_newline();
+
+ for (int i = 0; i < constants.size(); i++) {
+
+ constant_line[constants[i].name] = class_desc->get_line_count() - 2;
+ class_desc->push_font(doc_code_font);
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/base_type_color"));
+ _add_text(constants[i].name);
+ class_desc->pop();
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/symbol_color"));
+ class_desc->add_text(" = ");
+ class_desc->pop();
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color"));
+ _add_text(constants[i].value);
class_desc->pop();
class_desc->pop();
+ if (constants[i].description != "") {
+ class_desc->push_font(doc_font);
+ class_desc->add_text(" ");
+ class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
+ _add_text(constants[i].description);
+ class_desc->pop();
+ class_desc->pop();
+ }
+
+ class_desc->add_newline();
}
+ class_desc->pop();
class_desc->add_newline();
}
-
- class_desc->pop();
- class_desc->add_newline();
}
if (cd.description != "") {
@@ -1126,7 +1238,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
method_line[cd.properties[i].name] = class_desc->get_line_count() - 2;
class_desc->push_font(doc_code_font);
- _add_type(cd.properties[i].type);
+ _add_type(cd.properties[i].type, cd.properties[i].enumeration);
class_desc->add_text(" ");
class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
@@ -1204,7 +1316,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
method_line[methods[i].name] = class_desc->get_line_count() - 2;
class_desc->push_font(doc_code_font);
- _add_type(methods[i].return_type);
+ _add_type(methods[i].return_type, methods[i].return_enum);
class_desc->add_text(" ");
class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
@@ -1217,7 +1329,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
if (j > 0)
class_desc->add_text(", ");
- _add_type(methods[i].arguments[j].type);
+ _add_type(methods[i].arguments[j].type, methods[i].arguments[j].enumeration);
class_desc->add_text(" ");
_add_text(methods[i].arguments[j].name);
if (methods[i].arguments[j].default_value != "") {
@@ -1295,6 +1407,11 @@ void EditorHelp::_help_callback(const String &p_topic) {
if (property_line.has(name))
line = property_line[name];
+ } else if (what == "class_enum") {
+
+ print_line("go to enum:");
+ if (enum_line.has(name))
+ line = enum_line[name];
} else if (what == "class_theme_item") {
if (theme_property_line.has(name))
@@ -1743,8 +1860,20 @@ void EditorHelpBit::_go_to_help(String p_what) {
void EditorHelpBit::_meta_clicked(String p_select) {
+ print_line("got meta " + p_select);
//print_line("LINK: "+p_select);
- if (p_select.begins_with("#")) {
+ if (p_select.begins_with("$")) { //enum
+ //_goto_desc(p_select.substr(1,p_select.length()));
+ String select = p_select.substr(1, p_select.length());
+ String class_name;
+ if (select.find(".") != -1) {
+ class_name = select.get_slice(".", 0);
+ } else {
+ class_name = "@Global";
+ }
+ _go_to_help("class_enum:" + class_name + ":" + select);
+ return;
+ } else if (p_select.begins_with("#")) {
//_goto_desc(p_select.substr(1,p_select.length()));
_go_to_help("class_name:" + p_select.substr(1, p_select.length()));
return;
diff --git a/editor/editor_help.h b/editor/editor_help.h
index 6d9be3db6f..db97ab9b28 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -123,6 +123,7 @@ class EditorHelp : public VBoxContainer {
Map<String, int> property_line;
Map<String, int> theme_property_line;
Map<String, int> constant_line;
+ Map<String, int> enum_line;
int description_line;
RichTextLabel *class_desc;
@@ -141,7 +142,7 @@ class EditorHelp : public VBoxContainer {
bool scroll_locked;
//void _button_pressed(int p_idx);
- void _add_type(const String &p_type);
+ void _add_type(const String &p_type, const String &p_enum = String());
void _class_list_select(const String &p_select);
void _class_desc_select(const String &p_select);