Skip to content

Commit

Permalink
Background: Disable/enable conditional properties
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
manuq committed Dec 6, 2024
1 parent a6f753f commit db7d3a5
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Expand Down

0 comments on commit db7d3a5

Please sign in to comment.