Skip to content

Commit 2c16ed4

Browse files
authored
Merge pull request #331 from endlessm/improve-background-property
Background: Disable/enable conditional properties
2 parents a6f753f + db7d3a5 commit 2c16ed4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func _set_color(new_color):
3737
func _set_block_type(new_block_type):
3838
block_type = new_block_type
3939
queue_redraw()
40+
notify_property_list_changed()
4041

4142

4243
func _set_control_part(new_control_part):
@@ -49,6 +50,13 @@ func _set_is_pointy_value(new_is_pointy_value):
4950
queue_redraw()
5051

5152

53+
func _validate_property(property: Dictionary):
54+
if property.name == "control_part" and block_type != Types.BlockType.CONTROL:
55+
property.usage |= PROPERTY_USAGE_READ_ONLY
56+
elif property.name == "is_pointy_value" and block_type != Types.BlockType.VALUE:
57+
property.usage |= PROPERTY_USAGE_READ_ONLY
58+
59+
5260
func _ready():
5361
parent_block = BlockTreeUtil.get_parent_block(self)
5462
parent_block.focus_entered.connect(queue_redraw)

0 commit comments

Comments
 (0)