فهرست منبع

added search functionality to the explore menu

Jonathan Higgins 7 ماه پیش
والد
کامیت
2f3e85ccbc
3فایلهای تغییر یافته به همراه104 افزوده شده و 54 حذف شده
  1. 5 5
      scenes/main/process_help.json
  2. 75 42
      scenes/menu/explore_menu.gd
  3. 24 7
      scenes/menu/menu.tscn

+ 5 - 5
scenes/main/process_help.json

@@ -405,7 +405,7 @@
 		"uitype": "hslider"
 		"uitype": "hslider"
 	  }
 	  }
 	},
 	},
-	"short_description": "Wanders through a sound file jumping forwards and backwards while repeating small segments",
+	"short_description": "Random stumbling walk through a sound",
 	"description": "Starting at the Location in the input file this process takes a segment and repeats it. When the next clock tick occurs, the process will step to another segment and start repeating that. The distance in the file that each step can be is set by the Maximum Step and the amount of the file that it is possible for the process to explore either side of the original Location is set by the Ambitus. \n"
 	"description": "Starting at the Location in the input file this process takes a segment and repeats it. When the next clock tick occurs, the process will step to another segment and start repeating that. The distance in the file that each step can be is set by the Maximum Step and the amount of the file that it is possible for the process to explore either side of the original Location is set by the Ambitus. \n"
   },
   },
   "extend_loop_1": {
   "extend_loop_1": {
@@ -670,7 +670,7 @@
 		"uitype": "hslider"
 		"uitype": "hslider"
 	  }
 	  }
 	},
 	},
-	"short_description": "Bank of filters tuned to the harmonic series",
+	"short_description": "Filter bank tuned to the harmonic series",
 	"description": "This process takes the frequency of the lowest band and create filters up to the value of the highest band tuned to the harmonic series. Scatter applies some randomisation of these values moving the sound from something very harmonic to something more bell like in tone. The makeup gain provides a way of adding a boost to the filtered signal, you may need to adjust this if clipping occurs. Note, Q can be automated although doing this does sometimes produce temperamental results.\n"
 	"description": "This process takes the frequency of the lowest band and create filters up to the value of the highest band tuned to the harmonic series. Scatter applies some randomisation of these values moving the sound from something very harmonic to something more bell like in tone. The makeup gain provides a way of adding a boost to the filtered signal, you may need to adjust this if clipping occurs. Note, Q can be automated although doing this does sometimes produce temperamental results.\n"
   },
   },
   "filter_bank_2": {
   "filter_bank_2": {
@@ -755,7 +755,7 @@
 		"uitype": "hslider"
 		"uitype": "hslider"
 	  }
 	  }
 	},
 	},
-	"short_description": "Bank of filters tuned to odd harmonics from the harmonic series",
+	"short_description": "Filter bank tuned to odd harmonics from the harmonic series",
 	"description": "This process takes the frequency of the lowest band and create filters up to the value of the highest band tuned to odd harmonics of the harmonic series. Scatter applies some randomisation of these values moving the sound from something very harmonic to something more bell like in tone. The makeup gain provides a way of adding a boost to the filtered signal, you may need to adjust this if clipping occurs. Note, Q can be automated although doing this does sometimes produce temperamental results.\n"
 	"description": "This process takes the frequency of the lowest band and create filters up to the value of the highest band tuned to odd harmonics of the harmonic series. Scatter applies some randomisation of these values moving the sound from something very harmonic to something more bell like in tone. The makeup gain provides a way of adding a boost to the filtered signal, you may need to adjust this if clipping occurs. Note, Q can be automated although doing this does sometimes produce temperamental results.\n"
   },
   },
   "filter_bank_5": {
   "filter_bank_5": {
@@ -855,7 +855,7 @@
 		"uitype": "hslider"
 		"uitype": "hslider"
 	  }
 	  }
 	},
 	},
-	"short_description": "Bank of filters with a fixed number of bands spaced linearly between two frequencies",
+	"short_description": "Filter bank with equal spacing in Hz",
 	"description": "This process takes the number of filters and spaces them equally in Hz between the lowest and highest bands. Scatter applies some randomisation of these values. The makeup gain provides a way of adding a boost to the filtered signal, you may need to adjust this if clipping occurs. Note, Q can be automated although doing this does sometimes produce temperamental results. Unlike Filter Bank: Pitched Intervals this will produce a more discordant sound as the frequencies will not align to uniform harmonic intervals.\n"
 	"description": "This process takes the number of filters and spaces them equally in Hz between the lowest and highest bands. Scatter applies some randomisation of these values. The makeup gain provides a way of adding a boost to the filtered signal, you may need to adjust this if clipping occurs. Note, Q can be automated although doing this does sometimes produce temperamental results. Unlike Filter Bank: Pitched Intervals this will produce a more discordant sound as the frequencies will not align to uniform harmonic intervals.\n"
   },
   },
   "filter_bank_6": {
   "filter_bank_6": {
@@ -955,7 +955,7 @@
 		"uitype": "hslider"
 		"uitype": "hslider"
 	  }
 	  }
 	},
 	},
-	"short_description": "Bank of filters with a fixed number of bands spaced musically between two frequencies",
+	"short_description": "Filter bank with equal spacing in semitones",
 	"description": "This process takes the number of filters and spaces them equally in semitones between the lowest and highest bands. Scatter applies some randomisation of these values moving the sound from something very harmonic to something more bell like in tone. The makeup gain provides a way of adding a boost to the filtered signal, you may need to adjust this if clipping occurs. Note, Q can be automated although doing this does sometimes produce temperamental results. Unlike Filter Bank: Linear this will produce a more consonant sound as the frequencies will align to uniform harmonic intervals.\n"
 	"description": "This process takes the number of filters and spaces them equally in semitones between the lowest and highest bands. Scatter applies some randomisation of these values moving the sound from something very harmonic to something more bell like in tone. The makeup gain provides a way of adding a boost to the filtered signal, you may need to adjust this if clipping occurs. Note, Q can be automated although doing this does sometimes produce temperamental results. Unlike Filter Bank: Linear this will produce a more consonant sound as the frequencies will align to uniform harmonic intervals.\n"
   },
   },
   "filter_lohi_1": {
   "filter_lohi_1": {

+ 75 - 42
scenes/menu/explore_menu.gd

@@ -6,6 +6,10 @@ signal open_help(command)
 
 
 
 
 func _ready() -> void:
 func _ready() -> void:
+	
+	$"Control/select_effect/Time Domain".show()
+	$"Control/select_effect/Time Domain/Distort".show()
+	$"Control/select_effect/Frequency Domain/Convert".show()
 	#parse json
 	#parse json
 	var file = FileAccess.open("res://scenes/main/process_help.json", FileAccess.READ)
 	var file = FileAccess.open("res://scenes/main/process_help.json", FileAccess.READ)
 	if file:
 	if file:
@@ -93,52 +97,76 @@ func fill_menu():
 
 
 
 
 func _on_about_to_popup() -> void:
 func _on_about_to_popup() -> void:
-	fill_menu() #populate menu when needed
+	fill_search("")
+	$"Control/select_effect/Search/Search for a process in SoundThread/MarginContainer/VBoxContainer/SearchBar".clear()
+	if $Control/select_effect.current_tab == 3:
+		$"Control/select_effect/Search/Search for a process in SoundThread/MarginContainer/VBoxContainer/SearchBar".grab_focus()
+	
 
 
 
 
-#func display_items(filter: String):
-	## Remove all existing items from the VBoxContainer
-	##for child in item_container.get_children():
-		##child.queue_free()
-	#for key in node_data.keys():
-		#var item = node_data[key]
-		#var title = item.get("title", "")
-		#
-		##filter out input and output nodes
-		#if title == "Input File" or title == "Output File":
-			#continue
-		#
-		#var category = item.get("category", "")
-		#var subcategory = item.get("subcategory", "")
-		#var short_desc = item.get("short_description", "")
-		#
-		## If filter is not empty, skip non-matches populate all other buttons
-		#if filter != "":
-			#var filter_lc = filter.to_lower()
-			#if not (filter_lc in title.to_lower() or filter_lc in short_desc.to_lower() or filter_lc in category.to_lower() or filter_lc in subcategory.to_lower()):
-				#continue
-		#
-		#var btn = Button.new()
-		#btn.size_flags_horizontal = Control.SIZE_EXPAND_FILL #make buttons wide
-		#btn.alignment = 0 #left align text
-		#btn.clip_text = true #clip off labels that are too long
-		#btn.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS #and replace with ...
-		#if category.to_lower() == "pvoc": #format node names correctly, only show the category for PVOC
-			#btn.text = "%s %s: %s - %s" % [category.to_upper(), subcategory.to_pascal_case(), title, short_desc]
-		#else:
-			#btn.text = "%s: %s - %s" % [subcategory.to_pascal_case(), title, short_desc]
-		#btn.connect("pressed", Callable(self, "_on_item_selected").bind(key)) #pass key (process name) when button is pressed
-		#item_container.add_child(btn)
-	#
-	##resize menu within certain bounds #50
-	#await get_tree().process_frame
-	#if DisplayServer.screen_get_scale() > 1:
-		#self.size.y = min((item_container.size.y * DisplayServer.screen_get_scale()) + search_bar.size.y + 50, 410 * DisplayServer.screen_get_scale()) #i think this will scale for retina screens but might be wrong
-	#else:
-		#self.size.y = min(item_container.size.y + search_bar.size.y + 12, 410)
+
+func fill_search(filter: String):
+	# Remove all existing items from the VBoxContainer
+	var container = $"Control/select_effect/Search/Search for a process in SoundThread/MarginContainer/VBoxContainer/ScrollContainer/ItemContainer"
+	for child in container.get_children():
+		child.queue_free()
+	for key in node_data.keys():
+		var item = node_data[key]
+		var title = item.get("title", "")
+		
+		#filter out input and output nodes
+		if title == "Input File" or title == "Output File":
+			continue
+		
+		var category = item.get("category", "")
+		var subcategory = item.get("subcategory", "")
+		var short_desc = item.get("short_description", "")
+		
+		# If filter is not empty, skip non-matches populate all other buttons
+		if filter != "":
+			var filter_lc = filter.to_lower()
+			if not (filter_lc in title.to_lower() or filter_lc in short_desc.to_lower() or filter_lc in category.to_lower() or filter_lc in subcategory.to_lower()):
+				continue
+		
+		
+		var hbox = HBoxContainer.new()
+		var label = RichTextLabel.new()
+		var helpbtn = Button.new()
+		var makebtn = Button.new()
+		var margin = MarginContainer.new()
+		
+		hbox.size.x = container.size.x
+		label.bbcode_enabled = true
+		label.text = "[b]%s[/b]\n%s" % [title, short_desc]
+		label.set_h_size_flags(Control.SIZE_EXPAND_FILL)
+		label.set_v_size_flags(Control.SIZE_EXPAND_FILL)
+		label.fit_content = true
+		
+		helpbtn.text = "?"
+		helpbtn.tooltip_text = "Open help for " + title
+		helpbtn.custom_minimum_size = Vector2(40, 40)
+		helpbtn.set_h_size_flags(Control.SIZE_SHRINK_CENTER)
+		helpbtn.connect("pressed", Callable(self, "_open_help").bind(key, title)) #pass key (process name) when button is pressed
+		
+		makebtn.text = "+"
+		makebtn.tooltip_text = "Add " + title + " to thread"
+		makebtn.custom_minimum_size = Vector2(40, 40)
+		makebtn.set_h_size_flags(Control.SIZE_SHRINK_CENTER)
+		makebtn.connect("pressed", Callable(self, "_make_node").bind(key)) #pass key (process name) when button is pressed
+		
+		margin.add_theme_constant_override("margin_bottom", 3)
+		
+		container.add_child(hbox)
+		hbox.add_child(label)
+		hbox.add_child(helpbtn)
+		hbox.add_child(makebtn)
+		container.add_child(margin)
+
+	
+
 	
 	
 func _on_search_bar_text_changed(new_text: String) -> void:
 func _on_search_bar_text_changed(new_text: String) -> void:
-	#display_items(new_text)
+	fill_search(new_text)
 	pass
 	pass
 	
 	
 func _make_node(key: String):
 func _make_node(key: String):
@@ -148,3 +176,8 @@ func _make_node(key: String):
 func _open_help(key: String, title: String):
 func _open_help(key: String, title: String):
 	open_help.emit(key, title) # send out signal to main patch
 	open_help.emit(key, title) # send out signal to main patch
 	self.hide()
 	self.hide()
+
+
+func _on_select_effect_tab_changed(tab: int) -> void:
+	if tab == 3:
+		$"Control/select_effect/Search/Search for a process in SoundThread/MarginContainer/VBoxContainer/SearchBar".grab_focus()

+ 24 - 7
scenes/menu/menu.tscn

@@ -31,7 +31,7 @@ offset_right = 325.0
 offset_bottom = 250.0
 offset_bottom = 250.0
 grow_horizontal = 2
 grow_horizontal = 2
 grow_vertical = 2
 grow_vertical = 2
-current_tab = 2
+current_tab = 3
 
 
 [node name="Time Domain" type="TabContainer" parent="Control/select_effect"]
 [node name="Time Domain" type="TabContainer" parent="Control/select_effect"]
 visible = false
 visible = false
@@ -256,7 +256,7 @@ layout_mode = 2
 custom_minimum_size = Vector2(620, 0)
 custom_minimum_size = Vector2(620, 0)
 layout_mode = 2
 layout_mode = 2
 size_flags_horizontal = 4
 size_flags_horizontal = 4
-text = "These processes operate on frequency domain analysis data and allow for transformations that are often impossible in the time domain. Of all the processes available in CDP these can often have the largest transformative impact on a sound."
+text = "These processes operate on frequency domain analysis data and allow for transformations that are often impossible in the time domain. Of all the processes available in the Composers Desktop Project these can often have the largest transformative impact on a sound."
 autowrap_mode = 3
 autowrap_mode = 3
 
 
 [node name="MarginContainer4" type="MarginContainer" parent="Control/select_effect/Frequency Domain/Process/MarginContainer/ScrollContainer/PVOCProcessContainer"]
 [node name="MarginContainer4" type="MarginContainer" parent="Control/select_effect/Frequency Domain/Process/MarginContainer/ScrollContainer/PVOCProcessContainer"]
@@ -264,6 +264,7 @@ layout_mode = 2
 theme_override_constants/margin_bottom = 5
 theme_override_constants/margin_bottom = 5
 
 
 [node name="Utilities" type="TabContainer" parent="Control/select_effect"]
 [node name="Utilities" type="TabContainer" parent="Control/select_effect"]
+visible = false
 layout_mode = 2
 layout_mode = 2
 current_tab = 0
 current_tab = 0
 metadata/_tab_index = 2
 metadata/_tab_index = 2
@@ -301,7 +302,6 @@ layout_mode = 2
 theme_override_constants/margin_bottom = 5
 theme_override_constants/margin_bottom = 5
 
 
 [node name="Search" type="TabContainer" parent="Control/select_effect"]
 [node name="Search" type="TabContainer" parent="Control/select_effect"]
-visible = false
 layout_mode = 2
 layout_mode = 2
 current_tab = 0
 current_tab = 0
 metadata/_tab_index = 3
 metadata/_tab_index = 3
@@ -317,12 +317,29 @@ theme_override_constants/margin_top = 10
 theme_override_constants/margin_right = 5
 theme_override_constants/margin_right = 5
 theme_override_constants/margin_bottom = 10
 theme_override_constants/margin_bottom = 10
 
 
-[node name="ScrollContainer" type="ScrollContainer" parent="Control/select_effect/Search/Search for a process in SoundThread/MarginContainer"]
-custom_minimum_size = Vector2(620, 425)
+[node name="VBoxContainer" type="VBoxContainer" parent="Control/select_effect/Search/Search for a process in SoundThread/MarginContainer"]
+custom_minimum_size = Vector2(620, 420)
 layout_mode = 2
 layout_mode = 2
 size_flags_horizontal = 0
 size_flags_horizontal = 0
+
+[node name="SearchBar" type="LineEdit" parent="Control/select_effect/Search/Search for a process in SoundThread/MarginContainer/VBoxContainer"]
+layout_mode = 2
+placeholder_text = "Type to search"
+
+[node name="MarginContainer4" type="MarginContainer" parent="Control/select_effect/Search/Search for a process in SoundThread/MarginContainer/VBoxContainer"]
+layout_mode = 2
+theme_override_constants/margin_bottom = 5
+
+[node name="ScrollContainer" type="ScrollContainer" parent="Control/select_effect/Search/Search for a process in SoundThread/MarginContainer/VBoxContainer"]
+custom_minimum_size = Vector2(0, 10)
+layout_mode = 2
+size_flags_vertical = 3
 horizontal_scroll_mode = 0
 horizontal_scroll_mode = 0
 
 
-[node name="SearchContainer" type="VBoxContainer" parent="Control/select_effect/Search/Search for a process in SoundThread/MarginContainer/ScrollContainer"]
-custom_minimum_size = Vector2(620, 0)
+[node name="ItemContainer" type="VBoxContainer" parent="Control/select_effect/Search/Search for a process in SoundThread/MarginContainer/VBoxContainer/ScrollContainer"]
 layout_mode = 2
 layout_mode = 2
+size_flags_horizontal = 3
+
+[connection signal="about_to_popup" from="." to="." method="_on_about_to_popup"]
+[connection signal="tab_changed" from="Control/select_effect" to="." method="_on_select_effect_tab_changed"]
+[connection signal="text_changed" from="Control/select_effect/Search/Search for a process in SoundThread/MarginContainer/VBoxContainer/SearchBar" to="." method="_on_search_bar_text_changed"]