@@ -7,12 +7,15 @@ signal make_floating
7
7
8
8
const OldBeehaveGraphEdit := preload ("old_graph_edit.gd" )
9
9
const NewBeehaveGraphEdit := preload ("new_graph_edit.gd" )
10
+ const NewNodeBlackBoard := preload ("new_node_blackboard.gd" )
10
11
11
12
const TREE_ICON := preload ("../icons/tree.svg" )
12
13
13
14
var graph
14
15
var container : HSplitContainer
16
+ var graph_container : HSplitContainer
15
17
var item_list : ItemList
18
+ var blackboard_vbox : VBoxContainer
16
19
var message : Label
17
20
18
21
var active_trees : Dictionary
@@ -28,12 +31,25 @@ func _ready() -> void:
28
31
item_list .custom_minimum_size = Vector2 (200 , 0 )
29
32
item_list .item_selected .connect (_on_item_selected )
30
33
container .add_child (item_list )
34
+
35
+ graph_container = HSplitContainer .new ()
36
+ graph_container .split_offset = 1920
37
+ graph_container .set_anchors_preset (Control .PRESET_FULL_RECT )
38
+ container .add_child (graph_container )
39
+
31
40
if Engine .get_version_info ().minor >= 2 :
32
41
graph = NewBeehaveGraphEdit .new (BeehaveUtils .get_frames ())
33
42
else :
34
43
graph = OldBeehaveGraphEdit .new (BeehaveUtils .get_frames ())
35
44
36
- container .add_child (graph )
45
+ graph .node_selected .connect (_on_graph_node_selected )
46
+ graph .node_deselected .connect (_on_graph_node_deselected )
47
+ graph_container .add_child (graph )
48
+
49
+ blackboard_vbox = VBoxContainer .new ()
50
+ blackboard_vbox .custom_minimum_size = Vector2 (200 , 0 )
51
+ blackboard_vbox .set_anchors_preset (Control .PRESET_FULL_RECT )
52
+ graph_container .add_child (blackboard_vbox )
37
53
38
54
message = Label .new ()
39
55
message .text = "Run Project for debugging"
@@ -115,10 +131,26 @@ func _on_item_selected(idx: int) -> void:
115
131
var id : StringName = item_list .get_item_metadata (idx )
116
132
graph .beehave_tree = active_trees .get (id , {})
117
133
134
+ # Clear our any loaded blackboards
135
+ for child in blackboard_vbox .get_children ():
136
+ child .free ()
137
+
118
138
active_tree_id = id .to_int ()
119
139
if session != null :
120
140
session .send_message ("beehave:activate_tree" , [active_tree_id ])
121
141
142
+ func _on_graph_node_selected (node : GraphNode ) -> void :
143
+ var node_blackboard : VBoxContainer = NewNodeBlackBoard .new (BeehaveUtils .get_frames (), node )
144
+ blackboard_vbox .add_child (node_blackboard )
145
+
146
+ func _on_graph_node_deselected (node : GraphNode ) -> void :
147
+ var matches : Array = blackboard_vbox \
148
+ .get_children ()\
149
+ .filter (func (child ): return child .name == node .name )
150
+
151
+ for child in matches :
152
+ child .free ()
153
+
122
154
123
155
func _on_visibility_changed () -> void :
124
156
if session != null :
0 commit comments