# (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 HBoxContainer class_name DescriptorContainer @onready var type_icon: TextureRect = %TypeIcon var descriptor: Array var ignore_signal: bool = false const TYPE_ICONS := { DeckType.Types.BOOL: preload("res://graph_node_renderer/textures/type_bool.svg"), DeckType.Types.NUMERIC: preload("res://graph_node_renderer/textures/type_numeric.svg"), DeckType.Types.STRING: preload("res://graph_node_renderer/textures/type_string.svg"), DeckType.Types.ARRAY: preload("res://graph_node_renderer/textures/type_array.svg"), DeckType.Types.DICTIONARY: preload("res://graph_node_renderer/textures/type_dictionary.svg"), } @warning_ignore("unused_parameter") func set_up_from_port(port: Port, node: DeckNode, in_node: bool = true) -> void: descriptor = port.descriptor.split(":") Util.safe_connect(port.value_updated, func(new_value: Variant): if ignore_signal: return if new_value != null: set_value(new_value) ) _setup(port, node) if (port.port_type == DeckNode.PortType.VIRTUAL or port.type == DeckType.Types.ANY) or not in_node: type_icon.visible = false return type_icon.modulate = DeckNodeRendererGraphNode.TYPE_COLORS[port.type] type_icon.tooltip_text = "Type: %s" % DeckType.type_str(port.type).to_lower() type_icon.texture = TYPE_ICONS[port.type] if port.port_type == DeckNode.PortType.OUTPUT and in_node: move_child(type_icon, -1) @warning_ignore("unused_parameter") func _setup(port: Port, node: DeckNode) -> void: pass @warning_ignore("unused_parameter") func set_value(new_value: Variant) -> void: pass