From db7d3a5ea6f54c2f6b3e1f2a815b7a28f70d5562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Fri, 6 Dec 2024 15:25:49 -0300 Subject: [PATCH] Background: Disable/enable conditional properties The "is_pointy_value" property depends on the block type to be Value. And the "control_part" property depends on the block type to be Control. --- .../ui/blocks/utilities/background/background.gd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/block_code/ui/blocks/utilities/background/background.gd b/addons/block_code/ui/blocks/utilities/background/background.gd index 7fc39381..d3f228e9 100644 --- a/addons/block_code/ui/blocks/utilities/background/background.gd +++ b/addons/block_code/ui/blocks/utilities/background/background.gd @@ -37,6 +37,7 @@ func _set_color(new_color): func _set_block_type(new_block_type): block_type = new_block_type queue_redraw() + notify_property_list_changed() func _set_control_part(new_control_part): @@ -49,6 +50,13 @@ func _set_is_pointy_value(new_is_pointy_value): queue_redraw() +func _validate_property(property: Dictionary): + if property.name == "control_part" and block_type != Types.BlockType.CONTROL: + property.usage |= PROPERTY_USAGE_READ_ONLY + elif property.name == "is_pointy_value" and block_type != Types.BlockType.VALUE: + property.usage |= PROPERTY_USAGE_READ_ONLY + + func _ready(): parent_block = BlockTreeUtil.get_parent_block(self) parent_block.focus_entered.connect(queue_redraw)