浏览代码

added checks for validating thread with bypassed nodes

Jonathan Higgins 3 周之前
父节点
当前提交
17bc67c171
共有 1 个文件被更改,包括 16 次插入2 次删除
  1. 16 2
      scenes/main/scripts/run_thread.gd

+ 16 - 2
scenes/main/scripts/run_thread.gd

@@ -68,7 +68,7 @@ func run_thread_with_branches():
 	var is_valid = path_exists_through_all_nodes()
 	var is_valid = path_exists_through_all_nodes()
 	if is_valid == false:
 	if is_valid == false:
 		log_console("[color=#9c2828][b]Error: Valid Thread not found[/b][/color]", true)
 		log_console("[color=#9c2828][b]Error: Valid Thread not found[/b][/color]", true)
-		log_console("Threads must contain at least one processing node and a valid path from the Input File or Synthesis node to the Output File.", true)
+		log_console("Threads must contain at least one non-bypassed processing node and a valid path from the Input File or Synthesis node to the Output File.", true)
 		await get_tree().process_frame  # Let UI update
 		await get_tree().process_frame  # Let UI update
 		if progress_window.visible:
 		if progress_window.visible:
 			progress_window.hide()
 			progress_window.hide()
@@ -1375,7 +1375,8 @@ func path_exists_through_all_nodes() -> bool:
 			if current == output_node_name:
 			if current == output_node_name:
 				# Candidate path found; validate multi-inlets
 				# Candidate path found; validate multi-inlets
 				if validate_path_inlets(path, graph, input_node_names):
 				if validate_path_inlets(path, graph, input_node_names):
-					return true  # fully valid path found
+					if validate_bypass(path):
+						return true  # fully valid path found
 
 
 			for neighbor in graph.get(current, []):
 			for neighbor in graph.get(current, []):
 				if neighbor in path:
 				if neighbor in path:
@@ -1425,6 +1426,19 @@ func path_has_input(current: String, graph: Dictionary, input_node_names: Array,
 				return true
 				return true
 	return false
 	return false
 
 
+func validate_bypass(path: Array) -> bool:
+	for node in path:
+		print(node)
+		var child = graph_edit.get_node(node)
+		print(child)
+		if child.get_meta("command") == "inputfile" or child.get_meta("command") == "outputfile":
+			continue
+		if child.has_meta("bypassed") and child.get_meta("bypassed"):
+			continue
+		else:
+			return true
+	return false
+
 #func path_exists_through_all_nodes() -> bool:
 #func path_exists_through_all_nodes() -> bool:
 	#var graph = {}
 	#var graph = {}
 	#var input_node_names = []
 	#var input_node_names = []