diff --git a/addons/block_code/ui/blocks/control_block/control_block.tscn b/addons/block_code/ui/blocks/control_block/control_block.tscn index c234cb20..bf85d1ba 100644 --- a/addons/block_code/ui/blocks/control_block/control_block.tscn +++ b/addons/block_code/ui/blocks/control_block/control_block.tscn @@ -47,6 +47,7 @@ layout_mode = 2 script = ExtResource("2_tx0qr") color = Color(1, 1, 1, 1) shift_bottom = 20.0 +block_type = 4 [node name="DragDropArea" parent="VBoxContainer/MarginContainer/Rows/Row" instance=ExtResource("3_21e8n")] layout_mode = 2 @@ -92,6 +93,8 @@ size_flags_horizontal = 0 script = ExtResource("2_tx0qr") color = Color(1, 1, 1, 1) shift_top = 20.0 +block_type = 4 +control_part = 1 [node name="SnapPoint" parent="VBoxContainer" instance=ExtResource("3_nhryi")] layout_mode = 2 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 27404035..d65c7470 100644 --- a/addons/block_code/ui/blocks/entry_block/entry_block.tscn +++ b/addons/block_code/ui/blocks/entry_block/entry_block.tscn @@ -42,6 +42,7 @@ mouse_filter = 1 script = ExtResource("2_yrw8l") color = Color(1, 1, 1, 1) is_round_top = true +block_type = 1 [node name="DragDropArea" parent="VBoxContainer/TopMarginContainer" instance=ExtResource("3_swkpp")] layout_mode = 2 diff --git a/addons/block_code/ui/blocks/utilities/background/background.gd b/addons/block_code/ui/blocks/utilities/background/background.gd index c686f2a1..ff4b5639 100644 --- a/addons/block_code/ui/blocks/utilities/background/background.gd +++ b/addons/block_code/ui/blocks/utilities/background/background.gd @@ -3,6 +3,12 @@ extends Control const BlockTreeUtil = preload("res://addons/block_code/ui/block_tree_util.gd") const Constants = preload("res://addons/block_code/ui/constants.gd") +const Types = preload("res://addons/block_code/types/types.gd") + +enum ControlPart { + TOP, + BOTTOM, +} var outline_color: Color var parent_block: Block @@ -30,6 +36,14 @@ var parent_block: Block @export var is_round_top: bool = false: set = _set_is_round_top +@export var block_type: Types.BlockType = Types.BlockType.STATEMENT: + set = _set_block_type + +## Only relevant if block_type is CONTROL. +@export var control_part: ControlPart = ControlPart.TOP: + set = _set_control_part + +## Only relevant if block_type is VALUE. @export var is_pointy: bool = false: set = _set_is_pointy @@ -75,6 +89,16 @@ func _set_is_pointy(new_is_pointy): queue_redraw() +func _set_block_type(new_block_type): + block_type = new_block_type + queue_redraw() + + +func _set_control_part(new_control_part): + control_part = new_control_part + queue_redraw() + + func _ready(): # I think the parent block should get the child but this works parent_block = BlockTreeUtil.get_parent_block(self) @@ -85,6 +109,30 @@ func _ready(): func _draw(): + if block_type == Types.BlockType.ENTRY: + # FIXME draw entry + pass + elif block_type == Types.BlockType.CONTROL: + if control_part == ControlPart.TOP: + # FIXME draw control top + pass + else: + # FIXME draw control bottom + pass + elif block_type == Types.BlockType.VALUE: + if is_pointy: + # FIXME draw pointy value + pass + else: + # FIXME draw round value + pass + elif block_type == Types.BlockType.STATEMENT: + # FIXME draw statement + pass + return _old_draw() + + +func _old_draw(): var top_left_align := Constants.KNOB_X + shift_top var bottom_left_align := Constants.KNOB_X + shift_bottom var top_knob: PackedVector2Array diff --git a/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn b/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn index 85c7b845..f3483a66 100644 --- a/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn +++ b/addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.tscn @@ -51,6 +51,7 @@ color = Color(1, 1, 1, 1) draw_outline = false show_top = false show_bottom = false +block_type = 3 [node name="Panel" type="Panel" parent="."] unique_name_in_owner = true @@ -237,7 +238,6 @@ action_mode = 1 selected = 0 item_count = 2 popup/item_0/text = "false" -popup/item_0/id = 0 popup/item_1/text = "true" popup/item_1/id = 1