Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
manuq committed Nov 22, 2024
1 parent 8c4b024 commit 58349d0
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
3 changes: 3 additions & 0 deletions addons/block_code/ui/blocks/control_block/control_block.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/ui/blocks/entry_block/entry_block.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 48 additions & 0 deletions addons/block_code/ui/blocks/utilities/background/background.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 58349d0

Please sign in to comment.