Skip to content

Commit e1857a8

Browse files
committed
fixup! Entry restyle and hexagonal booleans
background_variant -> is_pointy
1 parent eab05df commit e1857a8

File tree

4 files changed

+24
-28
lines changed

4 files changed

+24
-28
lines changed

addons/block_code/ui/blocks/parameter_block/parameter_block.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func _ready():
2121

2222
if not definition == null and definition.variant_type == Variant.Type.TYPE_BOOL:
2323
_background.visible = true
24-
_background.background_variant = _background.POINTED
24+
_background.is_pointy = true
2525
_background.color = color
2626
_panel.visible = false
2727
else:

addons/block_code/ui/blocks/utilities/background/background.gd

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ enum { BODY, HEADER }
3333
@export var top_variant := BODY:
3434
set = _set_top_variant
3535

36-
enum { FLAT, POINTED }
37-
38-
## Style of the background |FLAT|, <POINTED>
39-
@export var background_variant := FLAT:
40-
set = _set_background_variant
36+
@export var is_pointy: bool = false:
37+
set = _set_is_pointy
4138

4239

4340
func _set_color(new_color):
@@ -76,8 +73,8 @@ func _set_top_variant(new_variant):
7673
queue_redraw()
7774

7875

79-
func _set_background_variant(new_variant):
80-
background_variant = clamp(new_variant, FLAT, POINTED)
76+
func _set_is_pointy(new_is_pointy):
77+
is_pointy = new_is_pointy
8178
queue_redraw()
8279

8380

@@ -127,7 +124,7 @@ func _draw():
127124
fill_polygon.append_array(top_knob)
128125

129126
# Right side
130-
if background_variant == POINTED:
127+
if is_pointy:
131128
# Top
132129
fill_polygon.append(Vector2(size.x - Constants.POINTY_WIDTH, 0.0))
133130

@@ -147,7 +144,7 @@ func _draw():
147144
fill_polygon.append(Vector2(bottom_left_align, size.y))
148145

149146
# Left side
150-
if background_variant == POINTED:
147+
if is_pointy:
151148
# Bottom
152149
fill_polygon.append(Vector2(Constants.POINTY_WIDTH, size.y))
153150

@@ -168,7 +165,7 @@ func _draw():
168165
var outline_middle := Constants.OUTLINE_WIDTH / 2
169166

170167
# Top line
171-
if background_variant == POINTED:
168+
if is_pointy:
172169
stroke_polygon.append(Vector2(shift_top - (0.0 if not shift_top > 0 else outline_middle) + Constants.POINTY_WIDTH, 0.0))
173170
else:
174171
stroke_polygon.append(Vector2(shift_top - (0.0 if not shift_top > 0 else outline_middle), 0.0))
@@ -177,7 +174,7 @@ func _draw():
177174
stroke_polygon.append_array(top_knob)
178175

179176
# Right line
180-
if background_variant == POINTED:
177+
if is_pointy:
181178
# Top
182179
stroke_polygon.append(Vector2(size.x - Constants.POINTY_WIDTH, 0.0))
183180

@@ -197,7 +194,7 @@ func _draw():
197194
stroke_polygon.append(Vector2(bottom_left_align, size.y))
198195

199196
# Left line
200-
if background_variant == POINTED:
197+
if is_pointy:
201198
stroke_polygon.append(Vector2(shift_bottom - (outline_middle if shift_bottom > 0 else 0.0) + Constants.POINTY_WIDTH, size.y))
202199
edge_polygon.append(Vector2(Constants.POINTY_WIDTH + outline_middle, 0.0))
203200

addons/block_code/ui/blocks/utilities/background/gutter.gd

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ var parent_block: Block
1010
@export var color: Color:
1111
set = _set_color
1212

13-
## Variant
14-
@export var background_variant := false:
15-
set = _set_background_variant
13+
@export var is_pointy: bool = false:
14+
set = _set_is_pointy
1615

1716

1817
func _set_color(new_color):
@@ -21,8 +20,8 @@ func _set_color(new_color):
2120
queue_redraw()
2221

2322

24-
func _set_background_variant(new_variant):
25-
background_variant = new_variant
23+
func _set_is_pointy(new_is_pointy):
24+
is_pointy = new_is_pointy
2625
queue_redraw()
2726

2827

@@ -34,20 +33,20 @@ func _ready():
3433

3534
func _draw():
3635
var fill_polygon: PackedVector2Array
37-
fill_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, 0.0))
38-
fill_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), 0.0))
39-
fill_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), size.y))
40-
fill_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, size.y))
41-
fill_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, 0.0))
36+
fill_polygon.append(Vector2(Constants.POINTY_WIDTH if is_pointy else 0.0, 0.0))
37+
fill_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if is_pointy else 0.0), 0.0))
38+
fill_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if is_pointy else 0.0), size.y))
39+
fill_polygon.append(Vector2(Constants.POINTY_WIDTH if is_pointy else 0.0, size.y))
40+
fill_polygon.append(Vector2(Constants.POINTY_WIDTH if is_pointy else 0.0, 0.0))
4241

4342
var left_polygon: PackedVector2Array
4443
var right_polygon: PackedVector2Array
4544

46-
left_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, 0.0))
47-
left_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, size.y))
45+
left_polygon.append(Vector2(Constants.POINTY_WIDTH if is_pointy else 0.0, 0.0))
46+
left_polygon.append(Vector2(Constants.POINTY_WIDTH if is_pointy else 0.0, size.y))
4847

49-
right_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), 0.0))
50-
right_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), size.y))
48+
right_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if is_pointy else 0.0), 0.0))
49+
right_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if is_pointy else 0.0), size.y))
5150

5251
draw_colored_polygon(fill_polygon, color)
5352
draw_polyline(left_polygon, Constants.FOCUS_BORDER_COLOR if parent_block.has_focus() else outline_color, Constants.OUTLINE_WIDTH)

addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func _update_visible_input():
217217
TYPE_VECTOR2:
218218
_switch_input(_vector2_input)
219219
TYPE_BOOL:
220-
_background.background_variant = _background.POINTED
220+
_background.is_pointy = true
221221
_switch_input(_bool_input)
222222
_:
223223
_switch_input(_text_input)

0 commit comments

Comments
 (0)