@@ -7,12 +7,15 @@ signal make_floating
77
88const OldBeehaveGraphEdit := preload ("old_graph_edit.gd" )
99const NewBeehaveGraphEdit := preload ("new_graph_edit.gd" )
10+ const NewNodeBlackBoard := preload ("new_node_blackboard.gd" )
1011
1112const TREE_ICON := preload ("../icons/tree.svg" )
1213
1314var graph
1415var container : HSplitContainer
16+ var graph_container : HSplitContainer
1517var item_list : ItemList
18+ var blackboard_vbox : VBoxContainer
1619var message : Label
1720
1821var active_trees : Dictionary
@@ -28,12 +31,25 @@ func _ready() -> void:
2831 item_list .custom_minimum_size = Vector2 (200 , 0 )
2932 item_list .item_selected .connect (_on_item_selected )
3033 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+
3140 if Engine .get_version_info ().minor >= 2 :
3241 graph = NewBeehaveGraphEdit .new (BeehaveUtils .get_frames ())
3342 else :
3443 graph = OldBeehaveGraphEdit .new (BeehaveUtils .get_frames ())
3544
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 )
3753
3854 message = Label .new ()
3955 message .text = "Run Project for debugging"
@@ -115,10 +131,26 @@ func _on_item_selected(idx: int) -> void:
115131 var id : StringName = item_list .get_item_metadata (idx )
116132 graph .beehave_tree = active_trees .get (id , {})
117133
134+ # Clear our any loaded blackboards
135+ for child in blackboard_vbox .get_children ():
136+ child .free ()
137+
118138 active_tree_id = id .to_int ()
119139 if session != null :
120140 session .send_message ("beehave:activate_tree" , [active_tree_id ])
121141
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+
122154
123155func _on_visibility_changed () -> void :
124156 if session != null :
0 commit comments