|
@@ -119,6 +119,9 @@ void ConnectDialog::ok_pressed() {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
Node *target = tree->get_selected();
|
|
Node *target = tree->get_selected();
|
|
|
|
+ if (!target) {
|
|
|
|
+ return; // Nothing selected in the tree, not an error.
|
|
|
|
+ }
|
|
if (target->get_script().is_null()) {
|
|
if (target->get_script().is_null()) {
|
|
if (!target->has_method(dst_method->get_text())) {
|
|
if (!target->has_method(dst_method->get_text())) {
|
|
error->set_text(TTR("Target method not found. Specify a valid method or attach a script to the target node."));
|
|
error->set_text(TTR("Target method not found. Specify a valid method or attach a script to the target node."));
|
|
@@ -149,16 +152,6 @@ void ConnectDialog::_tree_node_selected() {
|
|
_update_ok_enabled();
|
|
_update_ok_enabled();
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * Called each time a target node is activated within the target node tree.
|
|
|
|
- */
|
|
|
|
-void ConnectDialog::_tree_item_activated() {
|
|
|
|
-
|
|
|
|
- if (!get_ok()->is_disabled()) {
|
|
|
|
- get_ok()->emit_signal("pressed");
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* Adds a new parameter bind to connection.
|
|
* Adds a new parameter bind to connection.
|
|
*/
|
|
*/
|
|
@@ -243,7 +236,6 @@ void ConnectDialog::_bind_methods() {
|
|
ClassDB::bind_method("_advanced_pressed", &ConnectDialog::_advanced_pressed);
|
|
ClassDB::bind_method("_advanced_pressed", &ConnectDialog::_advanced_pressed);
|
|
ClassDB::bind_method("_cancel", &ConnectDialog::_cancel_pressed);
|
|
ClassDB::bind_method("_cancel", &ConnectDialog::_cancel_pressed);
|
|
ClassDB::bind_method("_tree_node_selected", &ConnectDialog::_tree_node_selected);
|
|
ClassDB::bind_method("_tree_node_selected", &ConnectDialog::_tree_node_selected);
|
|
- ClassDB::bind_method("_tree_item_activated", &ConnectDialog::_tree_item_activated);
|
|
|
|
ClassDB::bind_method("_add_bind", &ConnectDialog::_add_bind);
|
|
ClassDB::bind_method("_add_bind", &ConnectDialog::_add_bind);
|
|
ClassDB::bind_method("_remove_bind", &ConnectDialog::_remove_bind);
|
|
ClassDB::bind_method("_remove_bind", &ConnectDialog::_remove_bind);
|
|
ClassDB::bind_method("_update_ok_enabled", &ConnectDialog::_update_ok_enabled);
|
|
ClassDB::bind_method("_update_ok_enabled", &ConnectDialog::_update_ok_enabled);
|
|
@@ -397,7 +389,7 @@ ConnectDialog::ConnectDialog() {
|
|
|
|
|
|
tree = memnew(SceneTreeEditor(false));
|
|
tree = memnew(SceneTreeEditor(false));
|
|
tree->set_connecting_signal(true);
|
|
tree->set_connecting_signal(true);
|
|
- tree->get_scene_tree()->connect("item_activated", this, "_tree_item_activated");
|
|
|
|
|
|
+ tree->get_scene_tree()->connect("item_activated", this, "_ok");
|
|
tree->connect("node_selected", this, "_tree_node_selected");
|
|
tree->connect("node_selected", this, "_tree_node_selected");
|
|
tree->set_connect_to_script_mode(true);
|
|
tree->set_connect_to_script_mode(true);
|
|
|
|
|