mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
b36bdaf71c
documented everything (except NodeDB) in the classes/ folder Reviewed-on: https://codeberg.org/Eroax/Re-DotDeck/pulls/4 Co-authored-by: Lera Elvoé <yagich@poto.cafe> Co-committed-by: Lera Elvoé <yagich@poto.cafe>
51 lines
1.5 KiB
GDScript
51 lines
1.5 KiB
GDScript
class_name Port
|
|
## A data type representing a port of a [DeckNode].
|
|
##
|
|
## Ports are used for connections between [DeckNode]s and can contain data that is passed between
|
|
## them on a node.
|
|
|
|
## The type index of this port.
|
|
var type: Deck.Types
|
|
## The label of this port. Used by the renderer to display. How it's displayed depends on the renderer
|
|
## and the [member descriptor].
|
|
var label: String
|
|
## Hints to the renderer on how to display this port.[br]
|
|
## Can be either one of these: [code]button textfield spinbox slider textblock codeblock checkbox singlechoice multichoice[/code].[br]
|
|
## Additional descriptor properties can be specified after the type, delimited by a colon ([code]:[/code]).[br]
|
|
## @experimental
|
|
var descriptor: String
|
|
## A callback to get this port's value. Intended usage is by renderers that show an input field of some kind.
|
|
var value_callback: Callable
|
|
|
|
## The type of this port (input, output or virtual)
|
|
var port_type: DeckNode.PortType
|
|
## The local index of this port.
|
|
var index_of_type: int
|
|
## The global index of this port.
|
|
var index: int
|
|
|
|
## The value of this port.
|
|
var value: Variant: set = set_value
|
|
|
|
|
|
func _init(
|
|
p_type: Deck.Types,
|
|
p_label: String,
|
|
p_index: int,
|
|
p_port_type: DeckNode.PortType,
|
|
p_index_of_type: int,
|
|
p_descriptor: String = "",
|
|
# p_value_callback: Callable = Callable(),
|
|
) -> void:
|
|
type = p_type
|
|
label = p_label
|
|
descriptor = p_descriptor
|
|
# value_callback = p_value_callback
|
|
|
|
port_type = p_port_type
|
|
index_of_type = p_index_of_type
|
|
index = p_index
|
|
|
|
|
|
func set_value(v: Variant) -> void:
|
|
value = v
|