miggor-StreamGraph/rpc_renderer/scopes/scope_node.gd
Lera Elvoé a1b74410f6 rework RPC Signal Layer class (#101)
Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/101
Co-authored-by: Lera Elvoé <yagich@poto.cafe>
Co-committed-by: Lera Elvoé <yagich@poto.cafe>
2024-03-14 05:54:25 +00:00

35 lines
1.1 KiB
GDScript

# (c) 2023-present Eroax
# (c) 2023-present Yagich
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
extends RPCScope
func _init() -> void:
name = "node"
RPCSignalLayer.signals.node_position_updated.connect(_on_node_position_updated)
RPCSignalLayer.signals.node_renamed.connect(_on_node_renamed)
RPCSignalLayer.signals.node_port_value_updated.connect(_on_node_port_value_updated)
func _on_node_position_updated(deck_id: String, node_id: String, position: Dictionary) -> void:
event.emit(create_event("position_updated", position, {"deck_id": deck_id, "node_id": node_id}))
func _on_node_renamed(deck_id: String, node_id: String, new_name: String) -> void:
event.emit(create_event("renamed", {"new_name": new_name}, {"deck_id": deck_id, "node_id": node_id}))
func _on_node_port_value_updated(deck_id: String, node_id: String, port_idx: int, new_value: Variant) -> void:
event.emit(create_event(
"port_value_updated",
{
"port": port_idx,
"new_value": new_value,
},
{
"deck_id": deck_id,
"node_id": node_id,
}
)
)