Skip to content

Commit 35eaa56

Browse files
authored
Merge pull request #219 from endlessm/no-option-blocks
ParameterInput: Don't snap blocks for option inputs
2 parents b28f697 + 9209a40 commit 35eaa56

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ signal modified
1111

1212
@export var variant_type: Variant.Type = TYPE_STRING
1313
@export var block_type: Types.BlockType = Types.BlockType.VALUE
14-
var option: bool = false
14+
var option: bool = false:
15+
set = _set_option
1516

1617
@onready var _panel := %Panel
1718
@onready var snap_point := %SnapPoint
@@ -103,11 +104,22 @@ func _set_placeholder(new_placeholder: String) -> void:
103104
_line_edit.placeholder_text = placeholder
104105

105106

107+
func _set_option(value: bool) -> void:
108+
option = value
109+
110+
if not is_node_ready():
111+
return
112+
113+
# If options are being provided, you can't snap blocks.
114+
snap_point.visible = not option
115+
116+
106117
func _ready():
107118
var stylebox = _panel.get_theme_stylebox("panel")
108119
stylebox.bg_color = Color.WHITE
109120

110121
_set_placeholder(placeholder)
122+
_set_option(option)
111123

112124
snap_point.block_type = block_type
113125
snap_point.variant_type = variant_type

0 commit comments

Comments
 (0)