diff --git a/classes/deck/deck_node.gd b/classes/deck/deck_node.gd index b0828af..4d69a71 100644 --- a/classes/deck/deck_node.gd +++ b/classes/deck/deck_node.gd @@ -109,6 +109,9 @@ func add_port(type: DeckType.Types, descriptor: String = "", usage: Port.UsageType = Port.UsageType.BOTH) -> Port: var port := Port.new(type, label, ports.size(), port_type, index_of_type, descriptor, usage) + # WARNING: EXPERIMENTAL + port.set_value_no_signal(DeckType.DEFAULT_VALUES[type]) + ports.append(port) port_added.emit(ports.size() - 1) port.value_updated.connect( diff --git a/classes/types/deck_type.gd b/classes/types/deck_type.gd index 9a00c88..1c875fa 100644 --- a/classes/types/deck_type.gd +++ b/classes/types/deck_type.gd @@ -12,6 +12,15 @@ enum Types{ ANY, } +const DEFAULT_VALUES := { + Types.BOOL: false, + Types.NUMERIC: 0.0, + Types.STRING: "", + Types.ARRAY: [], + Types.DICTIONARY: {}, + Types.ANY: null, +} + const CONVERSION_MAP := { Types.BOOL: [Types.NUMERIC, Types.STRING, Types.ANY], Types.NUMERIC: [Types.BOOL, Types.STRING, Types.ANY], @@ -56,6 +65,7 @@ static func convert_value(value: Variant, to: Types) -> Variant: static func type_str(type: Types) -> String: return str(Types.keys()[type]) + ## Validates whether the given Dictionary is a "Vector", AKA that it has an X and a Y key. static func is_valid_vector(dict : Variant):