From 5c3358d3fb6ca4c2f5d5072f934cd56f7786352f Mon Sep 17 00:00:00 2001 From: Jian-Hong Pan Date: Thu, 14 Nov 2024 15:04:37 +0800 Subject: [PATCH] BlockCanvas: Only can drop properties of the BlockCode's parent node 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: 89beea94eefa ("BlockCanvas: Implement drag & drop the node's property from Inspector") https://phabricator.endlessm.com/T35649 --- addons/block_code/ui/block_canvas/block_canvas.gd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/block_code/ui/block_canvas/block_canvas.gd b/addons/block_code/ui/block_canvas/block_canvas.gd index 9bbbe7dd..10be16db 100644 --- a/addons/block_code/ui/block_canvas/block_canvas.gd +++ b/addons/block_code/ui/block_canvas/block_canvas.gd @@ -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", [])