Skip to content

Commit 357df54

Browse files
DoomTas3rmanuq
authored andcommitted
Entry restyle and hexagonal booleans
1 parent 3cfcf76 commit 357df54

File tree

9 files changed

+248
-76
lines changed

9 files changed

+248
-76
lines changed

addons/block_code/ui/blocks/entry_block/entry_block.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ extends StatementBlock
99
func _ready():
1010
super()
1111
bottom_snap = null
12+
_background.show_top = true
1213

1314

1415
static func get_block_class():

addons/block_code/ui/blocks/entry_block/entry_block.tscn

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ layout_mode = 2
1919
mouse_filter = 2
2020
theme_override_constants/separation = 0
2121

22+
[node name="DragDropArea2" parent="VBoxContainer" instance=ExtResource("3_swkpp")]
23+
custom_minimum_size = Vector2(80, 16)
24+
layout_mode = 2
25+
size_flags_horizontal = 0
26+
mouse_default_cursor_shape = 2
27+
2228
[node name="TopMarginContainer" type="MarginContainer" parent="VBoxContainer"]
2329
custom_minimum_size = Vector2(0, 30)
2430
layout_mode = 2
@@ -35,7 +41,7 @@ layout_mode = 2
3541
mouse_filter = 1
3642
script = ExtResource("2_yrw8l")
3743
color = Color(1, 1, 1, 1)
38-
show_top = false
44+
top_variant = 1
3945

4046
[node name="DragDropArea" parent="VBoxContainer/TopMarginContainer" instance=ExtResource("3_swkpp")]
4147
layout_mode = 2
@@ -56,4 +62,8 @@ layout_mode = 2
5662
[node name="SnapPoint" parent="VBoxContainer" instance=ExtResource("4_yj206")]
5763
layout_mode = 2
5864

65+
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
66+
layout_mode = 2
67+
68+
[connection signal="drag_started" from="VBoxContainer/DragDropArea2" to="." method="_on_drag_drop_area_drag_started"]
5969
[connection signal="drag_started" from="VBoxContainer/TopMarginContainer/DragDropArea" to="." method="_on_drag_drop_area_drag_started"]

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

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const Constants = preload("res://addons/block_code/ui/constants.gd")
66
const Util = preload("res://addons/block_code/ui/util.gd")
77
const ParameterOutput = preload("res://addons/block_code/ui/blocks/utilities/parameter_output/parameter_output.gd")
88

9+
@onready var _background := $Background
910
@onready var _panel := $Panel
1011

1112
var args_to_add_after_format: Dictionary # Only used when loading
@@ -18,16 +19,22 @@ var _panel_focus: StyleBox
1819
func _ready():
1920
super()
2021

21-
_panel_normal = _panel.get_theme_stylebox("panel").duplicate()
22-
_panel_normal.bg_color = color
23-
_panel_normal.border_color = color.darkened(0.2)
22+
if not definition == null and definition.variant_type == Variant.Type.TYPE_BOOL:
23+
_background.visible = true
24+
_background.background_variant = _background.POINTED
25+
_background.color = color
26+
_panel.visible = false
27+
else:
28+
_panel_normal = _panel.get_theme_stylebox("panel").duplicate()
29+
_panel_normal.bg_color = color
30+
_panel_normal.border_color = color.darkened(0.2)
2431

25-
_panel_focus = _panel.get_theme_stylebox("panel").duplicate()
26-
_panel_focus.bg_color = color
27-
_panel_focus.border_color = Constants.FOCUS_BORDER_COLOR
32+
_panel_focus = _panel.get_theme_stylebox("panel").duplicate()
33+
_panel_focus.bg_color = color
34+
_panel_focus.border_color = Constants.FOCUS_BORDER_COLOR
2835

29-
if not Util.node_is_part_of_edited_scene(self):
30-
_panel.add_theme_stylebox_override("panel", _panel_normal)
36+
if not Util.node_is_part_of_edited_scene(self):
37+
_panel.add_theme_stylebox_override("panel", _panel_normal)
3138

3239

3340
func _on_drag_drop_area_drag_started(offset: Vector2) -> void:
@@ -43,8 +50,10 @@ static func get_scene_path():
4350

4451

4552
func _on_focus_entered():
46-
_panel.add_theme_stylebox_override("panel", _panel_focus)
53+
if not definition == null and not definition.variant_type == Variant.Type.TYPE_BOOL:
54+
_panel.add_theme_stylebox_override("panel", _panel_focus)
4755

4856

4957
func _on_focus_exited():
50-
_panel.add_theme_stylebox_override("panel", _panel_normal)
58+
if not definition == null and not definition.variant_type == Variant.Type.TYPE_BOOL:
59+
_panel.add_theme_stylebox_override("panel", _panel_normal)

addons/block_code/ui/blocks/parameter_block/parameter_block.tscn

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
[gd_scene load_steps=5 format=3 uid="uid://clipm2dd28jde"]
1+
[gd_scene load_steps=6 format=3 uid="uid://clipm2dd28jde"]
22

33
[ext_resource type="Script" path="res://addons/block_code/ui/blocks/parameter_block/parameter_block.gd" id="1_0hajy"]
44
[ext_resource type="PackedScene" uid="uid://c7puyxpqcq6xo" path="res://addons/block_code/ui/blocks/utilities/drag_drop_area/drag_drop_area.tscn" id="2_0eadx"]
5+
[ext_resource type="Script" path="res://addons/block_code/ui/blocks/utilities/background/background.gd" id="2_2q1xr"]
56
[ext_resource type="PackedScene" uid="uid://b1xvp3u11h41s" path="res://addons/block_code/ui/blocks/utilities/template_editor/template_editor.tscn" id="3_shl1a"]
67

78
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dbera"]
@@ -14,6 +15,10 @@ corner_radius_top_left = 16
1415
corner_radius_top_right = 16
1516
corner_radius_bottom_right = 16
1617
corner_radius_bottom_left = 16
18+
expand_margin_left = 2.0
19+
expand_margin_top = 2.0
20+
expand_margin_right = 2.0
21+
expand_margin_bottom = 2.0
1722

1823
[node name="ParameterBlock" type="MarginContainer" node_paths=PackedStringArray("template_editor")]
1924
offset_right = 16.0
@@ -24,6 +29,15 @@ mouse_filter = 2
2429
script = ExtResource("1_0hajy")
2530
template_editor = NodePath("MarginContainer/TemplateEditor")
2631

32+
[node name="Background" type="Control" parent="."]
33+
unique_name_in_owner = true
34+
visible = false
35+
layout_mode = 2
36+
script = ExtResource("2_2q1xr")
37+
color = Color(1, 1, 1, 1)
38+
show_top = false
39+
show_bottom = false
40+
2741
[node name="Panel" type="Panel" parent="."]
2842
unique_name_in_owner = true
2943
layout_mode = 2
@@ -36,15 +50,15 @@ mouse_default_cursor_shape = 2
3650
[node name="MarginContainer" type="MarginContainer" parent="."]
3751
layout_mode = 2
3852
mouse_filter = 2
53+
theme_override_constants/margin_left = 10
54+
theme_override_constants/margin_top = 6
55+
theme_override_constants/margin_right = 10
56+
theme_override_constants/margin_bottom = 6
3957

4058
[node name="TemplateEditor" parent="MarginContainer" instance=ExtResource("3_shl1a")]
4159
unique_name_in_owner = true
4260
layout_mode = 2
4361
size_flags_horizontal = 0
44-
theme_override_constants/margin_left = 10
45-
theme_override_constants/margin_top = 8
46-
theme_override_constants/margin_right = 10
47-
theme_override_constants/margin_bottom = 8
4862

4963
[connection signal="focus_entered" from="." to="." method="_on_focus_entered"]
5064
[connection signal="focus_exited" from="." to="." method="_on_focus_exited"]

0 commit comments

Comments
 (0)