You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
@@ -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) {
|
||||
|
||||
MethodInfo &mi =E->get();
|
||||
List<MethodInfo> node_signals;
|
||||
Ref<Texture> icon;
|
||||
String name;
|
||||
|
||||
String signaldesc;
|
||||
signaldesc=mi.name+"(";
|
||||
StringArray argnames;
|
||||
if (mi.arguments.size()) {
|
||||
signaldesc+=" ";
|
||||
for(int i=0;i<mi.arguments.size();i++) {
|
||||
if (!did_script) {
|
||||
|
||||
PropertyInfo &pi = mi.arguments[i];
|
||||
|
||||
if (i>0)
|
||||
signaldesc+=", ";
|
||||
signaldesc+=Variant::get_type_name(pi.type)+" "+(pi.name==""?String("arg "+itos(i)):pi.name);
|
||||
argnames.push_back(pi.name);
|
||||
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();
|
||||
|
||||
if (has_icon(scr->get_type(),"EditorIcons")) {
|
||||
icon=get_icon(scr->get_type(),"EditorIcons");
|
||||
}
|
||||
}
|
||||
signaldesc+=" ";
|
||||
|
||||
} else {
|
||||
|
||||
ObjectTypeDB::get_signal_list(base,&node_signals,true);
|
||||
if (has_icon(base,"EditorIcons")) {
|
||||
icon=get_icon(base,"EditorIcons");
|
||||
}
|
||||
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;
|
||||
|
||||
for(List<Object::Connection>::Element *F=connections.front();F;F=F->next()) {
|
||||
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();
|
||||
}
|
||||
|
||||
Object::Connection&c = F->get();
|
||||
if (!(c.flags&CONNECT_PERSIST))
|
||||
continue;
|
||||
for(List<MethodInfo>::Element *E=node_signals.front();E;E=E->next()) {
|
||||
|
||||
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()) {
|
||||
MethodInfo &mi =E->get();
|
||||
|
||||
path+=" binds( ";
|
||||
for(int i=0;i<c.binds.size();i++) {
|
||||
String signaldesc;
|
||||
signaldesc=mi.name+"(";
|
||||
StringArray argnames;
|
||||
if (mi.arguments.size()) {
|
||||
signaldesc+=" ";
|
||||
for(int i=0;i<mi.arguments.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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user