mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
fix connections but 2
This commit is contained in:
parent
318efb9c34
commit
a5acd3a1c3
6 changed files with 25 additions and 5 deletions
|
@ -43,8 +43,8 @@ func get_node(uuid: String) -> DeckNode:
|
||||||
|
|
||||||
func connect_nodes(from_node: DeckNode, to_node: DeckNode, from_port: int, to_port: int) -> bool:
|
func connect_nodes(from_node: DeckNode, to_node: DeckNode, from_port: int, to_port: int) -> bool:
|
||||||
# first, check that we can do the type conversion.
|
# first, check that we can do the type conversion.
|
||||||
var type_a: Types = from_node.output_ports[from_port].type
|
var type_a: Types = from_node.ports[from_port].type
|
||||||
var type_b: Types = to_node.input_ports[to_port].type
|
var type_b: Types = to_node.ports[to_port].type
|
||||||
var err: DeckType = (type_assoc[type_b]).from(type_assoc[type_a].new())
|
var err: DeckType = (type_assoc[type_b]).from(type_assoc[type_a].new())
|
||||||
if err is DeckType.DeckTypeError:
|
if err is DeckType.DeckTypeError:
|
||||||
print(err.error_message)
|
print(err.error_message)
|
||||||
|
|
|
@ -3,7 +3,7 @@ extends DeckNode
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
add_output_port(
|
add_output_port(
|
||||||
Deck.Types.STRING,
|
Deck.Types.BOOL,
|
||||||
"Press me",
|
"Press me",
|
||||||
"button"
|
"button"
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,8 @@ func _receive(to_port: int, data: DeckType, extra_data: Array = []) -> void:
|
||||||
if to_port != 1:
|
if to_port != 1:
|
||||||
return
|
return
|
||||||
|
|
||||||
var data_to_print = data.get_value()
|
var data_to_print = ports[0].value_callback.call() if ports[0].value_callback.call() != "" else data.get_value()
|
||||||
# var data_to_print = input_ports[0].value_callback.call()
|
# var data_to_print = input_ports[0].value_callback.call()
|
||||||
print(data_to_print)
|
print(data_to_print)
|
||||||
print("extra data: ", extra_data)
|
print("extra data: ", extra_data)
|
||||||
|
send(2, DeckType.DeckTypeBool.new(true))
|
||||||
|
|
|
@ -17,7 +17,12 @@ func _ready() -> void:
|
||||||
if port.port_type == DeckNode.PortType.OUTPUT:
|
if port.port_type == DeckNode.PortType.OUTPUT:
|
||||||
button.pressed.connect(
|
button.pressed.connect(
|
||||||
func():
|
func():
|
||||||
node.send(port.index, DeckType.DeckTypeString.new("Button Pressed"))
|
node.send(port.index, DeckType.DeckTypeBool.new(true))
|
||||||
|
)
|
||||||
|
elif port.port_type == DeckNode.PortType.INPUT:
|
||||||
|
button.pressed.connect(
|
||||||
|
func():
|
||||||
|
node._receive(port.index, DeckType.DeckTypeBool.new(true))
|
||||||
)
|
)
|
||||||
"field":
|
"field":
|
||||||
var line_edit := LineEdit.new()
|
var line_edit := LineEdit.new()
|
||||||
|
|
|
@ -30,3 +30,16 @@ func _ready() -> void:
|
||||||
node_renderer.node = node
|
node_renderer.node = node
|
||||||
add_child(node_renderer)
|
add_child(node_renderer)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
connection_request.connect(attempt_connection)
|
||||||
|
|
||||||
|
|
||||||
|
func attempt_connection(from_node_name: StringName, from_port: int, to_node_name: StringName, to_port: int) -> void:
|
||||||
|
var from_node: DeckNode = get_node(NodePath(from_node_name)).node
|
||||||
|
var to_node: DeckNode = get_node(NodePath(to_node_name)).node
|
||||||
|
|
||||||
|
var from_output := from_node.get_global_port_idx_from_output(from_port)
|
||||||
|
var to_input := to_node.get_global_port_idx_from_input(to_port)
|
||||||
|
|
||||||
|
if deck.connect_nodes(from_node, to_node, from_output, to_input):
|
||||||
|
connect_node(from_node_name, from_port, to_node_name, to_port)
|
||||||
|
|
|
@ -14,4 +14,5 @@ config/name="Re-DotDeck"
|
||||||
config/tags=PackedStringArray("dot_deck")
|
config/tags=PackedStringArray("dot_deck")
|
||||||
run/main_scene="res://graph_node_renderer/deck_renderer_graph_edit.tscn"
|
run/main_scene="res://graph_node_renderer/deck_renderer_graph_edit.tscn"
|
||||||
config/features=PackedStringArray("4.1", "Forward Plus")
|
config/features=PackedStringArray("4.1", "Forward Plus")
|
||||||
|
run/low_processor_mode=true
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
Loading…
Reference in a new issue