summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-12-09 22:07:45 +0100
committerRémi Verschelde <rverschelde@gmail.com>2017-12-09 22:54:12 +0100
commit626eebdec436b8ef232563c557175cccdf957e34 (patch)
tree412d6c6d16f9947412fa6e756da447f3c834bf9e /editor
parent75d0aeb0e9250db729ddba56570386f7c10084af (diff)
PropertyEditor: Fix display of property doc in tooltip
Diffstat (limited to 'editor')
-rw-r--r--editor/property_editor.cpp49
-rw-r--r--editor/property_selector.cpp18
2 files changed, 24 insertions, 43 deletions
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 446a0ea35d..1d709b250a 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -647,7 +647,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
}
}
- if (type)
+ if (type != Variant::NIL)
property_select->select_property_from_basic_type(type, v);
updating = false;
@@ -2802,13 +2802,12 @@ void PropertyEditor::update_tree() {
TreeItem *sep = tree->create_item(root);
current_category = sep;
String type = p.name;
- //*
+
if (has_icon(type, "EditorIcons"))
sep->set_icon(0, get_icon(type, "EditorIcons"));
else
sep->set_icon(0, get_icon("Object", "EditorIcons"));
- //*/
sep->set_text(0, type);
sep->set_expand_right(0, true);
sep->set_selectable(0, false);
@@ -2934,38 +2933,36 @@ void PropertyEditor::update_tree() {
}
if (use_doc_hints) {
- StringName setter;
- StringName type;
- if (ClassDB::get_setter_and_type_for_property(obj->get_class_name(), p.name, type, setter)) {
- String descr;
- bool found = false;
- Map<StringName, Map<StringName, String> >::Element *E = descr_cache.find(type);
- if (E) {
+ StringName classname = obj->get_class_name();
+ StringName propname = p.name;
+ String descr;
+ bool found = false;
- Map<StringName, String>::Element *F = E->get().find(setter);
- if (F) {
- found = true;
- descr = F->get();
- }
+ Map<StringName, Map<StringName, String> >::Element *E = descr_cache.find(classname);
+ if (E) {
+ Map<StringName, String>::Element *F = E->get().find(propname);
+ if (F) {
+ found = true;
+ descr = F->get();
}
- if (!found) {
+ }
- DocData *dd = EditorHelp::get_doc_data();
- Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(type);
- if (E) {
- for (int i = 0; i < E->get().methods.size(); i++) {
- if (E->get().methods[i].name == setter.operator String()) {
- descr = E->get().methods[i].description.strip_edges().word_wrap(80);
- }
+ if (!found) {
+ DocData *dd = EditorHelp::get_doc_data();
+ Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(classname);
+ if (E) {
+ for (int i = 0; i < E->get().properties.size(); i++) {
+ if (E->get().properties[i].name == propname.operator String()) {
+ descr = E->get().properties[i].description.strip_edges().word_wrap(80);
}
}
-
- descr_cache[type][setter] = descr;
}
- item->set_tooltip(0, TTR("Property:") + " " + p.name + "\n\n" + descr);
+ descr_cache[classname][propname] = descr;
}
+
+ item->set_tooltip(0, TTR("Property:") + " " + p.name + "\n\n" + descr);
}
Dictionary d;
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 86de7c56e1..77b73e4635 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -363,23 +363,6 @@ void PropertySelector::_item_selected() {
at_class = ClassDB::get_parent_class(at_class);
}
-
- if (text == String()) {
-
- StringName setter;
- StringName type;
- if (ClassDB::get_setter_and_type_for_property(class_type, name, type, setter)) {
- Map<String, DocData::ClassDoc>::Element *E = dd->class_list.find(type);
- if (E) {
- for (int i = 0; i < E->get().methods.size(); i++) {
- if (E->get().methods[i].name == setter.operator String()) {
- text = E->get().methods[i].description;
- }
- }
- }
- }
- }
-
} else {
String at_class = class_type;
@@ -516,6 +499,7 @@ void PropertySelector::select_property_from_script(const Ref<Script> &p_script,
search_box->grab_focus();
_update_search();
}
+
void PropertySelector::select_property_from_basic_type(Variant::Type p_type, const String &p_current) {
ERR_FAIL_COND(p_type == Variant::NIL);