File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
addons/block_code/ui/block_canvas Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 2
2
extends MarginContainer
3
3
4
4
const BlockCodePlugin = preload ("res://addons/block_code/block_code_plugin.gd" )
5
+ const BlockDefinition = preload ("res://addons/block_code/code_generation/block_definition.gd" )
5
6
const BlockTreeUtil = preload ("res://addons/block_code/ui/block_tree_util.gd" )
6
7
const DragManager = preload ("res://addons/block_code/drag_manager/drag_manager.gd" )
7
8
const InstructionTree = preload ("res://addons/block_code/instruction_tree/instruction_tree.gd" )
@@ -55,6 +56,27 @@ func _ready():
55
56
_populate_block_scenes_by_class ()
56
57
57
58
59
+ func _can_drop_data (at_position : Vector2 , data : Variant ) -> bool :
60
+ return true
61
+
62
+
63
+ func _drop_data (at_position : Vector2 , data : Variant ) -> void :
64
+ if typeof (data ) != TYPE_DICTIONARY :
65
+ return
66
+
67
+ data = data as Dictionary
68
+
69
+ if data .get ("type" ) != "files" :
70
+ return
71
+
72
+ for file in data .get ("files" , []):
73
+ var resource = load (file )
74
+ if resource is BlockDefinition :
75
+ var block = Util .instantiate_block (resource )
76
+ add_block (block , at_position )
77
+ reconnect_block .emit (block )
78
+
79
+
58
80
func _populate_block_scenes_by_class ():
59
81
for _class in ProjectSettings .get_global_class_list ():
60
82
if not _class .base .ends_with ("Block" ):
Original file line number Diff line number Diff line change @@ -15,10 +15,12 @@ script = ExtResource("1_tk8h2")
15
15
16
16
[node name ="Panel" type ="Panel" parent ="." ]
17
17
layout_mode = 2
18
+ mouse_filter = 2
18
19
19
20
[node name ="WindowContainer" type ="Control" parent ="." ]
20
21
clip_contents = true
21
22
layout_mode = 2
23
+ mouse_filter = 2
22
24
23
25
[node name ="Window" type ="Control" parent ="WindowContainer" ]
24
26
unique_name_in_owner = true
You can’t perform that action at this time.
0 commit comments