Skip to content

Commit

Permalink
BlockCanvas: Only can drop properties of the BlockCode's parent node
Browse files Browse the repository at this point in the history
Godot allows drag any thing. However, if it is a property, block code
script only manipulates the properties of BlockCode node's parent node.
So, when drag a property, only allow drop the parent node's property.

Fixes: 89beea9 ("BlockCanvas: Implement drag & drop the node's property from Inspector")
https://phabricator.endlessm.com/T35649
  • Loading branch information
starnight committed Nov 19, 2024
1 parent 4a4e5d5 commit f738fff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion addons/block_code/ui/block_canvas/block_canvas.gd
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ func _can_drop_data(at_position: Vector2, data: Variant) -> bool:
if typeof(data) != TYPE_DICTIONARY:
return false

# Allow dropping property block
# Allow dropping property block of the block code node's parent node
if data.get("type", "") == "obj_property":
if data["object"] != _context.parent_node:
return false
return true

var nodes: Array = data.get("nodes", [])
Expand Down

0 comments on commit f738fff

Please sign in to comment.