diff --git a/classes/deck/deck.gd b/classes/deck/deck.gd index 94b9e02..f7ce6fb 100644 --- a/classes/deck/deck.gd +++ b/classes/deck/deck.gd @@ -44,6 +44,8 @@ signal node_added(node: DeckNode) signal node_removed(node: DeckNode) ## Emitted when nodes have been disconnected signal nodes_disconnected(from_node_id: String, to_node_id: String, from_output_port: int, to_input_port: int) +## Emitted when the [member variable_stack] has been modified. +signal variables_updated() #region group signals signal node_added_to_group(node: DeckNode, assign_id: String, assign_to_self: bool, deck: Deck) @@ -196,6 +198,12 @@ func remove_node(uuid: String, remove_connections: bool = false, force: bool = f node_removed_from_group.emit(uuid, remove_connections, self) +## Set a variable on this deck. +func set_variable(var_name: String, value: Variant) -> void: + variable_stack[var_name] = value + variables_updated.emit() + + ## Group the [param nodes_to_group] into a new deck and return it. ## Returns [code]null[/code] on failure.[br] ## Adds a group node to this deck, and adds group input and output nodes in the group. diff --git a/classes/deck/nodes/set_deck_var.gd b/classes/deck/nodes/set_deck_var.gd index 40f383f..3bd5812 100644 --- a/classes/deck/nodes/set_deck_var.gd +++ b/classes/deck/nodes/set_deck_var.gd @@ -42,7 +42,8 @@ func _receive(to_input_port: int, _data: Variant, _extra_data: Array = []) -> vo var var_name: String = resolve_input_port_value(0) var var_value: Variant = resolve_input_port_value(1) - _belonging_to.variable_stack[var_name] = var_value + #_belonging_to.variable_stack[var_name] = var_value + _belonging_to.set_variable(var_name, var_value) send(0, var_value)