diff --git a/addons/block_code/block_code_plugin.gd b/addons/block_code/block_code_plugin.gd index 9471f743..355f8a91 100644 --- a/addons/block_code/block_code_plugin.gd +++ b/addons/block_code/block_code_plugin.gd @@ -45,7 +45,7 @@ const DISABLED_CLASSES := [ func _enter_tree(): - Types.init_cast_graph() + Types.init_types() main_panel = MainPanel.instantiate() main_panel.undo_redo = get_undo_redo() diff --git a/addons/block_code/drag_manager/drag_manager.gd b/addons/block_code/drag_manager/drag_manager.gd index fdc21cf9..d18bf46d 100644 --- a/addons/block_code/drag_manager/drag_manager.gd +++ b/addons/block_code/drag_manager/drag_manager.gd @@ -46,7 +46,12 @@ func _process(_delta): push_error("Warning: a snap point does not reference it's parent block.") continue if snap_point.block.on_canvas: - if Types.can_cast(dragging.block_type, snap_point.block_type): + if dragging.block_type == snap_point.block_type: + # Don't snap uncastable value blocks + if dragging.block_type == Types.BlockType.VALUE: + if !Types.can_cast(dragging.variant_type, snap_point.variant_type): + continue + var snap_global_pos: Vector2 = snap_point.get_global_rect().position var temp_dist: float = dragging_global_pos.distance_to(snap_global_pos) if temp_dist < closest_dist: diff --git a/addons/block_code/types/types.gd b/addons/block_code/types/types.gd index 8f8b03e6..bd034dc5 100644 --- a/addons/block_code/types/types.gd +++ b/addons/block_code/types/types.gd @@ -3,23 +3,25 @@ extends Node enum BlockType { NONE, - EXECUTE, ENTRY, - # Parameters - STRING, - INT, - FLOAT, - VECTOR2, - BOOL, - COLOR, - NODE + EXECUTE, + VALUE, +} + +const VARIANT_TYPE_TO_STRING: Dictionary = { + TYPE_STRING: "String", + TYPE_INT: "int", + TYPE_FLOAT: "float", + TYPE_BOOL: "bool", + TYPE_VECTOR2: "Vector2", + TYPE_COLOR: "Color", } -const cast_relationships = [ - [BlockType.INT, BlockType.FLOAT, "float(%s)"], - [BlockType.FLOAT, BlockType.INT, "int(%s)"], - [BlockType.INT, BlockType.STRING, "str(%s)"], - [BlockType.FLOAT, BlockType.STRING, "str(%s)"], +const CAST_RELATIONSHIPS = [ + ["int", "float", "float(%s)"], + ["float", "int", "int(%s)"], + ["int", "String", "str(%s)"], + ["float", "String", "str(%s)"], ] # Directed graph, edges are CastGraphEdge @@ -27,18 +29,18 @@ static var cast_graph: Dictionary class CastGraphEdge: - var to: BlockType + var to: String var cast_format: String - func _init(p_to: BlockType, p_cast_format: String): + func _init(p_to: String, p_cast_format: String): to = p_to cast_format = p_cast_format -static func init_cast_graph(): +static func init_types(): cast_graph = {} - for rel in cast_relationships: + for rel in CAST_RELATIONSHIPS: if not cast_graph.has(rel[0]): cast_graph[rel[0]] = [] @@ -56,7 +58,7 @@ static var dist: Dictionary const INT_MAX: int = 1000000000 -static func dijkstra(source: BlockType): +static func dijkstra(source: String): prev = {} dist = {} @@ -86,7 +88,7 @@ static func dijkstra(source: BlockType): queue.update_priority(v, alt) -static func can_cast(type: BlockType, parent_type: BlockType) -> bool: +static func can_cast(type: String, parent_type: String) -> bool: if type == parent_type: return true @@ -96,7 +98,7 @@ static func can_cast(type: BlockType, parent_type: BlockType) -> bool: return false -static func cast(val: String, type: BlockType, parent_type: BlockType): +static func cast(val: String, type: String, parent_type: String): if type == parent_type: return val diff --git a/addons/block_code/ui/blocks/entry_block/entry_block.tscn b/addons/block_code/ui/blocks/entry_block/entry_block.tscn index 5e22e55b..e1351721 100644 --- a/addons/block_code/ui/blocks/entry_block/entry_block.tscn +++ b/addons/block_code/ui/blocks/entry_block/entry_block.tscn @@ -7,4 +7,7 @@ script = ExtResource("2_3ik8h") block_name = "entry_block" label = "EntryBlock" -block_type = 2 +block_type = 1 + +[node name="Background" parent="VBoxContainer/TopMarginContainer" index="0"] +show_top = false diff --git a/addons/block_code/ui/blocks/parameter_block/parameter_block.gd b/addons/block_code/ui/blocks/parameter_block/parameter_block.gd index fedae5fb..1f489769 100644 --- a/addons/block_code/ui/blocks/parameter_block/parameter_block.gd +++ b/addons/block_code/ui/blocks/parameter_block/parameter_block.gd @@ -4,6 +4,7 @@ extends Block @export var block_format: String = "" @export var statement: String = "" +@export var variant_type: String @onready var _panel := $Panel @onready var _hbox := %HBoxContainer @@ -33,7 +34,7 @@ func _on_drag_drop_area_mouse_down(): func get_serialized_props() -> Array: var props := super() - props.append_array(serialize_props(["block_format", "statement"])) + props.append_array(serialize_props(["variant_type", "block_format", "statement"])) var _param_input_strings: Dictionary = {} for pair in param_name_input_pairs: diff --git a/addons/block_code/ui/blocks/parameter_block/parameter_block.tscn b/addons/block_code/ui/blocks/parameter_block/parameter_block.tscn index fa6ddb00..ab7ba15a 100644 --- a/addons/block_code/ui/blocks/parameter_block/parameter_block.tscn +++ b/addons/block_code/ui/blocks/parameter_block/parameter_block.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" path="res://addons/block_code/ui/blocks/parameter_block/parameter_block.gd" id="1_0hajy"] [ext_resource type="PackedScene" uid="uid://c7puyxpqcq6xo" path="res://addons/block_code/ui/blocks/utilities/drag_drop_area/drag_drop_area.tscn" id="2_gy5co"] -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0afbg"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_d7xfk"] bg_color = Color(1, 1, 1, 1) border_width_left = 3 border_width_top = 3 @@ -26,7 +26,7 @@ block_type = 3 [node name="Panel" type="Panel" parent="."] unique_name_in_owner = true layout_mode = 2 -theme_override_styles/panel = SubResource("StyleBoxFlat_0afbg") +theme_override_styles/panel = SubResource("StyleBoxFlat_d7xfk") [node name="DragDropArea" parent="." instance=ExtResource("2_gy5co")] layout_mode = 2 diff --git a/addons/block_code/ui/blocks/statement_block/statement_block.gd b/addons/block_code/ui/blocks/statement_block/statement_block.gd index 1cf7525a..4b06148e 100644 --- a/addons/block_code/ui/blocks/statement_block/statement_block.gd +++ b/addons/block_code/ui/blocks/statement_block/statement_block.gd @@ -99,13 +99,12 @@ static func format_string(parent_block: Block, attach_to: Node, string: String) var split := param.split(": ") var param_name := split[0] - var param_type_str := split[1] - var param_type := Types.BlockType.get(param_type_str) + var param_type := split[1] var param_input: ParameterInput = preload("res://addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn").instantiate() param_input.name = "ParameterInput%d" % start # Unique path param_input.placeholder = param_name - param_input.block_type = param_type + param_input.variant_type = param_type param_input.block = parent_block param_input.text_modified.connect(func(): parent_block.modified.emit()) attach_to.add_child(param_input) @@ -115,7 +114,7 @@ static func format_string(parent_block: Block, attach_to: Node, string: String) var new_block: Block = preload("res://addons/block_code/ui/blocks/parameter_block/parameter_block.tscn").instantiate() new_block.block_format = param_name new_block.statement = param_name - new_block.block_type = param_type + new_block.variant_type = param_type new_block.color = parent_block.color param_input.block_type = Types.BlockType.NONE param_input.snap_point.block_type = Types.BlockType.NONE # Necessary because already called ready diff --git a/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd b/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd index 72bdce83..ccdff7ae 100644 --- a/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd +++ b/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd @@ -9,7 +9,8 @@ signal text_modified @export var block_path: NodePath -@export var block_type: Types.BlockType = Types.BlockType.STRING +@export var block_type: Types.BlockType = Types.BlockType.VALUE +@export var variant_type: String = "String" var block: Block @@ -41,6 +42,7 @@ func _ready(): block = get_node_or_null(block_path) snap_point.block = block snap_point.block_type = block_type + snap_point.variant_type = variant_type # Do something with block_type to restrict input @@ -50,16 +52,16 @@ func get_snapped_block() -> Block: func get_string() -> String: - var snapped_block: Block = get_snapped_block() + var snapped_block: ParameterBlock = get_snapped_block() as ParameterBlock if snapped_block: var generated_string = snapped_block.get_parameter_string() - return Types.cast(generated_string, snapped_block.block_type, block_type) + return Types.cast(generated_string, snapped_block.variant_type, variant_type) var text: String = get_plain_text() - if block_type == Types.BlockType.STRING: + if variant_type == "String": text = "'%s'" % text - if block_type == Types.BlockType.VECTOR2: + if variant_type == "Vector2": text = "Vector2(%s)" % text return text diff --git a/addons/block_code/ui/blocks/utilities/snap_point/snap_point.gd b/addons/block_code/ui/blocks/utilities/snap_point/snap_point.gd index 42a01e8a..88d3238b 100644 --- a/addons/block_code/ui/blocks/utilities/snap_point/snap_point.gd +++ b/addons/block_code/ui/blocks/utilities/snap_point/snap_point.gd @@ -5,6 +5,7 @@ extends MarginContainer @export var block_path: NodePath @export var block_type: Types.BlockType = Types.BlockType.EXECUTE +@export var variant_type: String = "" var block: Block diff --git a/addons/block_code/ui/picker/categories/category_factory.gd b/addons/block_code/ui/picker/categories/category_factory.gd index 08161af7..4b4141fa 100644 --- a/addons/block_code/ui/picker/categories/category_factory.gd +++ b/addons/block_code/ui/picker/categories/category_factory.gd @@ -44,22 +44,22 @@ static func get_general_categories() -> Array[BlockCategory]: var control_list: Array[Block] = [] b = BLOCKS["control_block"].instantiate() - b.block_formats = ["if {cond: BOOL}"] + b.block_formats = ["if {cond: bool}"] b.statements = ["if {cond}:"] control_list.append(b) b = BLOCKS["control_block"].instantiate() - b.block_formats = ["if {cond: BOOL}", "else"] + b.block_formats = ["if {cond: bool}", "else"] b.statements = ["if {cond}:", "else:"] control_list.append(b) b = BLOCKS["control_block"].instantiate() - b.block_formats = ["repeat {num: INT}"] + b.block_formats = ["repeat {num: int}"] b.statements = ["for i in {num}:"] control_list.append(b) b = BLOCKS["control_block"].instantiate() - b.block_formats = ["while {bool: BOOL}"] + b.block_formats = ["while {bool: bool}"] b.statements = ["while {bool}:"] control_list.append(b) @@ -79,12 +79,12 @@ static func get_general_categories() -> Array[BlockCategory]: var test_list: Array[Block] = [] b = BLOCKS["statement_block"].instantiate() - b.block_format = "print {text: STRING}" + b.block_format = "print {text: String}" b.statement = "print({text})" test_list.append(b) b = BLOCKS["entry_block"].instantiate() - b.block_format = "On body enter [body: NODE]" + b.block_format = "On body enter [body: Node]" b.statement = "func _on_body_enter(body):" test_list.append(b) @@ -96,44 +96,44 @@ static func get_general_categories() -> Array[BlockCategory]: b = BLOCKS["entry_block"].instantiate() # HACK: make signals work with new entry nodes. NONE instead of STRING type allows # plain text input for function name. Should revamp signals later - b.block_format = "On signal {signal: NONE}" + b.block_format = "On signal {signal: None}" b.statement = "func signal_{signal}():" signal_list.append(b) b = BLOCKS["statement_block"].instantiate() - b.block_format = "Send signal {signal: STRING} to group {group: STRING}" + b.block_format = "Send signal {signal: String} to group {group: String}" b.statement = 'var signal_manager = get_tree().root.get_node_or_null("SignalManager")\n' + "if signal_manager:\n" + "\tsignal_manager.broadcast_signal({group}, {signal})" signal_list.append(b) b = BLOCKS["statement_block"].instantiate() - b.block_format = "Add to group {group: STRING}" + b.block_format = "Add to group {group: String}" b.statement = "add_to_group({group})" signal_list.append(b) b = BLOCKS["statement_block"].instantiate() - b.block_format = "Add {node: NODE} to group {group: STRING}" + b.block_format = "Add {node: Node} to group {group: String}" b.statement = "{node}.add_to_group({group})" signal_list.append(b) b = BLOCKS["statement_block"].instantiate() - b.block_format = "Remove from group {group: STRING}" + b.block_format = "Remove from group {group: String}" b.statement = "remove_from_group({group})" signal_list.append(b) b = BLOCKS["statement_block"].instantiate() - b.block_format = "Remove {node: NODE} from group {group: STRING}" + b.block_format = "Remove {node: Node} from group {group: String}" b.statement = "{node}.remove_from_group({group})" signal_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.BOOL - b.block_format = "Is in group {group: STRING}" + b.variant_type = "bool" + b.block_format = "Is in group {group: String}" b.statement = "is_in_group({group})" signal_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.BOOL - b.block_format = "Is {node: NODE} in group {group: STRING}" + b.variant_type = "bool" + b.block_format = "Is {node: Node} in group {group: String}" b.statement = "{node}.is_in_group({group})" signal_list.append(b) @@ -143,28 +143,28 @@ static func get_general_categories() -> Array[BlockCategory]: var variable_list: Array[Block] = [] b = BLOCKS["statement_block"].instantiate() - b.block_format = "Set String {var: STRING} {value: STRING}" + b.block_format = "Set String {var: String} {value: String}" b.statement = "VAR_DICT[{var}] = {value}" variable_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_format = "Get String {var: STRING}" + b.block_format = "Get String {var: String}" b.statement = "VAR_DICT[{var}]" variable_list.append(b) b = BLOCKS["statement_block"].instantiate() - b.block_format = "Set Int {var: STRING} {value: INT}" + b.block_format = "Set Int {var: String} {value: int}" b.statement = "VAR_DICT[{var}] = {value}" variable_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.INT - b.block_format = "Get Int {var: STRING}" + b.variant_type = "int" + b.block_format = "Get Int {var: String}" b.statement = "VAR_DICT[{var}]" variable_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_format = "To String {int: INT}" + b.block_format = "To String {int: int}" b.statement = "str({int})" variable_list.append(b) @@ -174,32 +174,32 @@ static func get_general_categories() -> Array[BlockCategory]: var math_list: Array[Block] = [] b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.INT - b.block_format = "{a: INT} + {b: INT}" + b.variant_type = "int" + b.block_format = "{a: int} + {b: int}" b.statement = "({a} + {b})" math_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.INT - b.block_format = "{a: INT} - {b: INT}" + b.variant_type = "int" + b.block_format = "{a: int} - {b: int}" b.statement = "({a} - {b})" math_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.INT - b.block_format = "{a: INT} * {b: INT}" + b.variant_type = "int" + b.block_format = "{a: int} * {b: int}" b.statement = "({a} * {b})" math_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.INT - b.block_format = "{a: INT} / {b: INT}" + b.variant_type = "int" + b.block_format = "{a: int} / {b: int}" b.statement = "({a} / {b})" math_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.INT - b.block_format = "{base: INT} ^ {exp: INT}" + b.variant_type = "int" + b.block_format = "{base: int} ^ {exp: int}" b.statement = "(pow({base}, {exp}))" math_list.append(b) @@ -211,21 +211,21 @@ static func get_general_categories() -> Array[BlockCategory]: for op in ["==", ">", "<", ">=", "<=", "!="]: b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.BOOL - b.block_format = "{int1: INT} %s {int2: INT}" % op + b.variant_type = "bool" + b.block_format = "{int1: int} %s {int2: int}" % op b.statement = "({int1} %s {int2})" % op logic_list.append(b) for op in ["and", "or"]: b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.BOOL - b.block_format = "{bool1: BOOL} %s {bool2: BOOL}" % op + b.variant_type = "bool" + b.block_format = "{bool1: bool} %s {bool2: bool}" % op b.statement = "({bool1} %s {bool2})" % op logic_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_type = Types.BlockType.BOOL - b.block_format = "Not {bool: BOOL}" + b.variant_type = "bool" + b.block_format = "Not {bool: bool}" b.statement = "(!{bool})" logic_list.append(b) @@ -264,31 +264,13 @@ static func add_to_categories(main: Array[BlockCategory], addition: Array[BlockC return main -static func built_in_type_to_block_type(type: Variant.Type): - match type: - TYPE_BOOL: - return Types.BlockType.BOOL - TYPE_INT: - return Types.BlockType.INT - TYPE_FLOAT: - return Types.BlockType.FLOAT - TYPE_STRING: - return Types.BlockType.STRING - TYPE_VECTOR2: - return Types.BlockType.VECTOR2 - TYPE_COLOR: - return Types.BlockType.COLOR - - return null - - static func property_to_blocklist(property: Dictionary) -> Array[Block]: var block_list: Array[Block] = [] - var block_type = built_in_type_to_block_type(property.type) + var block_type = property.type if block_type: - var type_string: String = Types.BlockType.find_key(block_type) + var type_string: String = Types.VARIANT_TYPE_TO_STRING[block_type] var b = BLOCKS["statement_block"].instantiate() b.block_format = "Set %s to {value: %s}" % [property.name.capitalize(), type_string] @@ -301,7 +283,7 @@ static func property_to_blocklist(property: Dictionary) -> Array[Block]: block_list.append(b) b = BLOCKS["parameter_block"].instantiate() - b.block_type = block_type + b.variant_type = type_string b.block_format = "%s" % property.name.capitalize() b.statement = "%s" % property.name block_list.append(b) @@ -344,7 +326,7 @@ static func get_built_in_categories(_class_name: String) -> Array[BlockCategory] match _class_name: "Node2D": var b = BLOCKS["statement_block"].instantiate() - b.block_format = "Set Rotation Degrees {angle: FLOAT}" + b.block_format = "Set Rotation Degrees {angle: float}" b.statement = "rotation_degrees = {angle}" block_list.append(b) @@ -376,19 +358,19 @@ static func _get_input_blocks() -> Array[Block]: for action: StringName in InputMap.get_actions(): var block: Block = BLOCKS["parameter_block"].instantiate() - block.block_type = Types.BlockType.BOOL + block.variant_type = "bool" block.block_format = "Is action %s pressed" % action block.statement = 'Input.is_action_pressed("%s")' % action block_list.append(block) block = BLOCKS["parameter_block"].instantiate() - block.block_type = Types.BlockType.BOOL + block.variant_type = "bool" block.block_format = "Is action %s just pressed" % action block.statement = 'Input.is_action_just_pressed("%s")' % action block_list.append(block) block = BLOCKS["parameter_block"].instantiate() - block.block_type = Types.BlockType.BOOL + block.variant_type = "bool" block.block_format = "Is action %s just released" % action block.statement = 'Input.is_action_just_released("%s")' % action block_list.append(block) diff --git a/test_game/test_game.tscn b/test_game/test_game.tscn index cea07b82..9a1f662a 100644 --- a/test_game/test_game.tscn +++ b/test_game/test_game.tscn @@ -771,116 +771,160 @@ func _process(delta): " -[sub_resource type="Resource" id="Resource_7arwy"] +[sub_resource type="Resource" id="Resource_g6w8l"] +script = ExtResource("3_dpt5n") +block_class = &"EntryBlock" +serialized_props = [["block_name", "ready_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 2], ["position", Vector2(54, 47)], ["block_format", "On Ready"], ["statement", "func _ready():"], ["param_input_strings", {}]] + +[sub_resource type="Resource" id="Resource_ojl58"] +script = ExtResource("2_pqvcj") +serialized_block = SubResource("Resource_g6w8l") +path_child_pairs = [] + +[sub_resource type="Resource" id="Resource_q6pok"] +script = ExtResource("3_dpt5n") +block_class = &"EntryBlock" +serialized_props = [["block_name", "process_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 2], ["position", Vector2(525, 48)], ["block_format", "On Process"], ["statement", "func _process(delta):"], ["param_input_strings", {}]] + +[sub_resource type="Resource" id="Resource_ijbq4"] +script = ExtResource("2_pqvcj") +serialized_block = SubResource("Resource_q6pok") +path_child_pairs = [] + +[sub_resource type="Resource" id="Resource_f7ggk"] +script = ExtResource("3_dpt5n") +block_class = &"StatementBlock" +serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.6, 0.537255, 0.87451, 1)], ["block_type", 1], ["position", Vector2(309, 131)], ["block_format", "print {text: STRING}"], ["statement", "print({text})"], ["param_input_strings", { +"text": "" +}]] + +[sub_resource type="Resource" id="Resource_lfxk2"] +script = ExtResource("2_pqvcj") +serialized_block = SubResource("Resource_f7ggk") +path_child_pairs = [] + +[sub_resource type="Resource" id="Resource_mvbra"] +script = ExtResource("3_dpt5n") +block_class = &"StatementBlock" +serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.6, 0.537255, 0.87451, 1)], ["block_type", 1], ["position", Vector2(508, 174)], ["block_format", "print {text: STRING}"], ["statement", "print({text})"], ["param_input_strings", { +"text": "Counter started." +}]] + +[sub_resource type="Resource" id="Resource_4hg0u"] +script = ExtResource("2_pqvcj") +serialized_block = SubResource("Resource_mvbra") +path_child_pairs = [] + +[sub_resource type="Resource" id="Resource_l4aev"] script = ExtResource("3_dpt5n") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 4], ["position", Vector2(0, 0)], ["block_format", "Get Int {var: STRING}"], ["statement", "VAR_DICT[{var}]"], ["param_input_strings", { +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 4], ["position", Vector2(0, 0)], ["variant_type", ""], ["block_format", "Get Int {var: STRING}"], ["statement", "VAR_DICT[{var}]"], ["param_input_strings", { "var": "i" }]] -[sub_resource type="Resource" id="Resource_6s5lw"] +[sub_resource type="Resource" id="Resource_gg3c6"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_7arwy") +serialized_block = SubResource("Resource_l4aev") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_5o87s"] +[sub_resource type="Resource" id="Resource_s0fqx"] script = ExtResource("3_dpt5n") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.258824, 0.721569, 0.890196, 1)], ["block_type", 7], ["position", Vector2(0, 0)], ["block_format", "{int1: INT} < {int2: INT}"], ["statement", "({int1} < {int2})"], ["param_input_strings", { +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.258824, 0.721569, 0.890196, 1)], ["block_type", 7], ["position", Vector2(0, 0)], ["variant_type", ""], ["block_format", "{int1: INT} < {int2: INT}"], ["statement", "({int1} < {int2})"], ["param_input_strings", { "int1": "", "int2": "100" }]] -[sub_resource type="Resource" id="Resource_sst32"] +[sub_resource type="Resource" id="Resource_tmjnh"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_5o87s") -path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_6s5lw")]] +serialized_block = SubResource("Resource_s0fqx") +path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_gg3c6")]] -[sub_resource type="Resource" id="Resource_47rwp"] +[sub_resource type="Resource" id="Resource_kxbem"] script = ExtResource("3_dpt5n") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 4], ["position", Vector2(0, 0)], ["block_format", "Get Int {var: STRING}"], ["statement", "VAR_DICT[{var}]"], ["param_input_strings", { +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 4], ["position", Vector2(0, 0)], ["variant_type", ""], ["block_format", "Get Int {var: STRING}"], ["statement", "VAR_DICT[{var}]"], ["param_input_strings", { "var": "i" }]] -[sub_resource type="Resource" id="Resource_2ctfe"] +[sub_resource type="Resource" id="Resource_4u15v"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_47rwp") +serialized_block = SubResource("Resource_kxbem") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_v6x16"] +[sub_resource type="Resource" id="Resource_3xbc4"] script = ExtResource("3_dpt5n") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["block_format", "To String {int: INT}"], ["statement", "str({int})"], ["param_input_strings", { +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 3], ["position", Vector2(0, 0)], ["variant_type", ""], ["block_format", "To String {int: INT}"], ["statement", "str({int})"], ["param_input_strings", { "int": "" }]] -[sub_resource type="Resource" id="Resource_owugl"] +[sub_resource type="Resource" id="Resource_gun6j"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_v6x16") -path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_2ctfe")]] +serialized_block = SubResource("Resource_3xbc4") +path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_4u15v")]] -[sub_resource type="Resource" id="Resource_m0tel"] +[sub_resource type="Resource" id="Resource_ksrk6"] script = ExtResource("3_dpt5n") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 4], ["position", Vector2(0, 0)], ["block_format", "Get Int {var: STRING}"], ["statement", "VAR_DICT[{var}]"], ["param_input_strings", { +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 4], ["position", Vector2(0, 0)], ["variant_type", ""], ["block_format", "Get Int {var: STRING}"], ["statement", "VAR_DICT[{var}]"], ["param_input_strings", { "var": "i" }]] -[sub_resource type="Resource" id="Resource_uf6rk"] +[sub_resource type="Resource" id="Resource_olf23"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_m0tel") +serialized_block = SubResource("Resource_ksrk6") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_dvtw0"] +[sub_resource type="Resource" id="Resource_ewdgb"] script = ExtResource("3_dpt5n") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.258824, 0.721569, 0.890196, 1)], ["block_type", 7], ["position", Vector2(0, 0)], ["block_format", "{int1: INT} > {int2: INT}"], ["statement", "({int1} > {int2})"], ["param_input_strings", { +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.258824, 0.721569, 0.890196, 1)], ["block_type", 7], ["position", Vector2(0, 0)], ["variant_type", ""], ["block_format", "{int1: INT} > {int2: INT}"], ["statement", "({int1} > {int2})"], ["param_input_strings", { "int1": "", "int2": "10" }]] -[sub_resource type="Resource" id="Resource_1u1so"] +[sub_resource type="Resource" id="Resource_rdvch"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_dvtw0") -path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_uf6rk")]] +serialized_block = SubResource("Resource_ewdgb") +path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_olf23")]] -[sub_resource type="Resource" id="Resource_uhqvg"] +[sub_resource type="Resource" id="Resource_sejec"] script = ExtResource("3_dpt5n") block_class = &"StatementBlock" serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(1, 0.678431, 0.462745, 1)], ["block_type", 1], ["position", Vector2(0, 0)], ["block_format", "Break"], ["statement", "break"], ["param_input_strings", {}]] -[sub_resource type="Resource" id="Resource_fy8vm"] +[sub_resource type="Resource" id="Resource_mhigi"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_uhqvg") +serialized_block = SubResource("Resource_sejec") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_pp866"] +[sub_resource type="Resource" id="Resource_whiw6"] script = ExtResource("3_dpt5n") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 4], ["position", Vector2(0, 0)], ["block_format", "Get Int {var: STRING}"], ["statement", "VAR_DICT[{var}]"], ["param_input_strings", { +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 4], ["position", Vector2(0, 0)], ["variant_type", ""], ["block_format", "Get Int {var: STRING}"], ["statement", "VAR_DICT[{var}]"], ["param_input_strings", { "var": "i" }]] -[sub_resource type="Resource" id="Resource_b5tjy"] +[sub_resource type="Resource" id="Resource_umisi"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_pp866") +serialized_block = SubResource("Resource_whiw6") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_eier4"] +[sub_resource type="Resource" id="Resource_h2uav"] script = ExtResource("3_dpt5n") block_class = &"ParameterBlock" -serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.188235, 0.258824, 0.772549, 1)], ["block_type", 4], ["position", Vector2(0, 0)], ["block_format", "{a: INT} + {b: INT}"], ["statement", "({a} + {b})"], ["param_input_strings", { +serialized_props = [["block_name", "parameter_block"], ["label", "Param"], ["color", Color(0.188235, 0.258824, 0.772549, 1)], ["block_type", 4], ["position", Vector2(0, 0)], ["variant_type", ""], ["block_format", "{a: INT} + {b: INT}"], ["statement", "({a} + {b})"], ["param_input_strings", { "a": "", "b": "1" }]] -[sub_resource type="Resource" id="Resource_22eo6"] +[sub_resource type="Resource" id="Resource_wisa3"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_eier4") -path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_b5tjy")]] +serialized_block = SubResource("Resource_h2uav") +path_child_pairs = [[NodePath("MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_umisi")]] -[sub_resource type="Resource" id="Resource_7xwek"] +[sub_resource type="Resource" id="Resource_q3ipb"] script = ExtResource("3_dpt5n") block_class = &"StatementBlock" serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 1], ["position", Vector2(0, 0)], ["block_format", "Set Int {var: STRING} {value: INT}"], ["statement", "VAR_DICT[{var}] = {value}"], ["param_input_strings", { @@ -888,151 +932,98 @@ serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock "var": "i" }]] -[sub_resource type="Resource" id="Resource_pcv7j"] +[sub_resource type="Resource" id="Resource_mt2r7"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_7xwek") -path_child_pairs = [[NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput21/SnapPoint"), SubResource("Resource_22eo6")]] +serialized_block = SubResource("Resource_q3ipb") +path_child_pairs = [[NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput21/SnapPoint"), SubResource("Resource_wisa3")]] -[sub_resource type="Resource" id="Resource_kqv2n"] +[sub_resource type="Resource" id="Resource_nqvn8"] script = ExtResource("3_dpt5n") block_class = &"ControlBlock" serialized_props = [["block_name", "control_block"], ["label", "Control Block"], ["color", Color(1, 0.678431, 0.462745, 1)], ["block_type", 1], ["position", Vector2(0, 0)], ["block_formats", ["if {cond: BOOL}"]], ["statements", ["if {cond}:"]], ["param_input_strings_array", [{ "cond": "" }]]] -[sub_resource type="Resource" id="Resource_mdqax"] +[sub_resource type="Resource" id="Resource_uyhky"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_kqv2n") -path_child_pairs = [[NodePath("VBoxContainer/MarginContainer/Rows/Row0/RowHBoxContainer/RowHBox/ParameterInput0/SnapPoint"), SubResource("Resource_1u1so")], [NodePath("VBoxContainer/MarginContainer/Rows/SnapContainer0/SnapPoint"), SubResource("Resource_fy8vm")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_pcv7j")]] +serialized_block = SubResource("Resource_nqvn8") +path_child_pairs = [[NodePath("VBoxContainer/MarginContainer/Rows/Row0/RowHBoxContainer/RowHBox/ParameterInput0/SnapPoint"), SubResource("Resource_rdvch")], [NodePath("VBoxContainer/MarginContainer/Rows/SnapContainer0/SnapPoint"), SubResource("Resource_mhigi")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_mt2r7")]] -[sub_resource type="Resource" id="Resource_k224i"] +[sub_resource type="Resource" id="Resource_y34qw"] script = ExtResource("3_dpt5n") block_class = &"StatementBlock" serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.6, 0.537255, 0.87451, 1)], ["block_type", 1], ["position", Vector2(0, 0)], ["block_format", "print {text: STRING}"], ["statement", "print({text})"], ["param_input_strings", { "text": "" }]] -[sub_resource type="Resource" id="Resource_mhgyb"] +[sub_resource type="Resource" id="Resource_nhre8"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_k224i") -path_child_pairs = [[NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_owugl")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_mdqax")]] +serialized_block = SubResource("Resource_y34qw") +path_child_pairs = [[NodePath("VBoxContainer/TopMarginContainer/MarginContainer/HBoxContainer/ParameterInput0/SnapPoint"), SubResource("Resource_gun6j")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_uyhky")]] -[sub_resource type="Resource" id="Resource_m8i55"] +[sub_resource type="Resource" id="Resource_5tcvy"] script = ExtResource("3_dpt5n") block_class = &"StatementBlock" serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.6, 0.537255, 0.87451, 1)], ["block_type", 1], ["position", Vector2(0, 0)], ["block_format", "print {text: STRING}"], ["statement", "print({text})"], ["param_input_strings", { "text": "" }]] -[sub_resource type="Resource" id="Resource_d047o"] +[sub_resource type="Resource" id="Resource_14qxb"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_m8i55") +serialized_block = SubResource("Resource_5tcvy") path_child_pairs = [] -[sub_resource type="Resource" id="Resource_1do6x"] +[sub_resource type="Resource" id="Resource_bxt0o"] script = ExtResource("3_dpt5n") block_class = &"StatementBlock" serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.6, 0.537255, 0.87451, 1)], ["block_type", 1], ["position", Vector2(0, 0)], ["block_format", "print {text: STRING}"], ["statement", "print({text})"], ["param_input_strings", { "text": "Counter done!" }]] -[sub_resource type="Resource" id="Resource_os2bn"] +[sub_resource type="Resource" id="Resource_pgxqi"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_1do6x") -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_d047o")]] +serialized_block = SubResource("Resource_bxt0o") +path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_14qxb")]] -[sub_resource type="Resource" id="Resource_5agyx"] +[sub_resource type="Resource" id="Resource_avniw"] script = ExtResource("3_dpt5n") block_class = &"ControlBlock" serialized_props = [["block_name", "control_block"], ["label", "Control Block"], ["color", Color(1, 0.678431, 0.462745, 1)], ["block_type", 1], ["position", Vector2(0, 0)], ["block_formats", ["while {bool: BOOL}"]], ["statements", ["while {bool}:"]], ["param_input_strings_array", [{ "bool": "" }]]] -[sub_resource type="Resource" id="Resource_mmldb"] +[sub_resource type="Resource" id="Resource_nvkwm"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_5agyx") -path_child_pairs = [[NodePath("VBoxContainer/MarginContainer/Rows/Row0/RowHBoxContainer/RowHBox/ParameterInput0/SnapPoint"), SubResource("Resource_sst32")], [NodePath("VBoxContainer/MarginContainer/Rows/SnapContainer0/SnapPoint"), SubResource("Resource_mhgyb")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_os2bn")]] +serialized_block = SubResource("Resource_avniw") +path_child_pairs = [[NodePath("VBoxContainer/MarginContainer/Rows/Row0/RowHBoxContainer/RowHBox/ParameterInput0/SnapPoint"), SubResource("Resource_tmjnh")], [NodePath("VBoxContainer/MarginContainer/Rows/SnapContainer0/SnapPoint"), SubResource("Resource_nhre8")], [NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_pgxqi")]] -[sub_resource type="Resource" id="Resource_m8fb7"] +[sub_resource type="Resource" id="Resource_gwoll"] script = ExtResource("3_dpt5n") block_class = &"StatementBlock" -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 1], ["position", Vector2(0, 0)], ["block_format", "Set Int {var: STRING} {value: INT}"], ["statement", "VAR_DICT[{var}] = {value}"], ["param_input_strings", { +serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.309804, 0.592157, 0.364706, 1)], ["block_type", 1], ["position", Vector2(735, 258)], ["block_format", "Set Int {var: STRING} {value: INT}"], ["statement", "VAR_DICT[{var}] = {value}"], ["param_input_strings", { "value": "0", "var": "i" }]] -[sub_resource type="Resource" id="Resource_4x04s"] -script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_m8fb7") -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_mmldb")]] - -[sub_resource type="Resource" id="Resource_rtf80"] -script = ExtResource("3_dpt5n") -block_class = &"StatementBlock" -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.6, 0.537255, 0.87451, 1)], ["block_type", 1], ["position", Vector2(0, 0)], ["block_format", "print {text: STRING}"], ["statement", "print({text})"], ["param_input_strings", { -"text": "Counter started." -}]] - -[sub_resource type="Resource" id="Resource_pgaf6"] -script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_rtf80") -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_4x04s")]] - -[sub_resource type="Resource" id="Resource_cjgk1"] -script = ExtResource("3_dpt5n") -block_class = &"StatementBlock" -serialized_props = [["block_name", "statement_block"], ["label", "StatementBlock"], ["color", Color(0.6, 0.537255, 0.87451, 1)], ["block_type", 1], ["position", Vector2(0, 0)], ["block_format", "print {text: STRING}"], ["statement", "print({text})"], ["param_input_strings", { -"text": "" -}]] - -[sub_resource type="Resource" id="Resource_jg6sb"] +[sub_resource type="Resource" id="Resource_1d8ji"] script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_cjgk1") -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_pgaf6")]] - -[sub_resource type="Resource" id="Resource_4yjs8"] -script = ExtResource("3_dpt5n") -block_class = &"EntryBlock" -serialized_props = [["block_name", "ready_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 2], ["position", Vector2(54, 47)], ["block_format", "On Ready"], ["statement", "func _ready():"], ["param_input_strings", {}]] +serialized_block = SubResource("Resource_gwoll") +path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_nvkwm")]] -[sub_resource type="Resource" id="Resource_3t3mv"] -script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_4yjs8") -path_child_pairs = [[NodePath("VBoxContainer/SnapPoint"), SubResource("Resource_jg6sb")]] - -[sub_resource type="Resource" id="Resource_1x1np"] -script = ExtResource("3_dpt5n") -block_class = &"EntryBlock" -serialized_props = [["block_name", "process_block"], ["label", "EntryBlock"], ["color", Color(0.980392, 0.34902, 0.337255, 1)], ["block_type", 2], ["position", Vector2(525, 48)], ["block_format", "On Process"], ["statement", "func _process(delta):"], ["param_input_strings", {}]] - -[sub_resource type="Resource" id="Resource_5dn3i"] -script = ExtResource("2_pqvcj") -serialized_block = SubResource("Resource_1x1np") -path_child_pairs = [] - -[sub_resource type="Resource" id="Resource_3a3d8"] +[sub_resource type="Resource" id="Resource_abw3p"] script = ExtResource("4_xt862") -array = Array[ExtResource("2_pqvcj")]([SubResource("Resource_3t3mv"), SubResource("Resource_5dn3i")]) +array = Array[ExtResource("2_pqvcj")]([SubResource("Resource_ojl58"), SubResource("Resource_ijbq4"), SubResource("Resource_lfxk2"), SubResource("Resource_4hg0u"), SubResource("Resource_1d8ji")]) [sub_resource type="Resource" id="Resource_bw4t7"] script = ExtResource("5_q37d3") script_inherits = "Node2D" -block_trees = SubResource("Resource_3a3d8") +block_trees = SubResource("Resource_abw3p") generated_script = "extends Node2D var VAR_DICT := {} func _ready(): - print('') - print('Counter started.') - VAR_DICT['i'] = 0 - while (VAR_DICT['i'] < 100): - print(str(VAR_DICT['i'])) - if (VAR_DICT['i'] > 10): - break - VAR_DICT['i'] = (VAR_DICT['i'] + 1) - print('Counter done!') - print('') + pass func _process(delta): pass