extends Control # Declare member variables here. Examples: # var a = 2 # var b = "text" signal volume_changed(slider,value) var count = 0 var sliders = [] var values = [] # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. func set_count(value): for slice in $HBoxContainer.get_children(): slice.remove_and_skip() sliders = [] for i in range(0,value): if len(values) < value+1: values.append(50) var slice = VBoxContainer.new() var slider = VSlider.new() slider.hint_tooltip = "Vocal mix "+String(i+1) slider.size_flags_vertical = SIZE_EXPAND_FILL slider.value = values[i] slider.connect("value_changed",self,"on_value_changed") slice.add_child(slider) sliders.append(slider) var label = Label.new() label.text = String(i+1) label.hint_tooltip = "Vocal mix "+String(i+1) label.mouse_filter = Control.MOUSE_FILTER_STOP label.align = Label.ALIGN_CENTER slice.add_child(label) $HBoxContainer.add_child(slice) func on_value_changed(value): for i in range(0,len(sliders)): if values[i] != sliders[i].value: values[i] = sliders[i].value emit_signal("volume_changed",i,sliders[i].value) # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass