mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
add interface for setting variables in deck
This commit is contained in:
parent
1992d840d9
commit
03300438c1
2 changed files with 10 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue