瀏覽代碼

added help buttons to node title instead of using double click

Jonathan Higgins 7 月之前
父節點
當前提交
8a4a5a9325
共有 3 個文件被更改,包括 69 次插入21 次删除
  1. 2 1
      scenes/Nodes/node_logic.gd
  2. 43 0
      scenes/Nodes/nodes.tscn
  3. 24 20
      scenes/main/control.gd

+ 2 - 1
scenes/Nodes/node_logic.gd

@@ -13,6 +13,7 @@ func _ready() -> void:
 	var titlebar = self.get_titlebar_hbox()
 	var btn = Button.new()
 	btn.text = "?"
+	btn.tooltip_text = "Open help for " + self.title
 	btn.connect("pressed", Callable(self, "_open_help")) #pass key (process name) when button is pressed
 	titlebar.add_child(btn)
 
@@ -52,4 +53,4 @@ func _on_slider_value_changed(value: float, changed_slider: HSlider) -> void:
 				changed_slider.value = min_value + min_gap
 
 func _open_help():
-	open_help.emit(self.get_meta("command"))
+	open_help.emit(self.get_meta("command"), self.title)

+ 43 - 0
scenes/Nodes/nodes.tscn

@@ -38,6 +38,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "inputfile"
 metadata/utility = true
 
@@ -174,6 +175,7 @@ slot/12/right_type = 0
 slot/12/right_color = Color(1, 1, 1, 1)
 slot/12/right_icon = null
 slot/12/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "outputfile"
 metadata/utility = true
 
@@ -269,6 +271,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "distort_average"
 metadata/stereo_input = false
 
@@ -313,6 +316,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "clip_clip_2"
 metadata/stereo_input = true
 
@@ -357,6 +361,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "distort_reform_6"
 metadata/stereo_input = false
 
@@ -393,6 +398,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "distort_divide"
 metadata/stereo_input = false
 
@@ -446,6 +452,7 @@ slot/2/right_type = 0
 slot/2/right_color = Color(1, 1, 1, 1)
 slot/2/right_icon = null
 slot/2/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "distort_fractal"
 metadata/stereo_input = false
 
@@ -506,6 +513,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "distort_multiply"
 metadata/stereo_input = false
 
@@ -550,6 +558,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "distort_interpolate"
 metadata/stereo_input = false
 
@@ -594,6 +603,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "distort_reform_2"
 metadata/stereo_input = false
 
@@ -630,6 +640,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "distort_reform_4"
 metadata/stereo_input = false
 
@@ -666,6 +677,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "modify_radical_1"
 metadata/stereo_input = true
 
@@ -702,6 +714,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "distort_replace"
 metadata/stereo_input = false
 
@@ -747,6 +760,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "quirk_quirk_1"
 metadata/stereo_input = false
 
@@ -828,6 +842,7 @@ slot/5/right_type = 0
 slot/5/right_color = Color(1, 1, 1, 1)
 slot/5/right_icon = null
 slot/5/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "extend_drunk_1"
 metadata/stereo_input = true
 
@@ -944,6 +959,7 @@ slot/3/right_type = 0
 slot/3/right_color = Color(1, 1, 1, 1)
 slot/3/right_icon = null
 slot/3/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "extend_loop_1"
 metadata/stereo_input = true
 
@@ -1143,6 +1159,7 @@ slot/5/right_type = 0
 slot/5/right_color = Color(1, 1, 1, 1)
 slot/5/right_icon = null
 slot/5/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "shrink_shrink_1"
 metadata/stereo_input = true
 
@@ -1390,6 +1407,7 @@ slot/5/right_type = 0
 slot/5/right_color = Color(1, 1, 1, 1)
 slot/5/right_icon = null
 slot/5/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "filter_bank_1"
 metadata/stereo_input = true
 
@@ -1527,6 +1545,7 @@ slot/5/right_type = 0
 slot/5/right_color = Color(1, 1, 1, 1)
 slot/5/right_icon = null
 slot/5/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "filter_bank_2"
 metadata/stereo_input = true
 
@@ -1646,6 +1665,7 @@ slot/3/right_type = 0
 slot/3/right_color = Color(1, 1, 1, 1)
 slot/3/right_icon = null
 slot/3/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "filter_lohi_1"
 metadata/stereo_input = true
 
@@ -1785,6 +1805,7 @@ slot/6/right_type = 0
 slot/6/right_color = Color(1, 1, 1, 1)
 slot/6/right_icon = null
 slot/6/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "filter_bank_5"
 metadata/stereo_input = true
 
@@ -1942,6 +1963,7 @@ slot/6/right_type = 0
 slot/6/right_color = Color(1, 1, 1, 1)
 slot/6/right_icon = null
 slot/6/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "filter_bank_6"
 metadata/stereo_input = true
 
@@ -2055,6 +2077,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "modify_brassage_1"
 metadata/stereo_input = true
 
@@ -2101,6 +2124,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "modify_brassage_2"
 metadata/stereo_input = true
 
@@ -2157,6 +2181,7 @@ slot/2/right_type = 0
 slot/2/right_color = Color(1, 1, 1, 1)
 slot/2/right_icon = null
 slot/2/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "modify_brassage_4"
 metadata/stereo_input = true
 
@@ -2218,6 +2243,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "modify_brassage_5"
 metadata/stereo_input = true
 
@@ -2346,6 +2372,7 @@ slot/10/right_type = 0
 slot/10/right_color = Color(1, 1, 1, 1)
 slot/10/right_icon = null
 slot/10/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "modify_brassage_6"
 metadata/stereo_input = true
 
@@ -2600,6 +2627,7 @@ slot/2/right_type = 0
 slot/2/right_color = Color(1, 1, 1, 1)
 slot/2/right_icon = null
 slot/2/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "modify_speed_5"
 metadata/stereo_input = true
 
@@ -2659,6 +2687,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "modify_loudness_1"
 metadata/stereo_input = true
 
@@ -2751,6 +2780,7 @@ slot/6/right_type = 0
 slot/6/right_color = Color(1, 1, 1, 1)
 slot/6/right_icon = null
 slot/6/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "modify_stack"
 metadata/stereo_input = true
 
@@ -2858,6 +2888,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "modify_speed_2"
 metadata/stereo_input = true
 
@@ -2904,6 +2935,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "pvoc_anal_1"
 metadata/stereo_input = false
 
@@ -2940,6 +2972,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "pvoc_synth"
 metadata/stereo_input = false
 
@@ -2985,6 +3018,7 @@ slot/2/right_type = 0
 slot/2/right_color = Color(1, 1, 1, 1)
 slot/2/right_icon = null
 slot/2/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "focus_accu"
 metadata/stereo_input = false
 
@@ -3047,6 +3081,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "blur_blur"
 metadata/stereo_input = false
 
@@ -3101,6 +3136,7 @@ slot/2/right_type = 0
 slot/2/right_color = Color(1, 1, 1, 1)
 slot/2/right_icon = null
 slot/2/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "blur_chorus_5"
 metadata/stereo_input = false
 
@@ -3161,6 +3197,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "strange_invert_1"
 metadata/stereo_input = false
 
@@ -3215,6 +3252,7 @@ slot/3/right_type = 0
 slot/3/right_color = Color(1, 1, 1, 1)
 slot/3/right_icon = null
 slot/3/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "spectstr_stretch"
 metadata/stereo_input = false
 
@@ -3283,6 +3321,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "hilite_trace_1"
 metadata/stereo_input = false
 
@@ -3329,6 +3368,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "blur_scatter"
 metadata/stereo_input = false
 
@@ -3375,6 +3415,7 @@ slot/1/right_type = 0
 slot/1/right_color = Color(1, 1, 1, 1)
 slot/1/right_icon = null
 slot/1/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "spec_gain"
 metadata/stereo_input = false
 
@@ -3440,6 +3481,7 @@ slot/3/right_type = 0
 slot/3/right_color = Color(1, 1, 1, 1)
 slot/3/right_icon = null
 slot/3/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "strange_waver_1"
 metadata/stereo_input = false
 
@@ -3505,6 +3547,7 @@ slot/0/right_type = 1
 slot/0/right_color = Color(0, 0, 0, 1)
 slot/0/right_icon = null
 slot/0/draw_stylebox = true
+script = ExtResource("3_uv17x")
 metadata/command = "notes"
 metadata/utility = true
 

+ 24 - 20
scenes/main/control.gd

@@ -107,11 +107,13 @@ func new_patch():
 	var effect: GraphNode = Nodes.get_node(NodePath("inputfile")).duplicate()
 	effect.name = "inputfile"
 	get_node("GraphEdit").add_child(effect, true)
+	effect.connect("open_help", Callable(self, "show_help_for_node"))
 	effect.position_offset = Vector2(20,80)
 	
 	effect = Nodes.get_node(NodePath("outputfile")).duplicate()
 	effect.name = "outputfile"
 	get_node("GraphEdit").add_child(effect, true)
+	effect.connect("open_help", Callable(self, "show_help_for_node"))
 	effect.position_offset = Vector2((DisplayServer.screen_get_size().x - 480) / uiscale, 80)
 	_register_node_movement() #link nodes for tracking position changes for changes tracking
 	
@@ -220,27 +222,27 @@ func _input(event):
 	elif event.is_action_pressed("open_explore"):
 		open_explore()
 	
-	if event is InputEventMouseButton and event.pressed:
-		if event.button_index == MOUSE_BUTTON_LEFT and event.double_click:
-			var pos = get_viewport().get_mouse_position()
-			var clicked_node = find_graphedit_node_under(pos)
-			if clicked_node:
-				await get_tree().process_frame #wait a frame to stop nodes jumping across graph edit
-				deselect_all_nodes() #deselect nodes to avoid dragging issues
-				show_help_for_node(clicked_node.get_meta("command"), clicked_node.title)
-
-func find_graphedit_node_under(mouse_pos: Vector2) -> GraphNode:
-	#find the node that was double clicked on
-	for node in graph_edit.get_children():
-		if node is GraphNode and node.get_global_rect().has_point(mouse_pos):
-			return node
-	return null
+	#if event is InputEventMouseButton and event.pressed:
+		#if event.button_index == MOUSE_BUTTON_LEFT and event.double_click:
+			#var pos = get_viewport().get_mouse_position()
+			#var clicked_node = find_graphedit_node_under(pos)
+			#if clicked_node:
+				#await get_tree().process_frame #wait a frame to stop nodes jumping across graph edit
+				#deselect_all_nodes() #deselect nodes to avoid dragging issues
+				#show_help_for_node(clicked_node.get_meta("command"), clicked_node.title)
+#
+#func find_graphedit_node_under(mouse_pos: Vector2) -> GraphNode:
+	##find the node that was double clicked on
+	#for node in graph_edit.get_children():
+		#if node is GraphNode and node.get_global_rect().has_point(mouse_pos):
+			#return node
+	#return null
 
-func deselect_all_nodes():
-	for node in $GraphEdit.get_children():
-		if node is GraphNode:
-			node.selected = false
-			selected_nodes[node] = false
+#func deselect_all_nodes():
+	#for node in $GraphEdit.get_children():
+		#if node is GraphNode:
+			#node.selected = false
+			#selected_nodes[node] = false
 
 func show_help_for_node(node_name: String, node_title: String):
 	#check if there is already a help window open for this node and pop it up instead of making a new one
@@ -333,6 +335,7 @@ func _make_node_from_search_menu(command: String):
 	var effect: GraphNode = Nodes.get_node(NodePath(command)).duplicate()
 	effect.name = command
 	get_node("GraphEdit").add_child(effect, true)
+	effect.connect("open_help", Callable(self, "show_help_for_node"))
 	effect.set_position_offset((effect_position + graph_edit.scroll_offset) / graph_edit.zoom) #set node to current mouse position in graph edit
 	_register_inputs_in_node(effect) #link sliders for changes tracking
 	_register_node_movement() #link nodes for tracking position changes for changes tracking
@@ -357,6 +360,7 @@ func _on_button_pressed(button: Button):
 	var effect: GraphNode = Nodes.get_node(NodePath(button.name)).duplicate()
 	effect.name = button.name
 	get_node("GraphEdit").add_child(effect, true)
+	effect.connect("open_help", Callable(self, "show_help_for_node"))
 	effect.set_position_offset((effect_position + graph_edit.scroll_offset) / graph_edit.zoom) #set node to current mouse position in graph edit
 	_register_inputs_in_node(effect) #link sliders for changes tracking
 	_register_node_movement() #link nodes for tracking position changes for changes tracking