summaryrefslogtreecommitdiff
path: root/tools/editor/connections_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/connections_dialog.cpp')
-rw-r--r--tools/editor/connections_dialog.cpp148
1 files changed, 102 insertions, 46 deletions
diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp
index e927a6e441..13612c8e7a 100644
--- a/tools/editor/connections_dialog.cpp
+++ b/tools/editor/connections_dialog.cpp
@@ -632,74 +632,130 @@ void ConnectionsDialog::update_tree() {
node->get_signal_list(&node_signals);
//node_signals.sort_custom<_ConnectionsDialogMethodInfoSort>();
+ bool did_script=false;
+ StringName base = node->get_type();
- for(List<MethodInfo>::Element *E=node_signals.front();E;E=E->next()) {
-
+ while(base) {
+
+ List<MethodInfo> node_signals;
+ Ref<Texture> icon;
+ String name;
- MethodInfo &mi =E->get();
+ if (!did_script) {
- String signaldesc;
- signaldesc=mi.name+"(";
- StringArray argnames;
- if (mi.arguments.size()) {
- signaldesc+=" ";
- for(int i=0;i<mi.arguments.size();i++) {
+ Ref<Script> scr = node->get_script();
+ if (scr.is_valid()) {
+ scr->get_script_signal_list(&node_signals);
+ if (scr->get_path().is_resource_file())
+ name=scr->get_path().get_file();
+ else
+ name=scr->get_type();
- PropertyInfo &pi = mi.arguments[i];
+ if (has_icon(scr->get_type(),"EditorIcons")) {
+ icon=get_icon(scr->get_type(),"EditorIcons");
+ }
+ }
- if (i>0)
- signaldesc+=", ";
- signaldesc+=Variant::get_type_name(pi.type)+" "+(pi.name==""?String("arg "+itos(i)):pi.name);
- argnames.push_back(pi.name);
+ } else {
+ ObjectTypeDB::get_signal_list(base,&node_signals,true);
+ if (has_icon(base,"EditorIcons")) {
+ icon=get_icon(base,"EditorIcons");
}
- signaldesc+=" ";
+ name=base;
}
- signaldesc+=")";
-
- TreeItem *item=tree->create_item(root);
- item->set_text(0,signaldesc);
- Dictionary sinfo;
- sinfo["name"]=mi.name;
- sinfo["args"]=argnames;
- item->set_metadata(0,sinfo);
- item->set_icon(0,get_icon("Signal","EditorIcons"));
- List<Object::Connection> connections;
- node->get_signal_connection_list(mi.name,&connections);
+ TreeItem *pitem = NULL;
+
+ if (node_signals.size()) {
+ pitem=tree->create_item(root);
+ pitem->set_text(0,name);
+ pitem->set_icon(0,icon);
+ pitem->set_selectable(0,false);
+ pitem->set_editable(0,false);
+ pitem->set_custom_bg_color(0,get_color("prop_subsection","Editor"));
+ node_signals.sort();
+ }
- for(List<Object::Connection>::Element *F=connections.front();F;F=F->next()) {
+ for(List<MethodInfo>::Element *E=node_signals.front();E;E=E->next()) {
- Object::Connection&c = F->get();
- if (!(c.flags&CONNECT_PERSIST))
- continue;
- Node *target = c.target->cast_to<Node>();
- if (!target)
- continue;
+ MethodInfo &mi =E->get();
- String path = String(node->get_path_to(target))+" :: "+c.method+"()";
- if (c.flags&CONNECT_DEFERRED)
- path+=" (deferred)";
- if (c.binds.size()) {
+ String signaldesc;
+ signaldesc=mi.name+"(";
+ StringArray argnames;
+ if (mi.arguments.size()) {
+ signaldesc+=" ";
+ for(int i=0;i<mi.arguments.size();i++) {
- path+=" binds( ";
- for(int i=0;i<c.binds.size();i++) {
+ PropertyInfo &pi = mi.arguments[i];
if (i>0)
- path+=", ";
- path+=c.binds[i].operator String();
+ signaldesc+=", ";
+ String tname="var";
+ if (pi.type!=Variant::NIL) {
+ tname=Variant::get_type_name(pi.type);
+ }
+ signaldesc+=tname+" "+(pi.name==""?String("arg "+itos(i)):pi.name);
+ argnames.push_back(pi.name);
+
}
- path+=" )";
+ signaldesc+=" ";
}
- TreeItem *item2=tree->create_item(item);
- item2->set_text(0,path);
- item2->set_metadata(0,c);
- item2->set_icon(0,get_icon("Slot","EditorIcons"));
+ signaldesc+=")";
+
+ TreeItem *item=tree->create_item(pitem);
+ item->set_text(0,signaldesc);
+ Dictionary sinfo;
+ sinfo["name"]=mi.name;
+ sinfo["args"]=argnames;
+ item->set_metadata(0,sinfo);
+ item->set_icon(0,get_icon("Signal","EditorIcons"));
+
+ List<Object::Connection> connections;
+ node->get_signal_connection_list(mi.name,&connections);
+ for(List<Object::Connection>::Element *F=connections.front();F;F=F->next()) {
+
+ Object::Connection&c = F->get();
+ if (!(c.flags&CONNECT_PERSIST))
+ continue;
+
+ Node *target = c.target->cast_to<Node>();
+ if (!target)
+ continue;
+
+ String path = String(node->get_path_to(target))+" :: "+c.method+"()";
+ if (c.flags&CONNECT_DEFERRED)
+ path+=" (deferred)";
+ if (c.binds.size()) {
+
+ path+=" binds( ";
+ for(int i=0;i<c.binds.size();i++) {
+
+ if (i>0)
+ path+=", ";
+ path+=c.binds[i].operator String();
+ }
+ path+=" )";
+ }
+
+ TreeItem *item2=tree->create_item(item);
+ item2->set_text(0,path);
+ item2->set_metadata(0,c);
+ item2->set_icon(0,get_icon("Slot","EditorIcons"));
+
+
+ }
+ }
+ if (!did_script) {
+ did_script=true;
+ } else {
+ base=ObjectTypeDB::type_inherits_from(base);
}
}