@@ -36,6 +36,7 @@ void MultiGodot::_bind_methods() {
3636 ClassDB::bind_method (D_METHOD (" _on_nodes_reparented" , " nodes" , " new_parent" ), &MultiGodot::_on_nodes_reparented);
3737 ClassDB::bind_method (D_METHOD (" _on_node_created" , " node" , " type" , " is_custom_type" , " weird_type" ), &MultiGodot::_on_node_created);
3838 ClassDB::bind_method (D_METHOD (" _on_scenes_instantiated" , " parent" , " paths" , " index" ), &MultiGodot::_on_scenes_instantiated);
39+ ClassDB::bind_method (D_METHOD (" _on_nodes_deleted" , " nodes" ), &MultiGodot::_on_nodes_deleted);
3940
4041 // Remote Callables
4142
@@ -56,6 +57,7 @@ void MultiGodot::_bind_methods() {
5657 ClassDB::bind_method (D_METHOD (" _reparent_nodes" , " old" , " new" ), &MultiGodot::_reparent_nodes);
5758 ClassDB::bind_method (D_METHOD (" _create_node" , " parent_path" , " type" , " is_custom_type" , " weird_type" ), &MultiGodot::_create_node);
5859 ClassDB::bind_method (D_METHOD (" _instantiate_scenes" , " parent_path" , " paths" , " index" ), &MultiGodot::_instantiate_scenes);
60+ ClassDB::bind_method (D_METHOD (" _delete_nodes" , " paths" ), &MultiGodot::_delete_nodes);
5961
6062 // Button signals
6163
@@ -127,6 +129,7 @@ void MultiGodot::_ready() {
127129 scene_tree_dock->connect (" nodes_reparented" , Callable (this , " _on_nodes_reparented" ));
128130 scene_tree_dock->connect (" node_created_type" , Callable (this , " _on_node_created" ));
129131 scene_tree_dock->connect (" scenes_instantiated" , Callable (this , " _on_scenes_instantiated" ));
132+ scene_tree_dock->connect (" nodes_deleted" , Callable (this , " _on_nodes_deleted" ));
130133 button_notifier->connect (" editor_tab_changed" , Callable (this , " _on_editor_tab_changed" ));
131134 button_notifier->connect (" current_script_path_changed" , Callable (this , " _on_current_script_path_changed" ));
132135 steam->connect (" lobby_created" , Callable (this , " _on_lobby_created" ));
@@ -1164,6 +1167,13 @@ void MultiGodot::_instantiate_scenes(String parent_path, Vector<String> paths, i
11641167 SceneTreeDock::get_singleton ()->_perform_instantiate_scenes (paths, root->get_node (parent_path), index, false );
11651168}
11661169
1170+ void MultiGodot::_delete_nodes (Vector<String> paths) {
1171+ Node *root = EditorNode::get_singleton ()->get_edited_scene ();
1172+ for (int i = 0 ; i < paths.size (); i++) {
1173+ root->get_node (paths.get (i))->queue_free ();
1174+ }
1175+ }
1176+
11671177// SIGNALS
11681178
11691179void MultiGodot::_on_lobby_created (int connect, uint64_t this_lobby_id) {
@@ -1345,6 +1355,13 @@ void MultiGodot::_on_scenes_instantiated(Node *parent, Vector<String> paths, int
13451355 _call_func (this , " _instantiate_scenes" , {root->get_path_to (parent), paths, index});
13461356}
13471357
1358+ void MultiGodot::_on_nodes_deleted (Vector<String> paths) {
1359+ if (VERBOSE_DEBUG) {
1360+ print_line (" Some scenes were deleted" );
1361+ }
1362+ _call_func (this , " _delete_nodes" , {paths});
1363+ }
1364+
13481365// PLUGIN
13491366
13501367MultiGodotPlugin::MultiGodotPlugin () {
0 commit comments