瀏覽代碼

Fix Error when connecting signal with unbinds not yet existing function

When a Signal with unbinds was connected to a non-existing function, the connection attempt was made before the function was created.

I moved the creation of the function in front of the connection attempt.
Squamto 7 月之前
父節點
當前提交
096f0288ba
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      editor/scene/connections_dialog.cpp

+ 7 - 7
editor/scene/connections_dialog.cpp

@@ -1001,13 +1001,6 @@ void ConnectionsDock::_make_or_edit_connection() {
 		}
 	}
 
-	if (connect_dialog->is_editing()) {
-		_disconnect(connect_dialog->get_source_connection_data());
-		_connect(cd);
-	} else {
-		_connect(cd);
-	}
-
 	if (add_script_function_request) {
 		PackedStringArray script_function_args = connect_dialog->get_signal_args();
 		script_function_args.resize(script_function_args.size() - cd.unbinds);
@@ -1057,6 +1050,13 @@ void ConnectionsDock::_make_or_edit_connection() {
 		EditorNode::get_singleton()->emit_signal(SNAME("script_add_function_request"), target, cd.method, script_function_args);
 	}
 
+	if (connect_dialog->is_editing()) {
+		_disconnect(connect_dialog->get_source_connection_data());
+		_connect(cd);
+	} else {
+		_connect(cd);
+	}
+
 	update_tree();
 }