diff --git a/classes/deck/nodes/general/delay.gd b/classes/deck/nodes/general/delay.gd index 2b1bbf5..470090c 100644 --- a/classes/deck/nodes/general/delay.gd +++ b/classes/deck/nodes/general/delay.gd @@ -10,36 +10,29 @@ func _init(): node_type = name.to_snake_case() description = "A node that passes through its' input after the set time." - add_output_port(DeckType.Types.ANY, "Value") + add_input_port( + DeckType.Types.NUMERIC, + "Delay Time", + "spinbox:unbounded:0.01", + Port.UsageType.VALUE_REQUEST, + ) - add_input_port(DeckType.Types.NUMERIC, "Delay Time", "field") - add_input_port(DeckType.Types.ANY, "Value", "field") + add_input_port( + DeckType.Types.ANY, + "Value", + "", + Port.UsageType.TRIGGER, + ) + add_output_port( + DeckType.Types.ANY, + "Value", + "", + Port.UsageType.TRIGGER, + ) func _receive(_to_input_port : int, data: Variant) -> void: - - thread = Thread.new() - thread.start(handle_delay.bind(data)) - - -func handle_delay(data): - - var goal_time = Time.get_ticks_msec() + (int(get_input_ports()[0].value_callback.call()) * 1000) - - while Time.get_ticks_msec() < goal_time: - - pass - - - #print("Delay over") - send.call_deferred(0, data) - - -func _notification(what): - - if what == NOTIFICATION_PREDELETE and thread != null: - - thread.wait_to_finish() - - + var time: float = await resolve_input_port_value_async(0) + await Engine.get_main_loop().create_timer(time).timeout + send(0, data) diff --git a/graph_node_renderer/descriptors/spin_box_descriptor.gd b/graph_node_renderer/descriptors/spin_box_descriptor.gd index 82b86ca..a69e659 100644 --- a/graph_node_renderer/descriptors/spin_box_descriptor.gd +++ b/graph_node_renderer/descriptors/spin_box_descriptor.gd @@ -14,14 +14,14 @@ func _setup(port: Port, _node: DeckNode) -> void: spin_box.allow_greater = true spin_box.allow_lesser = true if descriptor.size() > 2: - spin_box.step = float(descriptor[1]) + spin_box.step = float(descriptor[2]) else: spin_box.step = 1.0 else: - spin_box.min_value = float(descriptor[1]) + spin_box.min_value = float(descriptor[2]) if descriptor.size() > 2: - spin_box.max_value = float(descriptor[2]) + spin_box.max_value = float(descriptor[3]) if descriptor.size() > 3: - spin_box.step = float(descriptor[3]) + spin_box.step = float(descriptor[4]) port.value_callback = spin_box.get_value spin_box.value_changed.connect(port.set_value)