From 357df540302d4d4468e8c08b6e4671dceb7845c8 Mon Sep 17 00:00:00 2001 From: Daze Date: Mon, 14 Oct 2024 14:06:48 +0000 Subject: [PATCH 1/5] Entry restyle and hexagonal booleans --- .../ui/blocks/entry_block/entry_block.gd | 1 + .../ui/blocks/entry_block/entry_block.tscn | 12 +- .../blocks/parameter_block/parameter_block.gd | 29 ++- .../parameter_block/parameter_block.tscn | 24 +- .../blocks/utilities/background/background.gd | 212 ++++++++++++++---- .../ui/blocks/utilities/background/gutter.gd | 27 ++- .../parameter_input/parameter_input.gd | 5 +- .../parameter_input/parameter_input.tscn | 13 +- addons/block_code/ui/constants.gd | 1 + 9 files changed, 248 insertions(+), 76 deletions(-) diff --git a/addons/block_code/ui/blocks/entry_block/entry_block.gd b/addons/block_code/ui/blocks/entry_block/entry_block.gd index 22a8b58d..3f8eb703 100644 --- a/addons/block_code/ui/blocks/entry_block/entry_block.gd +++ b/addons/block_code/ui/blocks/entry_block/entry_block.gd @@ -9,6 +9,7 @@ extends StatementBlock func _ready(): super() bottom_snap = null + _background.show_top = true static func get_block_class(): 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 3419c956..3c0ed713 100644 --- a/addons/block_code/ui/blocks/entry_block/entry_block.tscn +++ b/addons/block_code/ui/blocks/entry_block/entry_block.tscn @@ -19,6 +19,12 @@ layout_mode = 2 mouse_filter = 2 theme_override_constants/separation = 0 +[node name="DragDropArea2" parent="VBoxContainer" instance=ExtResource("3_swkpp")] +custom_minimum_size = Vector2(80, 16) +layout_mode = 2 +size_flags_horizontal = 0 +mouse_default_cursor_shape = 2 + [node name="TopMarginContainer" type="MarginContainer" parent="VBoxContainer"] custom_minimum_size = Vector2(0, 30) layout_mode = 2 @@ -35,7 +41,7 @@ layout_mode = 2 mouse_filter = 1 script = ExtResource("2_yrw8l") color = Color(1, 1, 1, 1) -show_top = false +top_variant = 1 [node name="DragDropArea" parent="VBoxContainer/TopMarginContainer" instance=ExtResource("3_swkpp")] layout_mode = 2 @@ -56,4 +62,8 @@ layout_mode = 2 [node name="SnapPoint" parent="VBoxContainer" instance=ExtResource("4_yj206")] layout_mode = 2 +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"] +layout_mode = 2 + +[connection signal="drag_started" from="VBoxContainer/DragDropArea2" to="." method="_on_drag_drop_area_drag_started"] [connection signal="drag_started" from="VBoxContainer/TopMarginContainer/DragDropArea" to="." method="_on_drag_drop_area_drag_started"] 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 f12ebf1b..afa1643c 100644 --- a/addons/block_code/ui/blocks/parameter_block/parameter_block.gd +++ b/addons/block_code/ui/blocks/parameter_block/parameter_block.gd @@ -6,6 +6,7 @@ const Constants = preload("res://addons/block_code/ui/constants.gd") const Util = preload("res://addons/block_code/ui/util.gd") const ParameterOutput = preload("res://addons/block_code/ui/blocks/utilities/parameter_output/parameter_output.gd") +@onready var _background := $Background @onready var _panel := $Panel var args_to_add_after_format: Dictionary # Only used when loading @@ -18,16 +19,22 @@ var _panel_focus: StyleBox func _ready(): super() - _panel_normal = _panel.get_theme_stylebox("panel").duplicate() - _panel_normal.bg_color = color - _panel_normal.border_color = color.darkened(0.2) + if not definition == null and definition.variant_type == Variant.Type.TYPE_BOOL: + _background.visible = true + _background.background_variant = _background.POINTED + _background.color = color + _panel.visible = false + else: + _panel_normal = _panel.get_theme_stylebox("panel").duplicate() + _panel_normal.bg_color = color + _panel_normal.border_color = color.darkened(0.2) - _panel_focus = _panel.get_theme_stylebox("panel").duplicate() - _panel_focus.bg_color = color - _panel_focus.border_color = Constants.FOCUS_BORDER_COLOR + _panel_focus = _panel.get_theme_stylebox("panel").duplicate() + _panel_focus.bg_color = color + _panel_focus.border_color = Constants.FOCUS_BORDER_COLOR - if not Util.node_is_part_of_edited_scene(self): - _panel.add_theme_stylebox_override("panel", _panel_normal) + if not Util.node_is_part_of_edited_scene(self): + _panel.add_theme_stylebox_override("panel", _panel_normal) func _on_drag_drop_area_drag_started(offset: Vector2) -> void: @@ -43,8 +50,10 @@ static func get_scene_path(): func _on_focus_entered(): - _panel.add_theme_stylebox_override("panel", _panel_focus) + if not definition == null and not definition.variant_type == Variant.Type.TYPE_BOOL: + _panel.add_theme_stylebox_override("panel", _panel_focus) func _on_focus_exited(): - _panel.add_theme_stylebox_override("panel", _panel_normal) + if not definition == null and not definition.variant_type == Variant.Type.TYPE_BOOL: + _panel.add_theme_stylebox_override("panel", _panel_normal) 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 4109d0c8..4a822ef6 100644 --- a/addons/block_code/ui/blocks/parameter_block/parameter_block.tscn +++ b/addons/block_code/ui/blocks/parameter_block/parameter_block.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=5 format=3 uid="uid://clipm2dd28jde"] +[gd_scene load_steps=6 format=3 uid="uid://clipm2dd28jde"] [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_0eadx"] +[ext_resource type="Script" path="res://addons/block_code/ui/blocks/utilities/background/background.gd" id="2_2q1xr"] [ext_resource type="PackedScene" uid="uid://b1xvp3u11h41s" path="res://addons/block_code/ui/blocks/utilities/template_editor/template_editor.tscn" id="3_shl1a"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dbera"] @@ -14,6 +15,10 @@ corner_radius_top_left = 16 corner_radius_top_right = 16 corner_radius_bottom_right = 16 corner_radius_bottom_left = 16 +expand_margin_left = 2.0 +expand_margin_top = 2.0 +expand_margin_right = 2.0 +expand_margin_bottom = 2.0 [node name="ParameterBlock" type="MarginContainer" node_paths=PackedStringArray("template_editor")] offset_right = 16.0 @@ -24,6 +29,15 @@ mouse_filter = 2 script = ExtResource("1_0hajy") template_editor = NodePath("MarginContainer/TemplateEditor") +[node name="Background" type="Control" parent="."] +unique_name_in_owner = true +visible = false +layout_mode = 2 +script = ExtResource("2_2q1xr") +color = Color(1, 1, 1, 1) +show_top = false +show_bottom = false + [node name="Panel" type="Panel" parent="."] unique_name_in_owner = true layout_mode = 2 @@ -36,15 +50,15 @@ mouse_default_cursor_shape = 2 [node name="MarginContainer" type="MarginContainer" parent="."] layout_mode = 2 mouse_filter = 2 +theme_override_constants/margin_left = 10 +theme_override_constants/margin_top = 6 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 6 [node name="TemplateEditor" parent="MarginContainer" instance=ExtResource("3_shl1a")] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 0 -theme_override_constants/margin_left = 10 -theme_override_constants/margin_top = 8 -theme_override_constants/margin_right = 10 -theme_override_constants/margin_bottom = 8 [connection signal="focus_entered" from="." to="." method="_on_focus_entered"] [connection signal="focus_exited" from="." to="." method="_on_focus_exited"] diff --git a/addons/block_code/ui/blocks/utilities/background/background.gd b/addons/block_code/ui/blocks/utilities/background/background.gd index adf74799..dc1658b6 100644 --- a/addons/block_code/ui/blocks/utilities/background/background.gd +++ b/addons/block_code/ui/blocks/utilities/background/background.gd @@ -10,9 +10,15 @@ var parent_block: Block @export var color: Color: set = _set_color +@export var draw_outline: bool = true: + set = _set_draw_outline + @export var show_top: bool = true: set = _set_show_top +@export var show_bottom: bool = true: + set = _set_show_bottom + ## Horizontally shift the top knob @export var shift_top: float = 0.0: set = _set_shift_top @@ -21,6 +27,18 @@ var parent_block: Block @export var shift_bottom: float = 0.0: set = _set_shift_bottom +enum { BODY, HEADER } + +## Style of the top knob +@export var top_variant := BODY: + set = _set_top_variant + +enum { FLAT, POINTED } + +## Style of the background |FLAT|, +@export var background_variant := FLAT: + set = _set_background_variant + func _set_color(new_color): color = new_color @@ -28,11 +46,21 @@ func _set_color(new_color): queue_redraw() +func _set_draw_outline(new_outline): + draw_outline = new_outline + queue_redraw() + + func _set_show_top(new_show_top): show_top = new_show_top queue_redraw() +func _set_show_bottom(new_show_bottom): + show_bottom = new_show_bottom + queue_redraw() + + func _set_shift_top(new_shift_top): shift_top = new_shift_top queue_redraw() @@ -43,67 +71,153 @@ func _set_shift_bottom(new_shift_bottom): queue_redraw() +func _set_top_variant(new_variant): + top_variant = clamp(new_variant, BODY, HEADER) + queue_redraw() + + +func _set_background_variant(new_variant): + background_variant = clamp(new_variant, FLAT, POINTED) + queue_redraw() + + func _ready(): + # I think the parent block should get the child but this works parent_block = BlockTreeUtil.get_parent_block(self) - parent_block.focus_entered.connect(queue_redraw) - parent_block.focus_exited.connect(queue_redraw) + + if not parent_block == null: + parent_block.focus_entered.connect(queue_redraw) + parent_block.focus_exited.connect(queue_redraw) func _draw(): + var top_left_align := Constants.KNOB_X + shift_top + var bottom_left_align := Constants.KNOB_X + shift_bottom + var top_knob: PackedVector2Array var fill_polygon: PackedVector2Array fill_polygon.append(Vector2(0.0, 0.0)) - if show_top: - fill_polygon.append(Vector2(Constants.KNOB_X + shift_top, 0.0)) - fill_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z + shift_top, Constants.KNOB_H)) - fill_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z + Constants.KNOB_W + shift_top, Constants.KNOB_H)) - fill_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z * 2 + Constants.KNOB_W + shift_top, 0.0)) - - fill_polygon.append(Vector2(size.x, 0.0)) - fill_polygon.append(Vector2(size.x, size.y)) - fill_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z * 2 + Constants.KNOB_W + shift_bottom, size.y)) - fill_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z + Constants.KNOB_W + shift_bottom, size.y + Constants.KNOB_H)) - fill_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z + shift_bottom, size.y + Constants.KNOB_H)) - fill_polygon.append(Vector2(Constants.KNOB_X + shift_bottom, size.y)) - fill_polygon.append(Vector2(0.0, size.y)) - fill_polygon.append(Vector2(0.0, 0.0)) - - var stroke_polygon: PackedVector2Array - var edge_polygon: PackedVector2Array - var outline_middle = Constants.OUTLINE_WIDTH / 2 - - if shift_top > 0: - stroke_polygon.append(Vector2(shift_top - outline_middle, 0.0)) - else: - stroke_polygon.append(Vector2(shift_top, 0.0)) if show_top: - stroke_polygon.append(Vector2(Constants.KNOB_X + shift_top, 0.0)) - stroke_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z + shift_top, Constants.KNOB_H)) - stroke_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z + Constants.KNOB_W + shift_top, Constants.KNOB_H)) - stroke_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z * 2 + Constants.KNOB_W + shift_top, 0.0)) - - stroke_polygon.append(Vector2(size.x, 0.0)) - stroke_polygon.append(Vector2(size.x, size.y)) - stroke_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z * 2 + Constants.KNOB_W + shift_bottom, size.y)) - stroke_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z + Constants.KNOB_W + shift_bottom, size.y + Constants.KNOB_H)) - stroke_polygon.append(Vector2(Constants.KNOB_X + Constants.KNOB_Z + shift_bottom, size.y + Constants.KNOB_H)) - stroke_polygon.append(Vector2(Constants.KNOB_X + shift_bottom, size.y)) - - if shift_bottom > 0: - stroke_polygon.append(Vector2(shift_bottom - outline_middle, size.y)) + if top_variant == HEADER: + top_knob.append_array( + [ + Vector2(5, -4.012612), + Vector2(10, -7.240165), + Vector2(15, -9.822201), + Vector2(20, -11.84718), + Vector2(25, -13.37339), + Vector2(30, -14.43944), + Vector2(35, -15.06994), + Vector2(40, -15.27864), + Vector2(45, -15.06994), + Vector2(50, -14.43944), + Vector2(55, -13.37339), + Vector2(60, -11.84718), + Vector2(65, -9.822201), + Vector2(70, -7.240165), + Vector2(75, -4.012612), + Vector2(80, 0) + ] + ) + else: + top_knob.append(Vector2(top_left_align, 0.0)) + top_knob.append(Vector2(top_left_align + Constants.KNOB_Z, Constants.KNOB_H)) + top_knob.append(Vector2(top_left_align + Constants.KNOB_Z + Constants.KNOB_W, Constants.KNOB_H)) + top_knob.append(Vector2(top_left_align + Constants.KNOB_Z * 2 + Constants.KNOB_W, 0.0)) + fill_polygon.append_array(top_knob) + + # Right side + if background_variant == POINTED: + # Top + fill_polygon.append(Vector2(size.x - Constants.POINT_WIDTH, 0.0)) + + # Middle + fill_polygon.append(Vector2(size.x, size.y / 2.0)) + + # Bottom + fill_polygon.append(Vector2(size.x - Constants.POINT_WIDTH, size.y)) else: - stroke_polygon.append(Vector2(shift_bottom, size.y)) + fill_polygon.append(Vector2(size.x, 0.0)) + fill_polygon.append(Vector2(size.x, size.y)) - if shift_top > 0: - edge_polygon.append(Vector2(0.0, 0.0)) - else: - edge_polygon.append(Vector2(0.0, 0.0 - outline_middle)) + if show_bottom: + fill_polygon.append(Vector2(bottom_left_align + Constants.KNOB_Z * 2 + Constants.KNOB_W, size.y)) + fill_polygon.append(Vector2(bottom_left_align + Constants.KNOB_Z + Constants.KNOB_W, size.y + Constants.KNOB_H)) + fill_polygon.append(Vector2(bottom_left_align + Constants.KNOB_Z, size.y + Constants.KNOB_H)) + fill_polygon.append(Vector2(bottom_left_align, size.y)) - if shift_bottom > 0: - edge_polygon.append(Vector2(0.0, size.y)) + # Left side + if background_variant == POINTED: + # Bottom + fill_polygon.append(Vector2(Constants.POINT_WIDTH, size.y)) + + # Middle + fill_polygon.append(Vector2(0.0, size.y / 2.0)) + + # Top + fill_polygon.append(Vector2(Constants.POINT_WIDTH, 0.0)) else: - edge_polygon.append(Vector2(0.0, size.y + outline_middle)) + fill_polygon.append(Vector2(0.0, size.y)) + fill_polygon.append(Vector2(0.0, 0.0)) draw_colored_polygon(fill_polygon, color) - draw_polyline(stroke_polygon, Constants.FOCUS_BORDER_COLOR if parent_block.has_focus() else outline_color, Constants.OUTLINE_WIDTH) - draw_polyline(edge_polygon, Constants.FOCUS_BORDER_COLOR if parent_block.has_focus() else outline_color, Constants.OUTLINE_WIDTH) + + if draw_outline: + var stroke_polygon: PackedVector2Array + var edge_polygon: PackedVector2Array + var outline_middle := Constants.OUTLINE_WIDTH / 2 + + # Top line + if background_variant == POINTED: + stroke_polygon.append(Vector2(shift_top - (0.0 if not shift_top > 0 else outline_middle) + Constants.POINT_WIDTH, 0.0)) + else: + stroke_polygon.append(Vector2(shift_top - (0.0 if not shift_top > 0 else outline_middle), 0.0)) + + if show_top: + stroke_polygon.append_array(top_knob) + + # Right line + if background_variant == POINTED: + # Top + stroke_polygon.append(Vector2(size.x - Constants.POINT_WIDTH, 0.0)) + + # Middle + stroke_polygon.append(Vector2(size.x, size.y / 2.0)) + + # Bottom + stroke_polygon.append(Vector2(size.x - Constants.POINT_WIDTH, size.y)) + else: + stroke_polygon.append(Vector2(size.x, 0.0)) + stroke_polygon.append(Vector2(size.x, size.y)) + + if show_bottom: + stroke_polygon.append(Vector2(bottom_left_align + Constants.KNOB_Z * 2 + Constants.KNOB_W, size.y)) + stroke_polygon.append(Vector2(bottom_left_align + Constants.KNOB_Z + Constants.KNOB_W, size.y + Constants.KNOB_H)) + stroke_polygon.append(Vector2(bottom_left_align + Constants.KNOB_Z, size.y + Constants.KNOB_H)) + stroke_polygon.append(Vector2(bottom_left_align, size.y)) + + # Left line + if background_variant == POINTED: + stroke_polygon.append(Vector2(shift_bottom - (outline_middle if shift_bottom > 0 else 0.0) + Constants.POINT_WIDTH, size.y)) + edge_polygon.append(Vector2(Constants.POINT_WIDTH + outline_middle, 0.0)) + + # Top + edge_polygon.append(Vector2(Constants.POINT_WIDTH, 0.0)) + + # Middle + edge_polygon.append(Vector2(0.0, size.y / 2.0)) + + # Bottom + edge_polygon.append(Vector2(Constants.POINT_WIDTH, size.y)) + edge_polygon.append(Vector2(Constants.POINT_WIDTH + outline_middle, size.y)) + else: + stroke_polygon.append(Vector2(shift_bottom - (outline_middle if shift_bottom > 0 else 0.0), size.y)) + edge_polygon.append(Vector2(0.0, 0.0 - (0.0 if shift_top > 0 else outline_middle))) + edge_polygon.append(Vector2(0.0, size.y + (0.0 if shift_bottom > 0 else outline_middle))) + + if parent_block == null: + draw_polyline(stroke_polygon, outline_color, Constants.OUTLINE_WIDTH) + draw_polyline(edge_polygon, outline_color, Constants.OUTLINE_WIDTH) + else: + draw_polyline(stroke_polygon, Constants.FOCUS_BORDER_COLOR if parent_block.has_focus() else outline_color, Constants.OUTLINE_WIDTH) + draw_polyline(edge_polygon, Constants.FOCUS_BORDER_COLOR if parent_block.has_focus() else outline_color, Constants.OUTLINE_WIDTH) diff --git a/addons/block_code/ui/blocks/utilities/background/gutter.gd b/addons/block_code/ui/blocks/utilities/background/gutter.gd index 30e09a95..06fe07ef 100644 --- a/addons/block_code/ui/blocks/utilities/background/gutter.gd +++ b/addons/block_code/ui/blocks/utilities/background/gutter.gd @@ -10,6 +10,10 @@ var parent_block: Block @export var color: Color: set = _set_color +## Variant +@export var background_variant := false: + set = _set_background_variant + func _set_color(new_color): color = new_color @@ -17,6 +21,11 @@ func _set_color(new_color): queue_redraw() +func _set_background_variant(new_variant): + background_variant = new_variant + queue_redraw() + + func _ready(): parent_block = BlockTreeUtil.get_parent_block(self) parent_block.focus_entered.connect(queue_redraw) @@ -25,20 +34,20 @@ func _ready(): func _draw(): var fill_polygon: PackedVector2Array - fill_polygon.append(Vector2(0.0, 0.0)) - fill_polygon.append(Vector2(size.x, 0.0)) - fill_polygon.append(Vector2(size.x, size.y)) - fill_polygon.append(Vector2(0.0, size.y)) - fill_polygon.append(Vector2(0.0, 0.0)) + fill_polygon.append(Vector2(Constants.POINT_WIDTH if background_variant else 0.0, 0.0)) + fill_polygon.append(Vector2(size.x + (Constants.POINT_WIDTH if background_variant else 0.0), 0.0)) + fill_polygon.append(Vector2(size.x + (Constants.POINT_WIDTH if background_variant else 0.0), size.y)) + fill_polygon.append(Vector2(Constants.POINT_WIDTH if background_variant else 0.0, size.y)) + fill_polygon.append(Vector2(Constants.POINT_WIDTH if background_variant else 0.0, 0.0)) var left_polygon: PackedVector2Array var right_polygon: PackedVector2Array - left_polygon.append(Vector2(0.0, 0.0)) - left_polygon.append(Vector2(0.0, size.y)) + left_polygon.append(Vector2(Constants.POINT_WIDTH if background_variant else 0.0, 0.0)) + left_polygon.append(Vector2(Constants.POINT_WIDTH if background_variant else 0.0, size.y)) - right_polygon.append(Vector2(size.x, 0.0)) - right_polygon.append(Vector2(size.x, size.y)) + right_polygon.append(Vector2(size.x + (Constants.POINT_WIDTH if background_variant else 0.0), 0.0)) + right_polygon.append(Vector2(size.x + (Constants.POINT_WIDTH if background_variant else 0.0), size.y)) draw_colored_polygon(fill_polygon, color) draw_polyline(left_polygon, Constants.FOCUS_BORDER_COLOR if parent_block.has_focus() else outline_color, Constants.OUTLINE_WIDTH) 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 29db8b1c..4469c355 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 @@ -21,6 +21,7 @@ var default_value: Variant var _drag_start: Vector2 = Vector2.INF +@onready var _background := %Background @onready var _panel := %Panel @onready var snap_point := %SnapPoint @onready var _input_switcher := %InputSwitcher @@ -216,6 +217,7 @@ func _update_visible_input(): TYPE_VECTOR2: _switch_input(_vector2_input) TYPE_BOOL: + _background.background_variant = _background.POINTED _switch_input(_bool_input) _: _switch_input(_text_input) @@ -224,7 +226,8 @@ func _update_visible_input(): func _switch_input(node: Node): for c in _input_switcher.get_children(): c.visible = c == node - _panel.visible = node not in [_option_input] + _panel.visible = not node == null and node not in [_option_input] and node not in [_bool_input] + _background.visible = node in [_bool_input] func _update_option_input(current_value: Variant = null): 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 a243ac9a..85c7b845 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 @@ -1,6 +1,7 @@ -[gd_scene load_steps=12 format=3 uid="uid://cjvxs6euc6xbm"] +[gd_scene load_steps=13 format=3 uid="uid://cjvxs6euc6xbm"] [ext_resource type="Script" path="res://addons/block_code/ui/blocks/utilities/parameter_input/parameter_input.gd" id="1_rgmxn"] +[ext_resource type="Script" path="res://addons/block_code/ui/blocks/utilities/background/background.gd" id="2_5dmag"] [ext_resource type="PackedScene" uid="uid://c7puyxpqcq6xo" path="res://addons/block_code/ui/blocks/utilities/drag_drop_area/drag_drop_area.tscn" id="2_05gck"] [ext_resource type="PackedScene" uid="uid://b1oge52xhjqnu" path="res://addons/block_code/ui/blocks/utilities/snap_point/snap_point.tscn" id="2_6esp3"] @@ -41,6 +42,16 @@ grow_vertical = 2 mouse_filter = 2 script = ExtResource("1_rgmxn") +[node name="Background" type="Control" parent="."] +unique_name_in_owner = true +visible = false +layout_mode = 2 +script = ExtResource("2_5dmag") +color = Color(1, 1, 1, 1) +draw_outline = false +show_top = false +show_bottom = false + [node name="Panel" type="Panel" parent="."] unique_name_in_owner = true layout_mode = 2 diff --git a/addons/block_code/ui/constants.gd b/addons/block_code/ui/constants.gd index edfb077a..9ebb6aaa 100644 --- a/addons/block_code/ui/constants.gd +++ b/addons/block_code/ui/constants.gd @@ -6,6 +6,7 @@ const KNOB_X = 10.0 const KNOB_W = 20.0 const KNOB_H = 5.0 const KNOB_Z = 5.0 +const POINT_WIDTH = 5.0 const CONTROL_MARGIN = 20.0 const OUTLINE_WIDTH = 3.0 const MINIMUM_SNAP_DISTANCE = 80.0 From 60abb3499ab2105584331441a4402f168123c8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Wed, 6 Nov 2024 21:42:59 -0300 Subject: [PATCH 2/5] fixup! Entry restyle and hexagonal booleans POINT_WIDTH -> POINTY_WIDTH --- .../blocks/utilities/background/background.gd | 24 +++++++++---------- .../ui/blocks/utilities/background/gutter.gd | 18 +++++++------- addons/block_code/ui/constants.gd | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/addons/block_code/ui/blocks/utilities/background/background.gd b/addons/block_code/ui/blocks/utilities/background/background.gd index dc1658b6..f7107f40 100644 --- a/addons/block_code/ui/blocks/utilities/background/background.gd +++ b/addons/block_code/ui/blocks/utilities/background/background.gd @@ -129,13 +129,13 @@ func _draw(): # Right side if background_variant == POINTED: # Top - fill_polygon.append(Vector2(size.x - Constants.POINT_WIDTH, 0.0)) + fill_polygon.append(Vector2(size.x - Constants.POINTY_WIDTH, 0.0)) # Middle fill_polygon.append(Vector2(size.x, size.y / 2.0)) # Bottom - fill_polygon.append(Vector2(size.x - Constants.POINT_WIDTH, size.y)) + fill_polygon.append(Vector2(size.x - Constants.POINTY_WIDTH, size.y)) else: fill_polygon.append(Vector2(size.x, 0.0)) fill_polygon.append(Vector2(size.x, size.y)) @@ -149,13 +149,13 @@ func _draw(): # Left side if background_variant == POINTED: # Bottom - fill_polygon.append(Vector2(Constants.POINT_WIDTH, size.y)) + fill_polygon.append(Vector2(Constants.POINTY_WIDTH, size.y)) # Middle fill_polygon.append(Vector2(0.0, size.y / 2.0)) # Top - fill_polygon.append(Vector2(Constants.POINT_WIDTH, 0.0)) + fill_polygon.append(Vector2(Constants.POINTY_WIDTH, 0.0)) else: fill_polygon.append(Vector2(0.0, size.y)) fill_polygon.append(Vector2(0.0, 0.0)) @@ -169,7 +169,7 @@ func _draw(): # Top line if background_variant == POINTED: - stroke_polygon.append(Vector2(shift_top - (0.0 if not shift_top > 0 else outline_middle) + Constants.POINT_WIDTH, 0.0)) + stroke_polygon.append(Vector2(shift_top - (0.0 if not shift_top > 0 else outline_middle) + Constants.POINTY_WIDTH, 0.0)) else: stroke_polygon.append(Vector2(shift_top - (0.0 if not shift_top > 0 else outline_middle), 0.0)) @@ -179,13 +179,13 @@ func _draw(): # Right line if background_variant == POINTED: # Top - stroke_polygon.append(Vector2(size.x - Constants.POINT_WIDTH, 0.0)) + stroke_polygon.append(Vector2(size.x - Constants.POINTY_WIDTH, 0.0)) # Middle stroke_polygon.append(Vector2(size.x, size.y / 2.0)) # Bottom - stroke_polygon.append(Vector2(size.x - Constants.POINT_WIDTH, size.y)) + stroke_polygon.append(Vector2(size.x - Constants.POINTY_WIDTH, size.y)) else: stroke_polygon.append(Vector2(size.x, 0.0)) stroke_polygon.append(Vector2(size.x, size.y)) @@ -198,18 +198,18 @@ func _draw(): # Left line if background_variant == POINTED: - stroke_polygon.append(Vector2(shift_bottom - (outline_middle if shift_bottom > 0 else 0.0) + Constants.POINT_WIDTH, size.y)) - edge_polygon.append(Vector2(Constants.POINT_WIDTH + outline_middle, 0.0)) + stroke_polygon.append(Vector2(shift_bottom - (outline_middle if shift_bottom > 0 else 0.0) + Constants.POINTY_WIDTH, size.y)) + edge_polygon.append(Vector2(Constants.POINTY_WIDTH + outline_middle, 0.0)) # Top - edge_polygon.append(Vector2(Constants.POINT_WIDTH, 0.0)) + edge_polygon.append(Vector2(Constants.POINTY_WIDTH, 0.0)) # Middle edge_polygon.append(Vector2(0.0, size.y / 2.0)) # Bottom - edge_polygon.append(Vector2(Constants.POINT_WIDTH, size.y)) - edge_polygon.append(Vector2(Constants.POINT_WIDTH + outline_middle, size.y)) + edge_polygon.append(Vector2(Constants.POINTY_WIDTH, size.y)) + edge_polygon.append(Vector2(Constants.POINTY_WIDTH + outline_middle, size.y)) else: stroke_polygon.append(Vector2(shift_bottom - (outline_middle if shift_bottom > 0 else 0.0), size.y)) edge_polygon.append(Vector2(0.0, 0.0 - (0.0 if shift_top > 0 else outline_middle))) diff --git a/addons/block_code/ui/blocks/utilities/background/gutter.gd b/addons/block_code/ui/blocks/utilities/background/gutter.gd index 06fe07ef..627c6c96 100644 --- a/addons/block_code/ui/blocks/utilities/background/gutter.gd +++ b/addons/block_code/ui/blocks/utilities/background/gutter.gd @@ -34,20 +34,20 @@ func _ready(): func _draw(): var fill_polygon: PackedVector2Array - fill_polygon.append(Vector2(Constants.POINT_WIDTH if background_variant else 0.0, 0.0)) - fill_polygon.append(Vector2(size.x + (Constants.POINT_WIDTH if background_variant else 0.0), 0.0)) - fill_polygon.append(Vector2(size.x + (Constants.POINT_WIDTH if background_variant else 0.0), size.y)) - fill_polygon.append(Vector2(Constants.POINT_WIDTH if background_variant else 0.0, size.y)) - fill_polygon.append(Vector2(Constants.POINT_WIDTH if background_variant else 0.0, 0.0)) + fill_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, 0.0)) + fill_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), 0.0)) + fill_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), size.y)) + fill_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, size.y)) + fill_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, 0.0)) var left_polygon: PackedVector2Array var right_polygon: PackedVector2Array - left_polygon.append(Vector2(Constants.POINT_WIDTH if background_variant else 0.0, 0.0)) - left_polygon.append(Vector2(Constants.POINT_WIDTH if background_variant else 0.0, size.y)) + left_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, 0.0)) + left_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, size.y)) - right_polygon.append(Vector2(size.x + (Constants.POINT_WIDTH if background_variant else 0.0), 0.0)) - right_polygon.append(Vector2(size.x + (Constants.POINT_WIDTH if background_variant else 0.0), size.y)) + right_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), 0.0)) + right_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), size.y)) draw_colored_polygon(fill_polygon, color) draw_polyline(left_polygon, Constants.FOCUS_BORDER_COLOR if parent_block.has_focus() else outline_color, Constants.OUTLINE_WIDTH) diff --git a/addons/block_code/ui/constants.gd b/addons/block_code/ui/constants.gd index 9ebb6aaa..9ce6579a 100644 --- a/addons/block_code/ui/constants.gd +++ b/addons/block_code/ui/constants.gd @@ -6,7 +6,7 @@ const KNOB_X = 10.0 const KNOB_W = 20.0 const KNOB_H = 5.0 const KNOB_Z = 5.0 -const POINT_WIDTH = 5.0 +const POINTY_WIDTH = 15.0 const CONTROL_MARGIN = 20.0 const OUTLINE_WIDTH = 3.0 const MINIMUM_SNAP_DISTANCE = 80.0 From e4adc289c633ee4d99c75e2c66fad30b39b2c595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Wed, 6 Nov 2024 22:13:18 -0300 Subject: [PATCH 3/5] fixup! Entry restyle and hexagonal booleans background_variant -> is_pointy --- .../blocks/parameter_block/parameter_block.gd | 2 +- .../blocks/utilities/background/background.gd | 21 +++++++-------- .../ui/blocks/utilities/background/gutter.gd | 27 +++++++++---------- .../parameter_input/parameter_input.gd | 2 +- 4 files changed, 24 insertions(+), 28 deletions(-) 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 afa1643c..968b71f5 100644 --- a/addons/block_code/ui/blocks/parameter_block/parameter_block.gd +++ b/addons/block_code/ui/blocks/parameter_block/parameter_block.gd @@ -21,7 +21,7 @@ func _ready(): if not definition == null and definition.variant_type == Variant.Type.TYPE_BOOL: _background.visible = true - _background.background_variant = _background.POINTED + _background.is_pointy = true _background.color = color _panel.visible = false else: diff --git a/addons/block_code/ui/blocks/utilities/background/background.gd b/addons/block_code/ui/blocks/utilities/background/background.gd index f7107f40..da3f5419 100644 --- a/addons/block_code/ui/blocks/utilities/background/background.gd +++ b/addons/block_code/ui/blocks/utilities/background/background.gd @@ -33,11 +33,8 @@ enum { BODY, HEADER } @export var top_variant := BODY: set = _set_top_variant -enum { FLAT, POINTED } - -## Style of the background |FLAT|, -@export var background_variant := FLAT: - set = _set_background_variant +@export var is_pointy: bool = false: + set = _set_is_pointy func _set_color(new_color): @@ -76,8 +73,8 @@ func _set_top_variant(new_variant): queue_redraw() -func _set_background_variant(new_variant): - background_variant = clamp(new_variant, FLAT, POINTED) +func _set_is_pointy(new_is_pointy): + is_pointy = new_is_pointy queue_redraw() @@ -127,7 +124,7 @@ func _draw(): fill_polygon.append_array(top_knob) # Right side - if background_variant == POINTED: + if is_pointy: # Top fill_polygon.append(Vector2(size.x - Constants.POINTY_WIDTH, 0.0)) @@ -147,7 +144,7 @@ func _draw(): fill_polygon.append(Vector2(bottom_left_align, size.y)) # Left side - if background_variant == POINTED: + if is_pointy: # Bottom fill_polygon.append(Vector2(Constants.POINTY_WIDTH, size.y)) @@ -168,7 +165,7 @@ func _draw(): var outline_middle := Constants.OUTLINE_WIDTH / 2 # Top line - if background_variant == POINTED: + if is_pointy: stroke_polygon.append(Vector2(shift_top - (0.0 if not shift_top > 0 else outline_middle) + Constants.POINTY_WIDTH, 0.0)) else: stroke_polygon.append(Vector2(shift_top - (0.0 if not shift_top > 0 else outline_middle), 0.0)) @@ -177,7 +174,7 @@ func _draw(): stroke_polygon.append_array(top_knob) # Right line - if background_variant == POINTED: + if is_pointy: # Top stroke_polygon.append(Vector2(size.x - Constants.POINTY_WIDTH, 0.0)) @@ -197,7 +194,7 @@ func _draw(): stroke_polygon.append(Vector2(bottom_left_align, size.y)) # Left line - if background_variant == POINTED: + if is_pointy: stroke_polygon.append(Vector2(shift_bottom - (outline_middle if shift_bottom > 0 else 0.0) + Constants.POINTY_WIDTH, size.y)) edge_polygon.append(Vector2(Constants.POINTY_WIDTH + outline_middle, 0.0)) diff --git a/addons/block_code/ui/blocks/utilities/background/gutter.gd b/addons/block_code/ui/blocks/utilities/background/gutter.gd index 627c6c96..1d24117e 100644 --- a/addons/block_code/ui/blocks/utilities/background/gutter.gd +++ b/addons/block_code/ui/blocks/utilities/background/gutter.gd @@ -10,9 +10,8 @@ var parent_block: Block @export var color: Color: set = _set_color -## Variant -@export var background_variant := false: - set = _set_background_variant +@export var is_pointy: bool = false: + set = _set_is_pointy func _set_color(new_color): @@ -21,8 +20,8 @@ func _set_color(new_color): queue_redraw() -func _set_background_variant(new_variant): - background_variant = new_variant +func _set_is_pointy(new_is_pointy): + is_pointy = new_is_pointy queue_redraw() @@ -34,20 +33,20 @@ func _ready(): func _draw(): var fill_polygon: PackedVector2Array - fill_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, 0.0)) - fill_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), 0.0)) - fill_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), size.y)) - fill_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, size.y)) - fill_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, 0.0)) + fill_polygon.append(Vector2(Constants.POINTY_WIDTH if is_pointy else 0.0, 0.0)) + fill_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if is_pointy else 0.0), 0.0)) + fill_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if is_pointy else 0.0), size.y)) + fill_polygon.append(Vector2(Constants.POINTY_WIDTH if is_pointy else 0.0, size.y)) + fill_polygon.append(Vector2(Constants.POINTY_WIDTH if is_pointy else 0.0, 0.0)) var left_polygon: PackedVector2Array var right_polygon: PackedVector2Array - left_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, 0.0)) - left_polygon.append(Vector2(Constants.POINTY_WIDTH if background_variant else 0.0, size.y)) + left_polygon.append(Vector2(Constants.POINTY_WIDTH if is_pointy else 0.0, 0.0)) + left_polygon.append(Vector2(Constants.POINTY_WIDTH if is_pointy else 0.0, size.y)) - right_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), 0.0)) - right_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if background_variant else 0.0), size.y)) + right_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if is_pointy else 0.0), 0.0)) + right_polygon.append(Vector2(size.x + (Constants.POINTY_WIDTH if is_pointy else 0.0), size.y)) draw_colored_polygon(fill_polygon, color) draw_polyline(left_polygon, Constants.FOCUS_BORDER_COLOR if parent_block.has_focus() else outline_color, Constants.OUTLINE_WIDTH) 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 4469c355..b9022e60 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 @@ -217,7 +217,7 @@ func _update_visible_input(): TYPE_VECTOR2: _switch_input(_vector2_input) TYPE_BOOL: - _background.background_variant = _background.POINTED + _background.is_pointy = true _switch_input(_bool_input) _: _switch_input(_text_input) From 8c4b0246b7a8d16ecb35d3cf8d2ff8d6606bacca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Wed, 6 Nov 2024 22:46:14 -0300 Subject: [PATCH 4/5] fixup! Entry restyle and hexagonal booleans top_variant -> is_round_top --- .../ui/blocks/entry_block/entry_block.tscn | 2 +- .../ui/blocks/utilities/background/background.gd | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) 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 3c0ed713..27404035 100644 --- a/addons/block_code/ui/blocks/entry_block/entry_block.tscn +++ b/addons/block_code/ui/blocks/entry_block/entry_block.tscn @@ -41,7 +41,7 @@ layout_mode = 2 mouse_filter = 1 script = ExtResource("2_yrw8l") color = Color(1, 1, 1, 1) -top_variant = 1 +is_round_top = true [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 da3f5419..c686f2a1 100644 --- a/addons/block_code/ui/blocks/utilities/background/background.gd +++ b/addons/block_code/ui/blocks/utilities/background/background.gd @@ -27,11 +27,8 @@ var parent_block: Block @export var shift_bottom: float = 0.0: set = _set_shift_bottom -enum { BODY, HEADER } - -## Style of the top knob -@export var top_variant := BODY: - set = _set_top_variant +@export var is_round_top: bool = false: + set = _set_is_round_top @export var is_pointy: bool = false: set = _set_is_pointy @@ -68,8 +65,8 @@ func _set_shift_bottom(new_shift_bottom): queue_redraw() -func _set_top_variant(new_variant): - top_variant = clamp(new_variant, BODY, HEADER) +func _set_is_round_top(new_is_round_top): + is_round_top = new_is_round_top queue_redraw() @@ -95,7 +92,7 @@ func _draw(): fill_polygon.append(Vector2(0.0, 0.0)) if show_top: - if top_variant == HEADER: + if is_round_top: top_knob.append_array( [ Vector2(5, -4.012612), From 58349d0b5a6034266dc074f91b82228a66711bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Fri, 22 Nov 2024 12:33:09 -0300 Subject: [PATCH 5/5] wip --- .../blocks/control_block/control_block.tscn | 3 ++ .../ui/blocks/entry_block/entry_block.tscn | 1 + .../blocks/utilities/background/background.gd | 48 +++++++++++++++++++ .../parameter_input/parameter_input.tscn | 2 +- 4 files changed, 53 insertions(+), 1 deletion(-) 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