|
@@ -41,6 +41,7 @@
|
|
|
#include "editor_node.h"
|
|
|
#include "multi_node_edit.h"
|
|
|
#include "array_property_edit.h"
|
|
|
+#include "editor_help.h"
|
|
|
|
|
|
void CustomPropertyEditor::_notification(int p_what) {
|
|
|
|
|
@@ -2214,6 +2215,23 @@ void PropertyEditor::update_tree() {
|
|
|
sep->set_selectable(1,false);
|
|
|
sep->set_custom_bg_color(0,get_color("prop_category","Editor"));
|
|
|
sep->set_custom_bg_color(1,get_color("prop_category","Editor"));
|
|
|
+
|
|
|
+ if (use_doc_hints) {
|
|
|
+ StringName type=p.name;
|
|
|
+ if (!class_descr_cache.has(type)) {
|
|
|
+
|
|
|
+ String descr;
|
|
|
+ DocData *dd=EditorHelp::get_doc_data();
|
|
|
+ Map<String,DocData::ClassDoc>::Element *E=dd->class_list.find(type);
|
|
|
+ if (E) {
|
|
|
+ descr=E->get().brief_description;
|
|
|
+ }
|
|
|
+ class_descr_cache[type]=descr.world_wrap(80);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ sep->set_tooltip(0,"Class: "+p.name+":\n\n"+class_descr_cache[type]);
|
|
|
+ }
|
|
|
//sep->set_custom_color(0,Color(1,1,1));
|
|
|
|
|
|
|
|
@@ -2267,6 +2285,42 @@ void PropertyEditor::update_tree() {
|
|
|
|
|
|
item->set_tooltip(0, p.name);
|
|
|
|
|
|
+ if (use_doc_hints) {
|
|
|
+ StringName setter;
|
|
|
+ StringName type;
|
|
|
+ if (ObjectTypeDB::get_setter_and_type_for_property(obj->get_type_name(),p.name,type,setter)) {
|
|
|
+
|
|
|
+ String descr;
|
|
|
+ bool found=false;
|
|
|
+ Map<StringName,Map<StringName,String> >::Element *E=descr_cache.find(type);
|
|
|
+ if (E) {
|
|
|
+
|
|
|
+ Map<StringName,String>::Element *F=E->get().find(setter);
|
|
|
+ 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().world_wrap(80);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ descr_cache[type][setter]=descr;
|
|
|
+ }
|
|
|
+
|
|
|
+ item->set_tooltip(0, "Property: "+p.name+"\n\n"+descr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //EditorHelp::get_doc_data();
|
|
|
+
|
|
|
Dictionary d;
|
|
|
d["name"]=p.name;
|
|
|
d["type"]=(int)p.type;
|
|
@@ -3277,6 +3331,7 @@ PropertyEditor::PropertyEditor() {
|
|
|
read_only=false;
|
|
|
show_categories=false;
|
|
|
refresh_countdown=0;
|
|
|
+ use_doc_hints=false;
|
|
|
|
|
|
}
|
|
|
|