Make property description in the animation editor actually show it
(cherry picked from commit bea868f750
)
This commit is contained in:
parent
1785d3e030
commit
f20a2d3da7
|
@ -344,54 +344,64 @@ void PropertySelector::_item_selected() {
|
||||||
String class_type;
|
String class_type;
|
||||||
if (type != Variant::NIL) {
|
if (type != Variant::NIL) {
|
||||||
class_type = Variant::get_type_name(type);
|
class_type = Variant::get_type_name(type);
|
||||||
|
} else if (base_type != String()) {
|
||||||
} else {
|
|
||||||
class_type = base_type;
|
class_type = base_type;
|
||||||
|
} else if (instance) {
|
||||||
|
class_type = instance->get_class();
|
||||||
}
|
}
|
||||||
|
|
||||||
DocData *dd = EditorHelp::get_doc_data();
|
DocData *dd = EditorHelp::get_doc_data();
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
if (properties) {
|
if (properties) {
|
||||||
|
while (class_type != String()) {
|
||||||
String at_class = class_type;
|
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(class_type);
|
||||||
|
|
||||||
while (at_class != String()) {
|
|
||||||
|
|
||||||
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(at_class);
|
|
||||||
if (E) {
|
if (E) {
|
||||||
for (int i = 0; i < E->get().properties.size(); i++) {
|
for (int i = 0; i < E->get().properties.size(); i++) {
|
||||||
if (E->get().properties[i].name == name) {
|
if (E->get().properties[i].name == name) {
|
||||||
text = E->get().properties[i].description;
|
text = E->get().properties[i].description;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
at_class = ClassDB::get_parent_class(at_class);
|
if (text != String()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The property may be from a parent class, keep looking.
|
||||||
|
class_type = ClassDB::get_parent_class(class_type);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
while (class_type != String()) {
|
||||||
String at_class = class_type;
|
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(class_type);
|
||||||
|
|
||||||
while (at_class != String()) {
|
|
||||||
|
|
||||||
Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(at_class);
|
|
||||||
if (E) {
|
if (E) {
|
||||||
for (int i = 0; i < E->get().methods.size(); i++) {
|
for (int i = 0; i < E->get().methods.size(); i++) {
|
||||||
if (E->get().methods[i].name == name) {
|
if (E->get().methods[i].name == name) {
|
||||||
text = E->get().methods[i].description;
|
text = E->get().methods[i].description;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
at_class = ClassDB::get_parent_class(at_class);
|
if (text != String()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The method may be from a parent class, keep looking.
|
||||||
|
class_type = ClassDB::get_parent_class(class_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text == String())
|
if (text != String()) {
|
||||||
return;
|
// Display both property name and description, since the help bit may be displayed
|
||||||
|
// far away from the location (especially if the dialog was resized to be taller).
|
||||||
help_bit->set_text(text);
|
help_bit->set_text(vformat("[b]%s[/b]: %s", name, text));
|
||||||
|
help_bit->get_rich_text()->set_self_modulate(Color(1, 1, 1, 1));
|
||||||
|
} else {
|
||||||
|
// Use nested `vformat()` as translators shouldn't interfere with BBCode tags.
|
||||||
|
help_bit->set_text(vformat(TTR("No description available for %s."), vformat("[b]%s[/b]", name)));
|
||||||
|
help_bit->get_rich_text()->set_self_modulate(Color(1, 1, 1, 0.5));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertySelector::_notification(int p_what) {
|
void PropertySelector::_notification(int p_what) {
|
||||||
|
|
Loading…
Reference in New Issue