summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2021-12-02 22:38:49 +0300
committerYuri Sizov <yuris@humnom.net>2021-12-03 17:47:22 +0300
commitb3992f7e6edb76a1d7e757efcab79a50425972f7 (patch)
treeed4c7943070cca3db08cd3be49b818fa35ead2f5 /editor
parentaaabc0abcc139a8212c400756016596281ef09c5 (diff)
Make overridden properties link to parent definition
Co-authored-by: Josh DeGraw <joshmdegraw@gmail.com>
Diffstat (limited to 'editor')
-rw-r--r--editor/doc_tools.cpp12
-rw-r--r--editor/editor_help.cpp39
2 files changed, 41 insertions, 10 deletions
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index f2b08a574f..f1d427648a 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -341,11 +341,17 @@ void DocTools::generate(bool p_basic_types) {
}
DocData::PropertyDoc prop;
-
prop.name = E.name;
-
prop.overridden = inherited;
+ if (inherited) {
+ String parent = ClassDB::get_parent_class(c.name);
+ while (!ClassDB::has_property(parent, prop.name, true)) {
+ parent = ClassDB::get_parent_class(parent);
+ }
+ prop.overrides = parent;
+ }
+
bool default_value_valid = false;
Variant default_value;
@@ -1357,7 +1363,7 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
const DocData::PropertyDoc &p = c.properties[i];
if (c.properties[i].overridden) {
- _write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\" override=\"true\"" + additional_attributes + " />");
+ _write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\" overrides=\"" + p.overrides + "\"" + additional_attributes + " />");
} else {
_write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\"" + additional_attributes + ">");
_write_string(f, 3, p.description.strip_edges().xml_escape());
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 4082dcefbc..c95b1c753e 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -673,7 +673,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
class_desc->push_font(doc_code_font);
class_desc->push_indent(1);
- class_desc->push_table(2);
+ class_desc->push_table(4);
class_desc->set_table_column_expand(1, true);
for (int i = 0; i < cd.properties.size(); i++) {
@@ -683,13 +683,14 @@ void EditorHelp::_update_doc() {
}
property_line[cd.properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
+ // Property type.
class_desc->push_cell();
class_desc->push_paragraph(RichTextLabel::ALIGN_RIGHT, Control::TEXT_DIRECTION_AUTO, "");
class_desc->push_font(doc_code_font);
_add_type(cd.properties[i].type, cd.properties[i].enumeration);
class_desc->pop();
class_desc->pop();
- class_desc->pop();
+ class_desc->pop(); // cell
bool describe = false;
@@ -710,6 +711,7 @@ void EditorHelp::_update_doc() {
describe = false;
}
+ // Property name.
class_desc->push_cell();
class_desc->push_font(doc_code_font);
class_desc->push_color(headline_color);
@@ -725,18 +727,43 @@ void EditorHelp::_update_doc() {
property_descr = true;
}
+ class_desc->pop();
+ class_desc->pop();
+ class_desc->pop(); // cell
+
+ // Property value.
+ class_desc->push_cell();
+ class_desc->push_font(doc_code_font);
+
if (cd.properties[i].default_value != "") {
class_desc->push_color(symbol_color);
- class_desc->add_text(cd.properties[i].overridden ? " [" + TTR("override:") + " " : " [" + TTR("default:") + " ");
+ if (cd.properties[i].overridden) {
+ class_desc->add_text(" [");
+ class_desc->push_meta("@member " + cd.properties[i].overrides + "." + cd.properties[i].name);
+ _add_text(vformat(TTR("overrides %s:"), cd.properties[i].overrides));
+ class_desc->pop();
+ class_desc->add_text(" ");
+ } else {
+ class_desc->add_text(" [" + TTR("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(); // cell
+
+ // Property setters and getters.
+ class_desc->push_cell();
+ class_desc->push_font(doc_code_font);
+
if (cd.is_script_doc && (cd.properties[i].setter != "" || cd.properties[i].getter != "")) {
class_desc->push_color(symbol_color);
class_desc->add_text(" [" + TTR("property:") + " ");
@@ -764,12 +791,10 @@ void EditorHelp::_update_doc() {
}
class_desc->pop();
- class_desc->pop();
-
- class_desc->pop();
+ class_desc->pop(); // cell
}
- class_desc->pop(); //table
+ class_desc->pop(); // table
class_desc->pop();
class_desc->pop(); // font
class_desc->add_newline();