add colors to ports depending on data type

This commit is contained in:
Lera Elvoé 2024-02-13 14:17:05 +03:00
parent f4910617d1
commit 34220c4ad1
No known key found for this signature in database

View file

@ -10,6 +10,15 @@ class_name DeckNodeRendererGraphNode
## are based off. ## are based off.
var node: DeckNode var node: DeckNode
const TYPE_COLORS := {
DeckType.Types.BOOL: Color("#7048e0"),
DeckType.Types.STRING: Color("#dbe048"),
DeckType.Types.NUMERIC: Color("#68e36c"),
DeckType.Types.ARRAY: Color("#e36868"),
DeckType.Types.DICTIONARY: Color("#79ede3"),
DeckType.Types.ANY: Color.WHITE,
}
## Setups up all the properties based off [member node]. Including looping through ## Setups up all the properties based off [member node]. Including looping through
## [method DeckNode.get_all_ports()] and setting up all the descriptors. ## [method DeckNode.get_all_ports()] and setting up all the descriptors.
@ -191,8 +200,8 @@ func update_port(port: Port) -> void:
port.index, port.index,
port.port_type == DeckNode.PortType.INPUT, port.port_type == DeckNode.PortType.INPUT,
port.type, port.type,
Color.WHITE, TYPE_COLORS[port.type],
port.port_type == DeckNode.PortType.OUTPUT, port.port_type == DeckNode.PortType.OUTPUT,
port.type, port.type,
Color.WHITE, TYPE_COLORS[port.type],
) )