2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/**************************************************************************/ 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-16 08:04:19 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/*  filesystem_dock.cpp                                                   */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/**************************************************************************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*                         This file is part of:                          */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*                             GODOT ENGINE                               */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*                        https://godotengine.org                         */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/**************************************************************************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*                                                                        */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* Permission is hereby granted, free of charge, to any person obtaining  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* a copy of this software and associated documentation files (the        */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* "Software"), to deal in the Software without restriction, including    */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* without limitation the rights to use, copy, modify, merge, publish,    */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* distribute, sublicense, and/or sell copies of the Software, and to     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* permit persons to whom the Software is furnished to do so, subject to  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* the following conditions:                                              */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*                                                                        */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* The above copyright notice and this permission notice shall be         */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* included in all copies or substantial portions of the Software.        */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*                                                                        */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/**************************************************************************/ 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-05 00:50:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "filesystem_dock.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-16 08:04:19 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-07 19:33:38 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "core/config/project_settings.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-11 14:51:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "core/io/dir_access.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "core/io/file_access.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-11 18:13:45 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "core/io/resource_loader.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-05 14:45:54 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "core/os/keyboard.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-11 18:13:45 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "core/os/os.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-07 19:33:38 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "core/templates/list.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-07 18:59:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/create_dialog.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 18:15:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/directory_create_dialog.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/editor_dock_manager.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-12 02:46:22 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/editor_feature_profile.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "editor/editor_node.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "editor/editor_resource_preview.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "editor/editor_settings.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/editor_string_names.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/editor_undo_redo_manager.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-07 18:59:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/gui/editor_dir_dialog.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-24 12:24:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/gui/editor_scene_tabs.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-09 01:12:51 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/import/3d/scene_import_settings.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-14 14:00:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/import_dock.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-21 16:43:53 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/plugins/editor_context_menu_plugin.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/plugins/editor_resource_conversion_plugin.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/plugins/editor_resource_tooltip_plugins.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-12 02:11:52 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/scene_create_dialog.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-12 02:46:22 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/scene_tree_dock.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-14 14:00:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/shader_create_dialog.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-15 13:14:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/themes/editor_scale.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-17 15:03:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "editor/themes/editor_theme_manager.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-07 18:59:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "scene/gui/item_list.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-14 14:00:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "scene/gui/label.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-07 18:59:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "scene/gui/line_edit.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "scene/gui/progress_bar.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 19:47:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "scene/resources/packed_scene.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-03 10:36:29 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "servers/display_server.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-06 19:04:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Control  * FileSystemTree : : make_custom_tooltip ( const  String  & p_text )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									TreeItem  * item  =  get_item_at_position ( get_local_mouse_position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  FileSystemDock : : get_singleton ( ) - > create_tooltip_for_path ( item - > get_metadata ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Control  * FileSystemList : : make_custom_tooltip ( const  String  & p_text )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  idx  =  get_item_at_position ( get_local_mouse_position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( idx  = =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  FileSystemDock : : get_singleton ( ) - > create_tooltip_for_path ( get_item_metadata ( idx ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-15 13:25:58 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemList : : _line_editor_submit ( const  String  & p_text )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-08 11:56:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( popup_edit_committed )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-17 10:03:52 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ;  // Already processed by _text_editor_popup_modal_close
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( popup_editor - > get_hide_reason ( )  = =  Popup : : HIDE_REASON_CANCELED )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ;  // ESC pressed, app focus lost, or forced close from code.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-08 11:56:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									popup_edit_committed  =  true ;  // End edit popup processing.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									popup_editor - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									emit_signal ( SNAME ( " item_edited " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bool  FileSystemList : : edit_selected ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ERR_FAIL_COND_V_MSG ( ! is_anything_selected ( ) ,  false ,  " No item selected. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  s  =  get_current ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 21:59:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ERR_FAIL_COND_V_MSG ( s  <  0 ,  false ,  " No current item selected. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ensure_current_is_visible ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Rect2  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Rect2  popup_rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector2  ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector2  icon_size  =  get_item_icon ( s ) - > get_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Handles the different icon modes (TOP/LEFT).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch  ( get_icon_mode ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  ItemList : : ICON_MODE_LEFT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											rect  =  get_item_rect ( s ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ofs  =  Vector2 ( 0 ,  Math : : floor ( ( MAX ( line_editor - > get_minimum_size ( ) . height ,  rect . size . height )  -  rect . size . height )  /  2 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											popup_rect . position  =  get_screen_position ( )  +  rect . position  -  ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											popup_rect . size  =  rect . size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Adjust for icon position and size.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											popup_rect . size . x  - =  icon_size . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											popup_rect . position . x  + =  icon_size . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  ItemList : : ICON_MODE_TOP : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											rect  =  get_item_rect ( s ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											popup_rect . position  =  get_screen_position ( )  +  rect . position ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											popup_rect . size  =  rect . size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Adjust for icon position and size.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											popup_rect . size . y  - =  icon_size . y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											popup_rect . position . y  + =  icon_size . y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									popup_editor - > set_position ( popup_rect . position ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									popup_editor - > set_size ( popup_rect . size ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									String  name  =  get_item_text ( s ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									line_editor - > set_text ( name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-16 18:52:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									line_editor - > select ( 0 ,  name . rfind_char ( ' . ' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-08 11:56:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									popup_edit_committed  =  false ;  // Start edit popup processing.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									popup_editor - > popup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									popup_editor - > child_controls_changed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									line_editor - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								String  FileSystemList : : get_edit_text ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  line_editor - > get_text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  FileSystemList : : _text_editor_popup_modal_close ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-08 11:56:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( popup_edit_committed )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-17 10:03:52 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ;  // Already processed by _text_editor_popup_modal_close
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-01 13:39:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( popup_editor - > get_hide_reason ( )  = =  Popup : : HIDE_REASON_CANCELED )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-17 10:03:52 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ;  // ESC pressed, app focus lost, or forced close from code.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_line_editor_submit ( line_editor - > get_text ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  FileSystemList : : _bind_methods ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ADD_SIGNAL ( MethodInfo ( " item_edited " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								FileSystemList : : FileSystemList ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-24 01:00:01 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									set_auto_translate_mode ( AUTO_TRANSLATE_MODE_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									popup_editor  =  memnew ( Popup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									add_child ( popup_editor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									popup_editor_vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									popup_editor_vb - > add_theme_constant_override ( " separation " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									popup_editor_vb - > set_anchors_and_offsets_preset ( PRESET_FULL_RECT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									popup_editor - > add_child ( popup_editor_vb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									line_editor  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									line_editor - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									popup_editor_vb - > add_child ( line_editor ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-02 16:15:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									line_editor - > connect ( SceneStringName ( text_submitted ) ,  callable_mp ( this ,  & FileSystemList : : _line_editor_submit ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									popup_editor - > connect ( " popup_hide " ,  callable_mp ( this ,  & FileSystemList : : _text_editor_popup_modal_close ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-07 00:09:12 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Ref < Texture2D >  FileSystemDock : : _get_tree_item_icon ( bool  p_is_valid ,  const  String  & p_file_type ,  const  String  & p_icon_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! p_icon_path . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Ref < Texture2D >  icon  =  ResourceLoader : : load ( p_icon_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( icon . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! p_is_valid )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-07 00:09:12 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  get_editor_theme_icon ( SNAME ( " ImportFail " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( has_theme_icon ( p_file_type ,  EditorStringName ( EditorIcons ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  get_editor_theme_icon ( p_file_type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-07 00:09:12 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  get_editor_theme_icon ( SNAME ( " File " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-07 00:09:12 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-08-03 22:05:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _create_tree ( TreeItem  * p_parent ,  EditorFileSystemDirectory  * p_dir ,  Vector < String >  & uncollapsed_paths ,  bool  p_select_in_favorites ,  bool  p_unfold_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Create a tree item for the subdirectory.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									TreeItem  * subdirectory_item  =  tree - > create_item ( p_parent ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  dname  =  p_dir - > get_name ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  lpath  =  p_dir - > get_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( dname . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										dname  =  " res:// " ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-03 22:05:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										resources_item  =  subdirectory_item ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Set custom folder color (if applicable).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  has_custom_color  =  assigned_folder_colors . has ( lpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Color  custom_color  =  has_custom_color  ?  folder_colors [ assigned_folder_colors [ lpath ] ]  :  Color ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-06 11:07:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < DirAccess >  da  =  DirAccess : : create ( DirAccess : : ACCESS_RESOURCES ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( has_custom_color )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-14 02:09:49 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										subdirectory_item - > set_icon_modulate ( 0 ,  editor_is_dark_theme  ?  custom_color  :  custom_color  *  ITEM_COLOR_SCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										subdirectory_item - > set_custom_bg_color ( 0 ,  Color ( custom_color ,  editor_is_dark_theme  ?  ITEM_ALPHA_MIN  :  ITEM_ALPHA_MAX ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										TreeItem  * parent  =  subdirectory_item - > get_parent ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( parent )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Color  parent_bg_color  =  parent - > get_custom_bg_color ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( parent_bg_color  ! =  Color ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												bool  parent_has_custom_color  =  assigned_folder_colors . has ( parent - > get_metadata ( 0 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-14 02:09:49 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												subdirectory_item - > set_custom_bg_color ( 0 ,  parent_has_custom_color  ?  parent_bg_color . darkened ( ITEM_BG_DARK_SCALE )  :  parent_bg_color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												subdirectory_item - > set_icon_modulate ( 0 ,  parent - > get_icon_modulate ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												subdirectory_item - > set_icon_modulate ( 0 ,  get_theme_color ( SNAME ( " folder_icon_color " ) ,  SNAME ( " FileDialog " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									subdirectory_item - > set_text ( 0 ,  dname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-19 13:27:18 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									subdirectory_item - > set_structured_text_bidi_override ( 0 ,  TextServer : : STRUCTURED_TEXT_FILE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									subdirectory_item - > set_icon ( 0 ,  get_editor_theme_icon ( SNAME ( " Folder " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-06 11:07:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( da - > is_link ( lpath ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										subdirectory_item - > set_icon_overlay ( 0 ,  get_editor_theme_icon ( SNAME ( " LinkOverlay " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										subdirectory_item - > set_tooltip_text ( 0 ,  vformat ( TTR ( " Link to: %s " ) ,  da - > read_link ( lpath ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									subdirectory_item - > set_selectable ( 0 ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									subdirectory_item - > set_metadata ( 0 ,  lpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-04 15:10:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									folder_map [ lpath ]  =  subdirectory_item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! p_select_in_favorites  & &  ( current_path  = =  lpath  | |  ( ( display_mode  ! =  DISPLAY_MODE_TREE_ONLY )  & &  current_path . get_base_dir ( )  = =  lpath ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										subdirectory_item - > select ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-03 18:01:03 +07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Keep select an item when re-created a tree
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// To prevent crashing when nothing is selected.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										subdirectory_item - > set_as_cursor ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_unfold_path  & &  current_path . begins_with ( lpath )  & &  current_path  ! =  lpath )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-21 15:40:11 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										subdirectory_item - > set_collapsed ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-06 16:20:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										subdirectory_item - > set_collapsed ( ! uncollapsed_paths . has ( lpath ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-21 15:40:11 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Create items for all subdirectories.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bool  reversed  =  file_sort  = =  FileSortOption : : FILE_SORT_NAME_REVERSE ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-22 23:38:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  reversed  ?  p_dir - > get_subdir_count ( )  -  1  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											reversed  ?  i  > =  0  :  i  <  p_dir - > get_subdir_count ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											reversed  ?  i - -  :  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-03 22:05:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_create_tree ( subdirectory_item ,  p_dir - > get_subdir ( i ) ,  uncollapsed_paths ,  p_select_in_favorites ,  p_unfold_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Create all items for the files in the subdirectory.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-25 23:39:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( display_mode  = =  DISPLAY_MODE_TREE_ONLY )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-14 20:01:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  String  main_scene  =  ResourceUID : : ensure_path ( GLOBAL_GET ( " application/run/main_scene " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Build the list of the files to display.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										List < FileInfo >  file_list ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  p_dir - > get_file_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-08 19:18:03 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  file_type  =  p_dir - > get_file_type ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-06 20:51:40 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( _is_file_type_disabled_by_feature_profile ( file_type ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// If type is disabled, file won't be displayed.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-08 19:18:03 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											FileInfo  file_info ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_info . name  =  p_dir - > get_file ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_info . type  =  p_dir - > get_file_type ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_info . icon_path  =  p_dir - > get_file_icon_path ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_info . import_broken  =  ! p_dir - > get_file_import_is_valid ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_info . modified_time  =  p_dir - > get_file_modified_time ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											file_list . push_back ( file_info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Sort the file list if needed.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sort_file_info_list ( file_list ,  file_sort ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Build the tree.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-13 16:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  int  icon_size  =  get_theme_constant ( SNAME ( " class_icon_size " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-07 00:09:12 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( const  FileInfo  & file_info  :  file_list )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											TreeItem  * file_item  =  tree - > create_item ( subdirectory_item ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											const  String  file_metadata  =  lpath . path_join ( file_info . name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_item - > set_text ( 0 ,  file_info . name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-19 13:27:18 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											file_item - > set_structured_text_bidi_override ( 0 ,  TextServer : : STRUCTURED_TEXT_FILE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											file_item - > set_icon ( 0 ,  _get_tree_item_icon ( ! file_info . import_broken ,  file_info . type ,  file_info . icon_path ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-06 11:07:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( da - > is_link ( file_metadata ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_item - > set_icon_overlay ( 0 ,  get_editor_theme_icon ( SNAME ( " LinkOverlay " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-26 16:41:10 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// TRANSLATORS: This is a tooltip for a file that is a symbolic link to another file.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-06 11:07:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												file_item - > set_tooltip_text ( 0 ,  vformat ( TTR ( " Link to: %s " ) ,  da - > read_link ( file_metadata ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-07 00:09:12 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											file_item - > set_icon_max_width ( 0 ,  icon_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Color  parent_bg_color  =  subdirectory_item - > get_custom_bg_color ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( has_custom_color )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-14 02:09:49 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												file_item - > set_custom_bg_color ( 0 ,  parent_bg_color . darkened ( ITEM_BG_DARK_SCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  if  ( parent_bg_color  ! =  Color ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_item - > set_custom_bg_color ( 0 ,  parent_bg_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											file_item - > set_metadata ( 0 ,  file_metadata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! p_select_in_favorites  & &  current_path  = =  file_metadata )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												file_item - > select ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 19:06:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												file_item - > set_as_cursor ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-30 03:24:38 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( main_scene  = =  file_metadata )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												file_item - > set_custom_color ( 0 ,  get_theme_color ( SNAME ( " accent_color " ) ,  EditorStringName ( Editor ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-30 03:24:38 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-22 22:53:26 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Array  udata  =  {  tree_update_id ,  file_item  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-12 13:10:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorResourcePreview : : get_singleton ( ) - > queue_resource_preview ( file_metadata ,  this ,  " _tree_thumbnail_done " ,  udata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( lpath . get_base_dir ( )  = =  current_path . get_base_dir ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-29 04:07:56 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											subdirectory_item - > select ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											subdirectory_item - > set_as_cursor ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Vector < String >  FileSystemDock : : get_uncollapsed_paths ( )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  uncollapsed_paths ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 23:28:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									TreeItem  * root  =  tree - > get_root ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( root )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! favorites_item - > is_collapsed ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											uncollapsed_paths . push_back ( favorites_item - > get_metadata ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// BFS to find all uncollapsed paths of the resource directory.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										TreeItem  * res_subtree  =  root - > get_first_child ( ) - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( res_subtree )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											List < TreeItem  * >  queue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											queue . push_back ( res_subtree ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 23:28:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											while  ( ! queue . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												TreeItem  * ti  =  queue . back ( ) - > get ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												queue . pop_back ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! ti - > is_collapsed ( )  & &  ti - > get_child_count ( )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													Variant  path  =  ti - > get_metadata ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														uncollapsed_paths . push_back ( path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												for  ( int  i  =  0 ;  i  <  ti - > get_child_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													queue . push_back ( ti - > get_child ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 23:28:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  uncollapsed_paths ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-03 16:29:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _update_tree ( const  Vector < String >  & p_uncollapsed_paths ,  bool  p_uncollapse_root ,  bool  p_scroll_to_selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Recreate the tree.
 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									tree - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-12 13:10:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_update_id + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									updating_tree  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									TreeItem  * root  =  tree - > create_item ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-04 15:10:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									folder_map . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Handles the favorites.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-03 22:05:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									favorites_item  =  tree - > create_item ( root ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									favorites_item - > set_icon ( 0 ,  get_editor_theme_icon ( SNAME ( " Favorites " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									favorites_item - > set_text ( 0 ,  TTRC ( " Favorites: " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									favorites_item - > set_auto_translate_mode ( 0 ,  AUTO_TRANSLATE_MODE_ALWAYS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									favorites_item - > set_metadata ( 0 ,  " Favorites " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-06 16:20:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									favorites_item - > set_collapsed ( ! p_uncollapsed_paths . has ( " Favorites " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-18 14:02:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  favorite_paths  =  EditorSettings : : get_singleton ( ) - > get_favorites ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 23:28:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 11:08:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < DirAccess >  da  =  DirAccess : : create ( DirAccess : : ACCESS_RESOURCES ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 23:28:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bool  fav_changed  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( int  i  =  favorite_paths . size ( )  -  1 ;  i  > =  0 ;  i - - )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 22:38:16 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( da - > dir_exists ( favorite_paths [ i ] )  | |  da - > file_exists ( favorite_paths [ i ] ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 23:28:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-06 22:38:16 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										favorite_paths . remove_at ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fav_changed  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 23:28:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( fav_changed )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										EditorSettings : : get_singleton ( ) - > set_favorites ( favorite_paths ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < Texture2D >  folder_icon  =  get_editor_theme_icon ( SNAME ( " Folder " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  Color  default_folder_color  =  get_theme_color ( SNAME ( " folder_icon_color " ) ,  SNAME ( " FileDialog " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  favorite_paths . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  String  & favorite  =  favorite_paths [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-01 10:49:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! favorite . begins_with ( " res:// " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  text ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-11 15:43:37 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Ref < Texture2D >  icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-20 00:08:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Color  color ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-01 10:49:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( favorite  = =  " res:// " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											text  =  " / " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											icon  =  folder_icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											color  =  default_folder_color ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-01 10:49:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( favorite . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											text  =  favorite . substr ( 0 ,  favorite . length ( )  -  1 ) . get_file ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											icon  =  folder_icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											color  =  assigned_folder_colors . has ( favorite )  ?  folder_colors [ assigned_folder_colors [ favorite ] ]  :  default_folder_color ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-01 10:49:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											text  =  favorite . get_file ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											int  index ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-01 10:49:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorFileSystemDirectory  * dir  =  EditorFileSystem : : get_singleton ( ) - > find_file ( favorite ,  & index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( dir )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-14 00:13:45 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												icon  =  _get_tree_item_icon ( dir - > get_file_import_is_valid ( index ) ,  dir - > get_file_type ( index ) ,  dir - > get_file_icon_path ( index ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												icon  =  get_editor_theme_icon ( SNAME ( " File " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-20 00:08:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											color  =  Color ( 1 ,  1 ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-08-03 22:05:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										TreeItem  * ti  =  tree - > create_item ( favorites_item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ti - > set_text ( 0 ,  text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ti - > set_icon ( 0 ,  icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ti - > set_icon_modulate ( 0 ,  color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ti - > set_tooltip_text ( 0 ,  favorite ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ti - > set_selectable ( 0 ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ti - > set_metadata ( 0 ,  favorite ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-03 16:29:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-08-03 22:05:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! favorite . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-22 22:53:26 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Array  udata  =  {  tree_update_id ,  ti  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-03 22:05:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorResourcePreview : : get_singleton ( ) - > queue_resource_preview ( favorite ,  this ,  " _tree_thumbnail_done " ,  udata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 23:28:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  uncollapsed_paths  =  p_uncollapsed_paths ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-01 10:53:31 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_uncollapse_root )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										uncollapsed_paths . push_back ( " res:// " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Create the remaining of the tree.
 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-03 16:29:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_create_tree ( root ,  EditorFileSystem : : get_singleton ( ) - > get_filesystem ( ) ,  uncollapsed_paths ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-03 23:36:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! searched_tokens . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_update_filtered_items ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-03 16:29:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_scroll_to_selected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										tree - > ensure_cursor_is_visible ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									updating_tree  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-25 23:39:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : set_display_mode ( DisplayMode  p_display_mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									display_mode  =  p_display_mode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_update_display_mode ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-22 11:31:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _update_display_mode ( bool  p_force )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Compute the new display mode.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-25 23:39:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_force  | |  old_display_mode  ! =  display_mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-14 13:59:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										switch  ( display_mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 17:35:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											case  DISPLAY_MODE_TREE_ONLY : 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												button_toggle_display_mode - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Panels1 " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												tree - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												tree - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												toolbar2_hbc - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												_update_tree ( get_uncollapsed_paths ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												file_list_vb - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											case  DISPLAY_MODE_HSPLIT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  DISPLAY_MODE_VSPLIT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												const  bool  is_vertical  =  display_mode  = =  DISPLAY_MODE_VSPLIT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												split_box - > set_vertical ( is_vertical ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												const  int  actual_offset  =  is_vertical  ?  split_box_offset_v  :  split_box_offset_h ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												split_box - > set_split_offset ( actual_offset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												const  StringName  icon  =  is_vertical  ?  SNAME ( " Panels2 " )  :  SNAME ( " Panels2Alt " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												button_toggle_display_mode - > set_button_icon ( get_editor_theme_icon ( icon ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												tree - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												tree - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												tree - > ensure_cursor_is_visible ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												toolbar2_hbc - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												_update_tree ( get_uncollapsed_paths ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												file_list_vb - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-28 13:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												_update_file_list ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-25 23:39:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										old_display_mode  =  display_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _notification ( int  p_what )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-30 21:33:31 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  NOTIFICATION_READY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorFeatureProfileManager : : get_singleton ( ) - > connect ( " current_feature_profile_changed " ,  callable_mp ( this ,  & FileSystemDock : : _feature_profile_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorFileSystem : : get_singleton ( ) - > connect ( " filesystem_changed " ,  callable_mp ( this ,  & FileSystemDock : : _fs_changed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											EditorResourcePreview : : get_singleton ( ) - > connect ( " preview_invalidated " ,  callable_mp ( this ,  & FileSystemDock : : _preview_invalidated ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											button_file_list_display_mode - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _toggle_file_display ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											files - > connect ( " item_activated " ,  callable_mp ( this ,  & FileSystemDock : : _file_list_activate_file ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											button_hist_next - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _fw_history ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											button_hist_prev - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _bw_history ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:13:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											file_list_popup - > connect ( SceneStringName ( id_pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _file_list_rmb_option ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											tree_popup - > connect ( SceneStringName ( id_pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _tree_rmb_option ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-02 16:15:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											current_path_line_edit - > connect ( SceneStringName ( text_submitted ) ,  callable_mp ( this ,  & FileSystemDock : : _navigate_to_path ) . bind ( false ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 16:43:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											always_show_folders  =  bool ( EDITOR_GET ( " docks/filesystem/always_show_folders " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-02 23:12:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											set_file_list_display_mode ( FileSystemDock : : FILE_LIST_DISPLAY_LIST ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-21 09:42:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_update_display_mode ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 11:46:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( EditorFileSystem : : get_singleton ( ) - > is_scanning ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												_set_scanning_mode ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 23:28:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												_update_tree ( Vector < String > ( ) ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  NOTIFICATION_PROCESS :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( EditorFileSystem : : get_singleton ( ) - > is_scanning ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-24 01:30:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												scanning_progress - > set_value ( EditorFileSystem : : get_singleton ( ) - > get_scanning_progress ( )  *  100.0f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  NOTIFICATION_DRAG_BEGIN :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Dictionary  dd  =  get_viewport ( ) - > gui_get_drag_data ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-13 10:45:50 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( tree - > is_visible_in_tree ( )  & &  dd . has ( " type " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-20 19:39:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( dd . has ( " favorite " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( ( String ( dd [ " favorite " ] )  = =  " all " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-20 19:39:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														tree - > set_drop_mode_flags ( Tree : : DROP_MODE_INBETWEEN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												}  else  if  ( ( String ( dd [ " type " ] )  = =  " files " )  | |  ( String ( dd [ " type " ] )  = =  " files_and_dirs " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													tree - > set_drop_mode_flags ( Tree : : DROP_MODE_ON_ITEM  |  Tree : : DROP_MODE_INBETWEEN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												}  else  if  ( ( String ( dd [ " type " ] )  = =  " nodes " )  | |  ( String ( dd [ " type " ] )  = =  " resource " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													holding_branch  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													TreeItem  * item  =  tree - > get_next_selected ( tree - > get_root ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													while  ( item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														tree_items_selected_on_drag_begin . push_back ( item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														item  =  tree - > get_next_selected ( item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													list_items_selected_on_drag_begin  =  files - > get_selected_items ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  NOTIFICATION_DRAG_END :  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											tree - > set_drop_mode_flags ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( holding_branch )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												holding_branch  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												_reselect_items_selected_on_drag_begin ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  NOTIFICATION_TRANSLATION_CHANGED : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  NOTIFICATION_LAYOUT_DIRECTION_CHANGED : 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-22 11:31:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_update_display_mode ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-18 00:09:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											StringName  mode_icon  =  " Panels1 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( display_mode  = =  DISPLAY_MODE_VSPLIT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												mode_icon  =  " Panels2 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( display_mode  = =  DISPLAY_MODE_HSPLIT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												mode_icon  =  " Panels2Alt " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											button_toggle_display_mode - > set_button_icon ( get_editor_theme_icon ( mode_icon ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-05 15:05:53 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( file_list_display_mode  = =  FILE_LIST_DISPLAY_LIST )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												button_file_list_display_mode - > set_button_icon ( get_editor_theme_icon ( SNAME ( " FileThumbnail " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-22 11:31:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												button_file_list_display_mode - > set_button_icon ( get_editor_theme_icon ( SNAME ( " FileList " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-22 11:31:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 01:03:13 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											tree_search_box - > set_right_icon ( get_editor_theme_icon ( SNAME ( " Search " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											tree_button_sort - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Sort " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											file_list_search_box - > set_right_icon ( get_editor_theme_icon ( SNAME ( " Search " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											file_list_button_sort - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Sort " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 01:03:13 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											button_dock_placement - > set_button_icon ( get_editor_theme_icon ( SNAME ( " GuiTabMenuHl " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( is_layout_rtl ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												button_hist_next - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Back " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												button_hist_prev - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Forward " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												button_hist_next - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Forward " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												button_hist_prev - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Back " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:50:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											overwrite_dialog_scroll - > add_theme_style_override ( SceneStringName ( panel ) ,  get_theme_stylebox ( SceneStringName ( panel ) ,  " Tree " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  EditorSettings : : NOTIFICATION_EDITOR_SETTINGS_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Update editor dark theme & always show folders states from editor settings, redraw if needed.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											bool  do_redraw  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-17 15:03:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											bool  new_editor_is_dark_theme  =  EditorThemeManager : : is_dark_theme ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( new_editor_is_dark_theme  ! =  editor_is_dark_theme )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												editor_is_dark_theme  =  new_editor_is_dark_theme ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												do_redraw  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 16:43:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											bool  new_always_show_folders  =  bool ( EDITOR_GET ( " docks/filesystem/always_show_folders " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( new_always_show_folders  ! =  always_show_folders )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												always_show_folders  =  new_always_show_folders ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												do_redraw  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( do_redraw )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-16 15:52:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												update_all ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-23 00:14:08 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( EditorThemeManager : : is_generated_theme_outdated ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// Change full tree mode.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												_update_display_mode ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-15 13:39:13 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _tree_multi_selected ( Object  * p_item ,  int  p_column ,  bool  p_selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Update the import dock.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-24 14:26:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									import_dock_needs_update  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-18 15:46:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									callable_mp ( this ,  & FileSystemDock : : _update_import_dock ) . call_deferred ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Return if we don't select something new.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! p_selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Tree item selected.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									TreeItem  * selected  =  tree - > get_selected ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-19 22:43:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( selected - > get_parent ( )  = =  favorites_item  & &  ! String ( selected - > get_metadata ( 0 ) ) . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Go to the favorites if we click in the favorites and the path has changed.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										current_path  =  " Favorites " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										current_path  =  selected - > get_metadata ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Note: the "Favorites" item also leads to this path.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Display the current path.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_set_current_path_line_edit_text ( current_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_push_to_history ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Update the file list.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! updating_tree  & &  display_mode  ! =  DISPLAY_MODE_TREE_ONLY )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-28 13:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_update_file_list ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 22:25:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Vector < String >  FileSystemDock : : get_selected_paths ( )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-24 20:01:11 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( display_mode  = =  DISPLAY_MODE_TREE_ONLY )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  _tree_get_selected ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Vector < String >  selected  =  _file_list_get_selected ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( selected . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											selected . push_back ( get_current_directory ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  selected ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 22:25:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								String  FileSystemDock : : get_current_path ( )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  current_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-10 22:25:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								String  FileSystemDock : : get_current_directory ( )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( current_path . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  current_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  current_path . get_base_dir ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _set_current_path_line_edit_text ( const  String  & p_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_path  = =  " Favorites " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										current_path_line_edit - > set_text ( TTR ( " Favorites " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										current_path_line_edit - > set_text ( current_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-17 20:40:38 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _navigate_to_path ( const  String  & p_path ,  bool  p_select_in_favorites )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  target_path  =  p_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-04 15:10:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bool  is_directory  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_path . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										target_path  =  " res:// " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										is_directory  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( p_path  ! =  " Favorites " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 11:08:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Ref < DirAccess >  da  =  DirAccess : : create ( DirAccess : : ACCESS_RESOURCES ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( da - > dir_exists ( p_path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-04 15:10:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											is_directory  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! p_path . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												target_path  + =  " / " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( ! da - > file_exists ( p_path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 20:57:49 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ERR_FAIL_MSG ( vformat ( " Cannot navigate to '%s' as it has not been found in the file system! " ,  p_path ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-14 18:14:46 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path  =  target_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_set_current_path_line_edit_text ( current_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_push_to_history ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-14 18:14:46 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  base_dir_path  =  target_path . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( base_dir_path  ! =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										base_dir_path  + =  " / " ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-04 15:10:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									TreeItem  * * directory_ptr  =  folder_map . getptr ( base_dir_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! directory_ptr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-04 15:10:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Unfold all folders along the path.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									TreeItem  * ti  =  * directory_ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									while  ( ti )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ti - > set_collapsed ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ti  =  ti - > get_parent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-14 18:14:46 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Select the file or directory in the tree.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree - > deselect_all ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( display_mode  = =  DISPLAY_MODE_TREE_ONLY )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-02 20:59:07 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Either search for 'folder/' or '/file.ext'.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										const  String  file_name  =  is_directory  ?  target_path . trim_suffix ( " / " ) . get_file ( )  +  " / "  :  " / "  +  target_path . get_file ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										TreeItem  * item  =  is_directory  ?  * directory_ptr  :  ( * directory_ptr ) - > get_first_child ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										while  ( item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( item - > get_metadata ( 0 ) . operator  String ( ) . ends_with ( file_name ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												item - > select ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-14 18:14:46 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											item  =  item - > get_next ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-14 18:14:46 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										( * directory_ptr ) - > select ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_update_file_list ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-14 18:14:46 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-12 20:24:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > ensure_cursor_is_visible ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-14 18:14:46 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-08-03 22:05:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  FileSystemDock : : _update_filtered_items ( TreeItem  * p_tree_item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									TreeItem  * item  =  p_tree_item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										item  =  tree - > get_root ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ERR_FAIL_NULL_V ( item ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  keep_visible  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( TreeItem  * child  =  item - > get_first_child ( ) ;  child ;  child  =  child - > get_next ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										keep_visible  =  _update_filtered_items ( child )  | |  keep_visible ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( searched_tokens . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										item - > set_visible ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Always uncollapse root (the hidden item above res:// and favorites).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										item - > set_collapsed ( item  ! =  tree - > get_root ( )  & &  ! uncollapsed_paths_before_search . has ( item - > get_metadata ( 0 ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( keep_visible )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										item - > set_collapsed ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// res:// and favorites are always visible.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										keep_visible  =  item  = =  resources_item  | |  item  = =  favorites_item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										keep_visible  =  keep_visible  | |  _matches_all_search_tokens ( item - > get_text ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									item - > set_visible ( keep_visible ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  keep_visible ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-17 20:40:38 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : navigate_to_path ( const  String  & p_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-25 13:14:45 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_search_box - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-17 20:40:38 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_navigate_to_path ( p_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-14 03:55:36 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Ensure that the FileSystem dock is visible.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-05 17:31:19 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorDockManager : : get_singleton ( ) - > focus_dock ( this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-06-24 12:41:00 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									import_dock_needs_update  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_update_import_dock ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-17 20:40:38 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-11 15:43:37 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_list_thumbnail_done ( const  String  & p_path ,  const  Ref < Texture2D >  & p_preview ,  const  Ref < Texture2D >  & p_small_preview ,  const  Variant  & p_udata )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-02 13:05:53 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_preview . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Array  uarr  =  p_udata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  idx  =  uarr [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										String  file  =  uarr [ 1 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-28 13:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( idx  <  files - > get_item_count ( )  & &  files - > get_item_text ( idx )  = =  file  & &  files - > get_item_metadata ( idx )  = =  p_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( file_list_display_mode  = =  FILE_LIST_DISPLAY_LIST )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( p_small_preview . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-28 13:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													files - > set_item_icon ( idx ,  p_small_preview ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-28 13:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												files - > set_item_icon ( idx ,  p_preview ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-11 15:43:37 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _tree_thumbnail_done ( const  String  & p_path ,  const  Ref < Texture2D >  & p_preview ,  const  Ref < Texture2D >  & p_small_preview ,  const  Variant  & p_udata )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-12 13:10:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_small_preview . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Array  uarr  =  p_udata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( tree_update_id  = =  ( int ) uarr [ 0 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											TreeItem  * file_item  =  Object : : cast_to < TreeItem > ( uarr [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( file_item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_item - > set_icon ( 0 ,  p_small_preview ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-05 03:55:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _toggle_file_display ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_set_file_display ( file_list_display_mode  ! =  FILE_LIST_DISPLAY_LIST ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									emit_signal ( SNAME ( " display_mode_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 21:36:12 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-27 21:36:12 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _set_file_display ( bool  p_active )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_active )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										file_list_display_mode  =  FILE_LIST_DISPLAY_LIST ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										button_file_list_display_mode - > set_button_icon ( get_editor_theme_icon ( SNAME ( " FileThumbnail " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										button_file_list_display_mode - > set_tooltip_text ( TTRC ( " View items as a grid of thumbnails. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										file_list_display_mode  =  FILE_LIST_DISPLAY_THUMBNAILS ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										button_file_list_display_mode - > set_button_icon ( get_editor_theme_icon ( SNAME ( " FileList " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										button_file_list_display_mode - > set_tooltip_text ( TTRC ( " View items as a list. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-16 13:25:42 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-28 13:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_update_file_list ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-08 19:18:03 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  FileSystemDock : : _is_file_type_disabled_by_feature_profile ( const  StringName  & p_class )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Ref < EditorFeatureProfile >  profile  =  EditorFeatureProfileManager : : get_singleton ( ) - > get_current_profile ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-06 20:51:40 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( profile . is_null ( )  | |  ! ClassDB : : class_exists ( p_class ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-08 19:18:03 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									StringName  class_name  =  p_class ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									while  ( class_name  ! =  StringName ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( profile - > is_class_disabled ( class_name ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										class_name  =  ClassDB : : get_parent_class ( class_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _search ( EditorFileSystemDirectory  * p_path ,  List < FileInfo >  * matches ,  int  p_max_items )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( matches - > size ( )  >  p_max_items )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  p_path - > get_subdir_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_search ( p_path - > get_subdir ( i ) ,  matches ,  p_max_items ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  p_path - > get_file_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										String  file  =  p_path - > get_file ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 02:22:16 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( _matches_all_search_tokens ( file ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											FileInfo  file_info ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_info . name  =  file ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_info . type  =  p_path - > get_file_type ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_info . path  =  p_path - > get_file_path ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_info . import_broken  =  ! p_path - > get_file_import_is_valid ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_info . modified_time  =  p_path - > get_file_modified_time ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( _is_file_type_disabled_by_feature_profile ( file_info . type ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// This type is disabled, will not appear here.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-08 19:18:03 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											matches - > push_back ( file_info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( matches - > size ( )  >  p_max_items )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-28 13:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _update_file_list ( bool  p_keep_selection )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 21:59:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Register the previously current and selected items.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									HashSet < String >  previous_selection ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									HashSet < int >  valid_selection ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_keep_selection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  files - > get_item_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( files - > is_selected ( i ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 21:59:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												previous_selection . insert ( files - > get_item_text ( i ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									files - > clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_set_current_path_line_edit_text ( current_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  directory  =  current_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  file  =  " " ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 16:43:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  thumbnail_size  =  EDITOR_GET ( " docks/filesystem/thumbnail_size " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-30 00:28:29 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									thumbnail_size  * =  EDSCALE ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-11 15:43:37 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < Texture2D >  folder_thumbnail ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Ref < Texture2D >  file_thumbnail ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Ref < Texture2D >  file_thumbnail_broken ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bool  use_thumbnails  =  ( file_list_display_mode  = =  FILE_LIST_DISPLAY_THUMBNAILS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( use_thumbnails )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Thumbnails mode.
 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										files - > set_max_columns ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > set_icon_mode ( ItemList : : ICON_MODE_TOP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > set_fixed_column_width ( thumbnail_size  *  3  /  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > set_max_text_lines ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-12 16:51:27 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										files - > set_fixed_icon_size ( Size2 ( thumbnail_size ,  thumbnail_size ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-01 21:15:16 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  int  icon_size  =  get_theme_constant ( SNAME ( " class_icon_size " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > set_fixed_tag_icon_size ( Size2 ( icon_size ,  icon_size ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-08 02:32:43 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( thumbnail_size  <  64 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											folder_thumbnail  =  get_editor_theme_icon ( SNAME ( " FolderMediumThumb " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_thumbnail  =  get_editor_theme_icon ( SNAME ( " FileMediumThumb " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_thumbnail_broken  =  get_editor_theme_icon ( SNAME ( " FileDeadMediumThumb " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-08 02:32:43 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											folder_thumbnail  =  get_editor_theme_icon ( SNAME ( " FolderBigThumb " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_thumbnail  =  get_editor_theme_icon ( SNAME ( " FileBigThumb " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file_thumbnail_broken  =  get_editor_theme_icon ( SNAME ( " FileDeadBigThumb " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// No thumbnails.
 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										files - > set_icon_mode ( ItemList : : ICON_MODE_LEFT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > set_max_columns ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > set_max_text_lines ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > set_fixed_column_width ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-08 11:59:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  int  icon_size  =  get_theme_constant ( SNAME ( " class_icon_size " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > set_fixed_icon_size ( Size2 ( icon_size ,  icon_size ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-14 19:44:41 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < Texture2D >  folder_icon  =  ( use_thumbnails )  ?  folder_thumbnail  :  get_theme_icon ( SNAME ( " folder " ) ,  SNAME ( " FileDialog " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  Color  default_folder_color  =  get_theme_color ( SNAME ( " folder_icon_color " ) ,  SNAME ( " FileDialog " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Build the FileInfo list.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									List < FileInfo >  file_list ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( current_path  = =  " Favorites " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Display the favorites.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Vector < String >  favorites_list  =  EditorSettings : : get_singleton ( ) - > get_favorites ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( const  String  & favorite  :  favorites_list )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  text ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-11 15:43:37 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Ref < Texture2D >  icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( favorite  = =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												text  =  " / " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												icon  =  folder_icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 02:22:16 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( searched_tokens . is_empty ( )  | |  _matches_all_search_tokens ( text ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													files - > add_item ( text ,  icon ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-12 01:06:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													files - > set_item_metadata ( - 1 ,  favorite ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( favorite . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												text  =  favorite . substr ( 0 ,  favorite . length ( )  -  1 ) . get_file ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												icon  =  folder_icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 02:22:16 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( searched_tokens . is_empty ( )  | |  _matches_all_search_tokens ( text ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													files - > add_item ( text ,  icon ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-12 01:06:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													files - > set_item_metadata ( - 1 ,  favorite ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												EditorFileSystemDirectory  * efd  =  EditorFileSystem : : get_singleton ( ) - > find_file ( favorite ,  & index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												FileInfo  file_info ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_info . name  =  favorite . get_file ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_info . path  =  favorite ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( efd )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													file_info . type  =  efd - > get_file_type ( index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													file_info . icon_path  =  efd - > get_file_icon_path ( index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													file_info . import_broken  =  ! efd - > get_file_import_is_valid ( index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													file_info . modified_time  =  efd - > get_file_modified_time ( index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													file_info . type  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													file_info . import_broken  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													file_info . modified_time  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( searched_tokens . is_empty ( )  | |  _matches_all_search_tokens ( file_info . name ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													file_list . push_back ( file_info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-25 14:18:48 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! directory . begins_with ( " res:// " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											directory  =  " res:// "  +  directory ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Get infos on the directory + file.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( directory . ends_with ( " / " )  & &  directory  ! =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											directory  =  directory . substr ( 0 ,  directory . length ( )  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										EditorFileSystemDirectory  * efd  =  EditorFileSystem : : get_singleton ( ) - > get_filesystem_path ( directory ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! efd )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											directory  =  current_path . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											file  =  current_path . get_file ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											efd  =  EditorFileSystem : : get_singleton ( ) - > get_filesystem_path ( directory ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! efd )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 02:22:16 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! searched_tokens . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Display the search results.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-22 14:44:47 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Limit the number of results displayed to avoid an infinite loop.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_search ( EditorFileSystem : : get_singleton ( ) - > get_filesystem ( ) ,  & file_list ,  10000 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-16 22:08:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( display_mode  = =  DISPLAY_MODE_TREE_ONLY  | |  always_show_folders )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// Check for a folder color to inherit (if one is assigned).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												Color  inherited_folder_color  =  default_folder_color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												String  color_scan_dir  =  directory ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												while  ( color_scan_dir  ! =  " res:// "  & &  inherited_folder_color  = =  default_folder_color )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( ! color_scan_dir . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														color_scan_dir  + =  " / " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( assigned_folder_colors . has ( color_scan_dir ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														inherited_folder_color  =  folder_colors [ assigned_folder_colors [ color_scan_dir ] ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													color_scan_dir  =  color_scan_dir . rstrip ( " / " ) . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// Display folders in the list.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( directory  ! =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													files - > add_item ( " .. " ,  folder_icon ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													String  bd  =  directory . get_base_dir ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( bd  ! =  " res:// "  & &  ! bd . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														bd  + =  " / " ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-12 01:06:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													files - > set_item_metadata ( - 1 ,  bd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													files - > set_item_selectable ( - 1 ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-14 02:09:49 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													files - > set_item_icon_modulate ( - 1 ,  editor_is_dark_theme  ?  inherited_folder_color  :  inherited_folder_color  *  ITEM_COLOR_SCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												bool  reversed  =  file_sort  = =  FileSortOption : : FILE_SORT_NAME_REVERSE ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-22 23:38:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												for  ( int  i  =  reversed  ?  efd - > get_subdir_count ( )  -  1  :  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														reversed  ?  i  > =  0  :  i  <  efd - > get_subdir_count ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														reversed  ?  i - -  :  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													String  dname  =  efd - > get_subdir ( i ) - > get_name ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													String  dpath  =  directory . path_join ( dname )  +  " / " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													bool  has_custom_color  =  assigned_folder_colors . has ( dpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													files - > add_item ( dname ,  folder_icon ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													files - > set_item_metadata ( - 1 ,  dpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													Color  this_folder_color  =  has_custom_color  ?  folder_colors [ assigned_folder_colors [ dpath ] ]  :  inherited_folder_color ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-14 02:09:49 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													files - > set_item_icon_modulate ( - 1 ,  editor_is_dark_theme  ?  this_folder_color  :  this_folder_color  *  ITEM_COLOR_SCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 21:59:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( previous_selection . has ( dname ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														files - > select ( files - > get_item_count ( )  -  1 ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 21:59:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														valid_selection . insert ( files - > get_item_count ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Display the folder content.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											for  ( int  i  =  0 ;  i  <  efd - > get_file_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												FileInfo  file_info ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_info . name  =  efd - > get_file ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_info . path  =  directory . path_join ( file_info . name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_info . type  =  efd - > get_file_type ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_info . icon_path  =  efd - > get_file_icon_path ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_info . import_broken  =  ! efd - > get_file_import_is_valid ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												file_info . modified_time  =  efd - > get_file_modified_time ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												file_list . push_back ( file_info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Sort the file list if needed.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sort_file_info_list ( file_list ,  file_sort ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Fills the ItemList control node from the FileInfos.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-14 20:01:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  String  main_scene  =  ResourceUID : : ensure_path ( GLOBAL_GET ( " application/run/main_scene " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( FileInfo  & E  :  file_list )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										FileInfo  * finfo  =  & ( E ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  fname  =  finfo - > name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										String  fpath  =  finfo - > path ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-11 15:43:37 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Ref < Texture2D >  type_icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Ref < Texture2D >  big_icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-05 15:21:38 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  tooltip  =  fpath ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-27 14:18:40 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Select the icons.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-18 12:58:05 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										type_icon  =  _get_tree_item_icon ( ! finfo - > import_broken ,  finfo - > type ,  finfo - > icon_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! finfo - > import_broken )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											big_icon  =  file_thumbnail ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-29 20:17:34 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											big_icon  =  file_thumbnail_broken ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-06 14:32:21 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											tooltip  + =  " \n "  +  TTR ( " Status: Import of file failed. Please fix file and reimport manually. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-27 14:18:40 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Add the item to the ItemList.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										int  item_index ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( use_thumbnails )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-29 20:17:34 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											files - > add_item ( fname ,  big_icon ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											item_index  =  files - > get_item_count ( )  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											files - > set_item_metadata ( item_index ,  fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											files - > set_item_tag_icon ( item_index ,  type_icon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-28 13:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											files - > add_item ( fname ,  type_icon ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											item_index  =  files - > get_item_count ( )  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											files - > set_item_metadata ( item_index ,  fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-01-08 02:09:31 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( fpath  = =  main_scene )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											files - > set_item_custom_fg_color ( item_index ,  get_theme_color ( SNAME ( " accent_color " ) ,  EditorStringName ( Editor ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-08 02:09:31 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Generate the preview.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-28 13:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! finfo - > import_broken )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Array  udata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											udata . resize ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											udata [ 0 ]  =  item_index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											udata [ 1 ]  =  fname ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											EditorResourcePreview : : get_singleton ( ) - > queue_resource_preview ( fpath ,  this ,  " _file_list_thumbnail_done " ,  udata ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Select the items.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 21:59:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( previous_selection . has ( fname ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											files - > select ( item_index ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 21:59:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											valid_selection . insert ( item_index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-27 14:18:40 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! p_keep_selection  & &  ! file . is_empty ( )  & &  fname  = =  file )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											files - > select ( item_index ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											files - > ensure_current_is_visible ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Tooltip.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( finfo - > sources . size ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( int  j  =  0 ;  j  <  finfo - > sources . size ( ) ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												tooltip  + =  " \n Source:  "  +  finfo - > sources [ j ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > set_item_tooltip ( item_index ,  tooltip ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 21:59:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// If we only have any selected items retained, we need to update the current idx.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! valid_selection . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > set_current ( * valid_selection . begin ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								HashSet < String >  FileSystemDock : : _get_valid_conversions_for_file_paths ( const  Vector < String >  & p_paths )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									HashSet < String >  all_valid_conversion_to_targets ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( const  String  & fpath  :  p_paths )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( fpath . is_empty ( )  | |  fpath  = =  " res:// "  | |  ! FileAccess : : exists ( fpath )  | |  FileAccess : : exists ( fpath  +  " .import " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  HashSet < String > ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Vector < Ref < EditorResourceConversionPlugin > >  conversions  =  EditorNode : : get_singleton ( ) - > find_resource_conversion_plugin_for_type_name ( EditorFileSystem : : get_singleton ( ) - > get_file_type ( fpath ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( conversions . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// This resource can't convert to anything, so return an empty list.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  HashSet < String > ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-08 11:56:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Get a list of all potential conversion-to targets.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										HashSet < String >  current_valid_conversion_to_targets ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( const  Ref < EditorResourceConversionPlugin >  & E  :  conversions )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											const  String  what  =  E - > converts_to ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											current_valid_conversion_to_targets . insert ( what ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( all_valid_conversion_to_targets . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// If we have no existing valid conversions, this is the first one, so copy them directly.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											all_valid_conversion_to_targets  =  current_valid_conversion_to_targets ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Check existing conversion targets and remove any which are not in the current list.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( const  String  & S  :  all_valid_conversion_to_targets )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! current_valid_conversion_to_targets . has ( S ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													all_valid_conversion_to_targets . erase ( S ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// We have no more remaining valid conversions, so break the loop.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( all_valid_conversion_to_targets . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  all_valid_conversion_to_targets ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-04 15:19:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _select_file ( const  String  & p_path ,  bool  p_select_in_favorites ,  bool  p_navigate )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  fpath  =  p_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( fpath . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-04 21:00:23 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Ignore a directory.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  if  ( fpath  ! =  " Favorites " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-23 11:20:14 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( FileAccess : : exists ( fpath  +  " .import " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Ref < ConfigFile >  config ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-17 16:03:09 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											config . instantiate ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-23 11:20:14 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Error  err  =  config - > load ( fpath  +  " .import " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( err  = =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( config - > has_section_key ( " remap " ,  " importer " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													String  importer  =  config - > get_value ( " remap " ,  " importer " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-05 12:10:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( importer  = =  " keep "  | |  importer  = =  " skip " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														EditorNode : : get_singleton ( ) - > show_warning ( TTRC ( " Importing has been disabled for this file, so it can't be opened for editing. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-23 11:20:14 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-21 01:00:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  resource_type  =  ResourceLoader : : get_resource_type ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-08 00:48:53 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( resource_type  = =  " PackedScene "  | |  resource_type  = =  " AnimationLibrary " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 09:57:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											bool  is_imported  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												List < String >  importer_exts ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-08 00:48:53 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ResourceImporterScene : : get_scene_importer_extensions ( & importer_exts ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 09:57:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												String  extension  =  fpath . get_extension ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-24 15:46:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												for  ( const  String  & E  :  importer_exts )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( extension . nocasecmp_to ( E )  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 09:57:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														is_imported  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( is_imported )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-06 00:17:33 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												SceneImportSettingsDialog : : get_singleton ( ) - > open_settings ( p_path ,  resource_type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-03 18:27:16 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-28 17:40:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												EditorNode : : get_singleton ( ) - > load_scene_or_resource ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 09:57:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-21 01:00:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ResourceLoader : : is_imported ( fpath ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// If the importer has advanced settings, show them.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											int  order ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											bool  can_threads ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											String  name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Error  err  =  ResourceFormatImporter : : get_singleton ( ) - > get_import_order_threads_and_importer ( fpath ,  order ,  can_threads ,  name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											bool  used_advanced_settings  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( err  = =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												Ref < ResourceImporter >  importer  =  ResourceFormatImporter : : get_singleton ( ) - > get_importer_by_name ( name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( importer . is_valid ( )  & &  importer - > has_advanced_options ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													importer - > show_advanced_options ( fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													used_advanced_settings  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! used_advanced_settings )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												EditorNode : : get_singleton ( ) - > load_resource ( fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-09 14:59:48 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-27 10:36:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorNode : : get_singleton ( ) - > load_resource ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-09 14:59:48 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-04 15:19:01 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_navigate )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_navigate_to_path ( fpath ,  p_select_in_favorites ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _tree_activate_file ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									TreeItem  * selected  =  tree - > get_selected ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  file_path  =  selected - > get_metadata ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-17 20:40:38 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										TreeItem  * parent  =  selected - > get_parent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bool  is_favorite  =  parent  ! =  nullptr  & &  parent - > get_metadata ( 0 )  = =  " Favorites " ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-08 20:47:47 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bool  is_folder  =  file_path . ends_with ( " / " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-08 20:47:47 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ( ! is_favorite  & &  is_folder )  | |  file_path  = =  " Favorites " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											bool  collapsed  =  selected - > is_collapsed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											selected - > set_collapsed ( ! collapsed ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-17 20:40:38 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-08 20:47:47 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_select_file ( file_path ,  is_favorite  & &  ! is_folder ,  is_favorite  & &  is_folder ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-16 22:08:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_list_activate_file ( int  p_idx )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_select_file ( files - > get_item_metadata ( p_idx ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _preview_invalidated ( const  String  & p_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 02:22:16 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( file_list_display_mode  = =  FILE_LIST_DISPLAY_THUMBNAILS  & &  p_path . get_base_dir ( )  = =  current_path  & &  searched_tokens . is_empty ( )  & &  file_list_vb - > is_visible_in_tree ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  files - > get_item_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-03 13:15:15 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( files - > get_item_metadata ( i )  = =  p_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// Re-request preview.
 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-03 13:15:15 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Array  udata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												udata . resize ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												udata [ 0 ]  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												udata [ 1 ]  =  files - > get_item_text ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-12 13:10:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												EditorResourcePreview : : get_singleton ( ) - > queue_resource_preview ( p_path ,  this ,  " _file_list_thumbnail_done " ,  udata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-03 13:15:15 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _fs_changed ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_prev - > set_disabled ( history_pos  = =  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_next - > set_disabled ( history_pos  = =  history . size ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									scanning_vb - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									split_box - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-16 15:52:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									update_all ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-14 18:18:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! select_after_scan . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_navigate_to_path ( select_after_scan ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										select_after_scan . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										import_dock_needs_update  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_update_import_dock ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									set_process ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-07 00:26:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( had_focus )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										had_focus - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										had_focus  =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-21 13:07:29 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _set_scanning_mode ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_prev - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									button_hist_next - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									split_box - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									scanning_vb - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									set_process ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( EditorFileSystem : : get_singleton ( ) - > is_scanning ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-04 01:16:14 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										scanning_progress - > set_value ( EditorFileSystem : : get_singleton ( ) - > get_scanning_progress ( )  *  100 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-04 01:16:14 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										scanning_progress - > set_value ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _fw_history ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( history_pos  <  history . size ( )  -  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										history_pos + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_update_history ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _bw_history ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( history_pos  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										history_pos - - ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_update_history ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _update_history ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path  =  history [ history_pos ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_set_current_path_line_edit_text ( current_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-13 10:45:50 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( tree - > is_visible ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_update_tree ( get_uncollapsed_paths ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										tree - > grab_focus ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-13 10:45:50 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( file_list_vb - > is_visible ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-28 13:26:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_update_file_list ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									button_hist_prev - > set_disabled ( history_pos  = =  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_next - > set_disabled ( history_pos  = =  history . size ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _push_to_history ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( history [ history_pos ]  ! =  current_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										history . resize ( history_pos  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										history . push_back ( current_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										history_pos + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( history . size ( )  >  history_max_size )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 16:17:03 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											history . remove_at ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											history_pos  =  history_max_size  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									button_hist_prev - > set_disabled ( history_pos  = =  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_next - > set_disabled ( history_pos  = =  history . size ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _get_all_items_in_dir ( EditorFileSystemDirectory  * p_efsd ,  Vector < String >  & r_files ,  Vector < String >  & r_folders )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_efsd  = =  nullptr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  p_efsd - > get_subdir_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										r_folders . push_back ( p_efsd - > get_subdir ( i ) - > get_path ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_get_all_items_in_dir ( p_efsd - > get_subdir ( i ) ,  r_files ,  r_folders ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  p_efsd - > get_file_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										r_files . push_back ( p_efsd - > get_file_path ( i ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _find_file_owners ( EditorFileSystemDirectory  * p_efsd ,  const  HashSet < String >  & p_renames ,  HashSet < String >  & r_file_owners )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  p_efsd - > get_subdir_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_find_file_owners ( p_efsd - > get_subdir ( i ) ,  p_renames ,  r_file_owners ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  p_efsd - > get_file_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Vector < String >  deps  =  p_efsd - > get_file_deps ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  j  =  0 ;  j  <  deps . size ( ) ;  j + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( p_renames . has ( deps [ j ] ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												r_file_owners . insert ( p_efsd - > get_file_path ( i ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _try_move_item ( const  FileOrFolder  & p_item ,  const  String  & p_new_path , 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										HashMap < String ,  String >  & p_file_renames ,  HashMap < String ,  String >  & p_folder_renames )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Ensure folder paths end with "/".
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  old_path  =  ( p_item . is_file  | |  p_item . path . ends_with ( " / " ) )  ?  p_item . path  :  ( p_item . path  +  " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									String  new_path  =  ( p_item . is_file  | |  p_new_path . ends_with ( " / " ) )  ?  p_new_path  :  ( p_new_path  +  " / " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( new_path  = =  old_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  if  ( old_path  = =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > add_io_error ( TTR ( " Cannot move/rename resources root. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( ! p_item . is_file  & &  new_path . begins_with ( old_path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// This check doesn't erroneously catch renaming to a longer name as folder paths always end with "/".
 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-04 22:00:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > add_io_error ( TTR ( " Cannot move a folder into itself. " )  +  " \n "  +  old_path  +  " \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Build a list of files which will have new paths as a result of this operation.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  file_changed_paths ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < String >  folder_changed_paths ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_item . is_file )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										file_changed_paths . push_back ( old_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										folder_changed_paths . push_back ( old_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_get_all_items_in_dir ( EditorFileSystem : : get_singleton ( ) - > get_filesystem_path ( old_path ) ,  file_changed_paths ,  folder_changed_paths ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 11:08:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < DirAccess >  da  =  DirAccess : : create ( DirAccess : : ACCESS_RESOURCES ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 09:35:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									print_verbose ( " Moving  "  +  old_path  +  "  ->  "  +  new_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Error  err  =  da - > rename ( old_path ,  new_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( err  = =  OK )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Move/Rename any corresponding import settings too.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( p_item . is_file  & &  FileAccess : : exists ( old_path  +  " .import " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											err  =  da - > rename ( old_path  +  " .import " ,  new_path  +  " .import " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( err  ! =  OK )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-04 22:00:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												EditorNode : : get_singleton ( ) - > add_io_error ( TTR ( " Error moving: " )  +  " \n "  +  old_path  +  " .import \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 10:42:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( p_item . is_file  & &  FileAccess : : exists ( old_path  +  " .uid " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											err  =  da - > rename ( old_path  +  " .uid " ,  new_path  +  " .uid " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( err  ! =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												EditorNode : : get_singleton ( ) - > add_io_error ( TTR ( " Error moving: " )  +  " \n "  +  old_path  +  " .uid \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Update scene if it is open.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  file_changed_paths . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											String  new_item_path  =  p_item . is_file  ?  new_path  :  file_changed_paths [ i ] . replace_first ( old_path ,  new_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-27 10:36:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ResourceLoader : : get_resource_type ( new_item_path )  = =  " PackedScene "  & &  EditorNode : : get_singleton ( ) - > is_scene_open ( file_changed_paths [ i ] ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-11 15:55:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												EditorData  * ed  =  & EditorNode : : get_editor_data ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-28 19:48:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												for  ( int  j  =  0 ;  j  <  ed - > get_edited_scene_count ( ) ;  j + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( ed - > get_scene_path ( j )  = =  file_changed_paths [ i ] )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-30 16:30:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														ed - > get_edited_scene_root ( j ) - > set_scene_file_path ( new_item_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														EditorNode : : get_singleton ( ) - > save_editor_layout_delayed ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-28 19:48:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Only treat as a changed dependency if it was successfully moved.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  file_changed_paths . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											p_file_renames [ file_changed_paths [ i ] ]  =  file_changed_paths [ i ] . replace_first ( old_path ,  new_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 09:35:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											print_verbose ( "   Remap:  "  +  file_changed_paths [ i ]  +  "  ->  "  +  p_file_renames [ file_changed_paths [ i ] ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											emit_signal ( SNAME ( " files_moved " ) ,  file_changed_paths [ i ] ,  p_file_renames [ file_changed_paths [ i ] ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  folder_changed_paths . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											p_folder_renames [ folder_changed_paths [ i ] ]  =  folder_changed_paths [ i ] . replace_first ( old_path ,  new_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											emit_signal ( SNAME ( " folder_moved " ) ,  folder_changed_paths [ i ] ,  p_folder_renames [ folder_changed_paths [ i ] ] . substr ( 0 ,  p_folder_renames [ folder_changed_paths [ i ] ] . length ( )  -  1 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-04 22:00:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > add_io_error ( TTR ( " Error moving: " )  +  " \n "  +  old_path  +  " \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 14:13:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _try_duplicate_item ( const  FileOrFolder  & p_item ,  const  String  & p_new_path )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Ensure folder paths end with "/".
 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 14:13:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  old_path  =  ( p_item . is_file  | |  p_item . path . ends_with ( " / " ) )  ?  p_item . path  :  ( p_item . path  +  " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									String  new_path  =  ( p_item . is_file  | |  p_new_path . ends_with ( " / " ) )  ?  p_new_path  :  ( p_new_path  +  " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( new_path  = =  old_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( old_path  = =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > add_io_error ( TTR ( " Cannot move/rename resources root. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( ! p_item . is_file  & &  new_path . begins_with ( old_path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// This check doesn't erroneously catch renaming to a longer name as folder paths always end with "/".
 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-04 22:00:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > add_io_error ( TTR ( " Cannot move a folder into itself. " )  +  " \n "  +  old_path  +  " \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 14:13:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-01 14:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_item . is_file )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										print_verbose ( " Duplicating  "  +  old_path  +  "  ->  "  +  new_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Create the directory structure.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-16 20:48:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorFileSystem : : get_singleton ( ) - > make_dir_recursive ( p_new_path . get_base_dir ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-03 12:54:57 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-16 20:48:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Error  err  =  EditorFileSystem : : get_singleton ( ) - > copy_file ( old_path ,  new_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( err  ! =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											EditorNode : : get_singleton ( ) - > add_io_error ( TTR ( " Error duplicating: " )  +  " \n "  +  old_path  +  " :  "  +  error_names [ err ]  +  " \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 14:13:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-16 20:48:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Error  err  =  EditorFileSystem : : get_singleton ( ) - > copy_directory ( old_path ,  new_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( err  ! =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											EditorNode : : get_singleton ( ) - > add_io_error ( TTR ( " Error duplicating directory: " )  +  " \n "  +  old_path  +  " \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-01 14:27:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 14:13:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _update_resource_paths_after_move ( const  HashMap < String ,  String >  & p_renames ,  const  HashMap < String ,  ResourceUID : : ID >  & p_uids )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-04 00:14:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( const  KeyValue < String ,  String >  & pair  :  p_renames )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Update UID path.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										const  String  & old_path  =  pair . key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										const  String  & new_path  =  pair . value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										const  HashMap < String ,  ResourceUID : : ID > : : ConstIterator  I  =  p_uids . find ( old_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( I )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ResourceUID : : get_singleton ( ) - > set_id ( I - > value ,  new_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-01 00:26:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorFileSystem : : get_singleton ( ) - > register_global_class_script ( old_path ,  new_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Rename all resources loaded, be it subresources or actual resources.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-17 07:33:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									List < Ref < Resource > >  cached ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 16:32:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ResourceCache : : get_cached_resources ( & cached ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-26 17:50:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( Ref < Resource >  & r  :  cached )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 16:32:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  base_path  =  r - > get_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										String  extra_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  sep_pos  =  r - > get_path ( ) . find ( " :: " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( sep_pos  > =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-26 11:41:11 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											extra_path  =  base_path . substr ( sep_pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 16:32:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											base_path  =  base_path . substr ( 0 ,  sep_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( p_renames . has ( base_path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											base_path  =  p_renames [ base_path ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-04 00:14:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											r - > set_path ( base_path  +  extra_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 16:32:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-04 00:14:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-02-10 19:44:36 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorNode : : get_editor_data ( ) . script_class_save_global_classes ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-04 00:14:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorFileSystem : : get_singleton ( ) - > emit_signal ( SNAME ( " script_classes_updated " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 16:32:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _update_dependencies_after_move ( const  HashMap < String ,  String >  & p_renames ,  const  HashSet < String >  & p_file_owners )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// The following code assumes that the following holds:
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// 1) EditorFileSystem contains the old paths/folder structure from before the rename/move.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// 2) ResourceLoader can use the new paths without needing to call rescan.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-06 13:52:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// The currently edited scene should be reloaded first, so get it's path (GH-82652).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  String  & edited_scene_path  =  EditorNode : : get_editor_data ( ) . get_scene_path ( EditorNode : : get_editor_data ( ) . get_edited_scene ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									List < String >  scenes_to_reload ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( const  String  & E  :  p_file_owners )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Because we haven't called a rescan yet the found remap might still be an old path itself.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  HashMap < String ,  String > : : ConstIterator  I  =  p_renames . find ( E ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										const  String  file  =  I  ?  I - > value  :  E ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 09:35:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										print_verbose ( " Remapping dependencies for:  "  +  file ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  Error  err  =  ResourceLoader : : rename_dependencies ( file ,  p_renames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-28 19:48:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( err  = =  OK )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ResourceLoader : : get_resource_type ( file )  = =  " PackedScene " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-06 13:52:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( file  = =  edited_scene_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													scenes_to_reload . push_front ( file ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													scenes_to_reload . push_back ( file ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-28 19:48:09 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorNode : : get_singleton ( ) - > add_io_error ( TTR ( " Unable to update dependencies for: " )  +  " \n "  +  E  +  " \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 00:22:54 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( const  String  & E  :  scenes_to_reload )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > reload_scene ( E ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 00:22:54 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-06 12:41:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _update_project_settings_after_move ( const  HashMap < String ,  String >  & p_renames ,  const  HashMap < String ,  String >  & p_folders_renames )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Find all project settings of type FILE and replace them if needed.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  HashMap < StringName ,  PropertyInfo >  prop_info  =  ProjectSettings : : get_singleton ( ) - > get_custom_property_info ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 14:13:42 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( const  KeyValue < StringName ,  PropertyInfo >  & E  :  prop_info )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( E . value . hint  = =  PROPERTY_HINT_FILE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											String  old_path  =  GLOBAL_GET ( E . key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-26 20:19:38 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( p_renames . has ( old_path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 14:13:42 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ProjectSettings : : get_singleton ( ) - > set_setting ( E . key ,  p_renames [ old_path ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-26 20:19:38 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-13 22:05:53 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Also search for the file in autoload, as they are stored differently from normal files.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									List < PropertyInfo >  property_list ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ProjectSettings : : get_singleton ( ) - > get_property_list ( & property_list ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( const  PropertyInfo  & E  :  property_list )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( E . name . begins_with ( " autoload/ " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-13 22:05:53 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// If the autoload resource paths has a leading "*", it indicates that it is a Singleton,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// so we have to handle both cases when updating.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  autoload  =  GLOBAL_GET ( E . name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-26 11:41:11 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  autoload_singleton  =  autoload . substr ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-13 22:05:53 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( p_renames . has ( autoload ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ProjectSettings : : get_singleton ( ) - > set_setting ( E . name ,  p_renames [ autoload ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-13 22:05:53 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  if  ( autoload . begins_with ( " * " )  & &  p_renames . has ( autoload_singleton ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ProjectSettings : : get_singleton ( ) - > set_setting ( E . name ,  " * "  +  p_renames [ autoload_singleton ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-13 22:05:53 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-06 12:41:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Update folder colors.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( const  KeyValue < String ,  String >  & rename  :  p_folders_renames )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( assigned_folder_colors . has ( rename . key ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											assigned_folder_colors [ rename . value ]  =  assigned_folder_colors [ rename . key ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											assigned_folder_colors . erase ( rename . key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-26 20:19:38 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ProjectSettings : : get_singleton ( ) - > save ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								String  FileSystemDock : : _get_unique_name ( const  FileOrFolder  & p_entry ,  const  String  & p_at_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									String  new_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									String  new_path_base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_entry . is_file )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_path  =  p_at_path . path_join ( p_entry . path . get_file ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_path_base  =  new_path . get_basename ( )  +  "  (%d). "  +  new_path . get_extension ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PackedStringArray  path_split  =  p_entry . path . split ( " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_path  =  p_at_path . path_join ( path_split [ path_split . size ( )  -  2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_path_base  =  new_path  +  "  (%d) " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  exist_counter  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Ref < DirAccess >  da  =  DirAccess : : create ( DirAccess : : ACCESS_RESOURCES ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									while  ( da - > file_exists ( new_path )  | |  da - > dir_exists ( new_path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										exist_counter + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_path  =  vformat ( new_path_base ,  exist_counter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  new_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 21:53:54 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _update_favorites_after_move ( const  HashMap < String ,  String >  & p_files_renames ,  const  HashMap < String ,  String >  & p_folders_renames )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < String >  favorite_files  =  EditorSettings : : get_singleton ( ) - > get_favorites ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < String >  new_favorite_files ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( const  String  & old_path  :  favorite_files )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-18 14:02:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( p_folders_renames . has ( old_path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 21:53:54 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											new_favorite_files . push_back ( p_folders_renames [ old_path ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-18 14:02:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( p_files_renames . has ( old_path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 21:53:54 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											new_favorite_files . push_back ( p_files_renames [ old_path ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 21:53:54 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											new_favorite_files . push_back ( old_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 21:53:54 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorSettings : : get_singleton ( ) - > set_favorites ( new_favorite_files ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 21:53:54 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									HashMap < String ,  PackedStringArray >  favorite_properties  =  EditorSettings : : get_singleton ( ) - > get_favorite_properties ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( const  KeyValue < String ,  String >  & KV  :  p_files_renames )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( favorite_properties . has ( KV . key ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											favorite_properties . replace_key ( KV . key ,  KV . value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									EditorSettings : : get_singleton ( ) - > set_favorite_properties ( favorite_properties ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 19:47:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _make_scene_confirm ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-12 02:11:52 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  String  scene_path  =  make_scene_dialog - > get_scene_path ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 19:47:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-27 10:36:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  idx  =  EditorNode : : get_singleton ( ) - > new_scene ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-11 15:55:47 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorNode : : get_editor_data ( ) . set_scene_path ( idx ,  scene_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-12 02:11:52 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorNode : : get_singleton ( ) - > set_edited_scene ( make_scene_dialog - > create_scene_root ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorNode : : get_singleton ( ) - > save_scene_if_open ( scene_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 19:47:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-23 12:01:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _resource_removed ( const  Ref < Resource >  & p_resource )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-04 00:14:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  Ref < Script >  & scr  =  p_resource ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( scr . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ScriptServer : : remove_global_class_by_path ( scr - > get_path ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-10 19:44:36 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorNode : : get_editor_data ( ) . script_class_save_global_classes ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-04 00:14:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorFileSystem : : get_singleton ( ) - > emit_signal ( SNAME ( " script_classes_updated " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-23 12:01:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									emit_signal ( SNAME ( " resource_removed " ) ,  p_resource ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-15 13:25:58 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_removed ( const  String  & p_file )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									emit_signal ( SNAME ( " file_removed " ) ,  p_file ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-16 12:30:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 11:40:55 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Find the closest parent directory available, in case multiple items were deleted along the same path.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path  =  p_file . get_base_dir ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 11:08:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < DirAccess >  da  =  DirAccess : : create ( DirAccess : : ACCESS_RESOURCES ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									while  ( ! da - > dir_exists ( current_path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										current_path  =  current_path . get_base_dir ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 11:40:55 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path_line_edit - > set_text ( current_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-13 20:17:33 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-15 13:25:58 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _folder_removed ( const  String  & p_folder )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									emit_signal ( SNAME ( " folder_removed " ) ,  p_folder ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-16 12:30:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 11:40:55 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Find the closest parent directory available, in case multiple items were deleted along the same path.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path  =  p_folder . get_base_dir ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 11:08:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < DirAccess >  da  =  DirAccess : : create ( DirAccess : : ACCESS_RESOURCES ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									while  ( ! da - > dir_exists ( current_path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										current_path  =  current_path . get_base_dir ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-09 11:40:55 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-18 10:08:20 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Remove assigned folder color for all subfolders.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  folder_colors_updated  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-14 03:04:25 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( const  Variant  & E  :  assigned_folder_colors . get_key_list ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-18 10:08:20 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  String  & path  =  E ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// These folder paths are guaranteed to end with a "/".
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( path . begins_with ( p_folder ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											assigned_folder_colors . erase ( path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											folder_colors_updated  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( folder_colors_updated )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-06 12:41:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_update_folder_colors_setting ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path_line_edit - > set_text ( current_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									EditorFileSystemDirectory  * efd  =  EditorFileSystem : : get_singleton ( ) - > get_filesystem_path ( current_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-27 17:43:26 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( efd )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										efd - > force_update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-13 20:17:33 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _rename_operation_confirm ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  new_name ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-21 21:46:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									TreeItem  * ti  =  tree - > get_edited ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  col_index  =  tree - > get_edited_column ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-21 21:46:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ti )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_name  =  ti - > get_text ( col_index ) . strip_edges ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										new_name  =  files - > get_edit_text ( ) . strip_edges ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  old_name  =  to_rename . is_file  ?  to_rename . path . get_file ( )  :  to_rename . path . left ( - 1 ) . get_file ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  rename_error  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( new_name . length ( )  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTRC ( " No name provided. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rename_error  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-05 17:56:08 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  if  ( new_name . contains_char ( ' / ' )  | |  new_name . contains_char ( ' \\ ' )  | |  new_name . contains_char ( ' : ' ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTRC ( " Name contains invalid characters. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rename_error  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-28 15:27:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  if  ( new_name [ 0 ]  = =  ' . ' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTRC ( " This filename begins with a dot rendering the file invisible to the editor. \n If you want to rename it anyway, use your operating system's file manager. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rename_error  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-07 02:47:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  if  ( to_rename . is_file  & &  to_rename . path . get_extension ( )  ! =  new_name . get_extension ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-16 19:08:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! EditorFileSystem : : get_singleton ( ) - > get_valid_extensions ( ) . find ( new_name . get_extension ( ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorNode : : get_singleton ( ) - > show_warning ( TTRC ( " This file extension is not recognized by the editor. \n If you want to rename it anyway, use your operating system's file manager. \n After renaming to an unknown extension, the file won't be shown in the editor anymore. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											rename_error  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-16 19:08:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Restore original name.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-21 21:46:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( rename_error )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ti )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ti - > set_text ( col_index ,  old_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									String  old_path  =  to_rename . path . ends_with ( " / " )  ?  to_rename . path . left ( - 1 )  :  to_rename . path ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 19:34:01 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  new_path  =  old_path . get_base_dir ( ) . path_join ( new_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( old_path  = =  new_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-19 15:54:33 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( EditorFileSystem : : get_singleton ( ) - > is_group_file ( old_path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										EditorFileSystem : : get_singleton ( ) - > move_group_file ( old_path ,  new_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Present a more user friendly warning for name conflict.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 11:08:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < DirAccess >  da  =  DirAccess : : create ( DirAccess : : ACCESS_RESOURCES ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-07 14:36:41 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  new_exist  =  ( da - > file_exists ( new_path )  | |  da - > dir_exists ( new_path ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! da - > is_case_sensitive ( new_path . get_base_dir ( ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_exist  =  new_exist  & &  ( new_path . to_lower ( )  ! =  old_path . to_lower ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( new_exist )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTRC ( " A file or folder with this name already exists. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-30 22:52:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ti )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ti - > set_text ( col_index ,  old_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									HashMap < String ,  ResourceUID : : ID >  uids ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									HashSet < String >  file_owners ;  // The files that use these moved/renamed resource files.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_before_move ( uids ,  file_owners ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									HashMap < String ,  String >  file_renames ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									HashMap < String ,  String >  folder_renames ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 15:14:12 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_try_move_item ( to_rename ,  new_path ,  file_renames ,  folder_renames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-04 05:36:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-24 12:24:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  current_tab  =  EditorSceneTabs : : get_singleton ( ) - > get_current_tab ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_update_resource_paths_after_move ( file_renames ,  uids ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_update_dependencies_after_move ( file_renames ,  file_owners ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-06 12:41:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_update_project_settings_after_move ( file_renames ,  folder_renames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 21:53:54 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_update_favorites_after_move ( file_renames ,  folder_renames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-24 12:24:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorSceneTabs : : get_singleton ( ) - > set_current_tab ( current_tab ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-04 05:36:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-21 21:46:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ti )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-26 08:10:34 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										current_path  =  new_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										current_path_line_edit - > set_text ( current_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 09:35:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									print_verbose ( " FileSystem: calling rescan. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_rescan ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-10 08:12:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _duplicate_operation_confirm ( const  String  & p_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-16 20:48:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  String  base_dir  =  p_path . trim_suffix ( " / " ) . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! DirAccess : : dir_exists_absolute ( base_dir ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Error  err  =  EditorFileSystem : : get_singleton ( ) - > make_dir_recursive ( base_dir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-10 08:12:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( err  ! =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											EditorNode : : get_singleton ( ) - > show_warning ( vformat ( TTR ( " Could not create base directory: %s " ) ,  error_names [ err ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_try_duplicate_item ( to_duplicate ,  p_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 14:13:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _overwrite_dialog_action ( bool  p_overwrite )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_move_operation_confirm ( to_move_path ,  to_move_or_copy ,  p_overwrite  ?  OVERWRITE_REPLACE  :  OVERWRITE_RENAME ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-29 18:03:11 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _convert_dialog_action ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < Ref < Resource > >  selected_resources ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( const  String  & S  :  to_convert )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Ref < Resource >  res  =  ResourceLoader : : load ( S ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ERR_FAIL_COND ( res . is_null ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										selected_resources . push_back ( res ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < Ref < Resource > >  converted_resources ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									HashSet < Ref < Resource > >  resources_to_erase_history_for ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( Ref < Resource >  res  :  selected_resources )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Vector < Ref < EditorResourceConversionPlugin > >  conversions  =  EditorNode : : get_singleton ( ) - > find_resource_conversion_plugin_for_resource ( res ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( const  Ref < EditorResourceConversionPlugin >  & conversion  :  conversions )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											int  conversion_id  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( const  String  & target  :  cached_valid_conversion_targets )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( conversion_id  = =  selected_conversion_id  & &  conversion - > converts_to ( )  = =  target )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													Ref < Resource >  converted_res  =  conversion - > convert ( res ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ERR_FAIL_COND ( res . is_null ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													converted_resources . push_back ( converted_res ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													resources_to_erase_history_for . insert ( res ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												conversion_id + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Clear history for the objects being replaced.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( Ref < Resource >  res  :  resources_to_erase_history_for )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										undo_redo - > clear_history ( true ,  undo_redo - > get_history_id_for_object ( res . ptr ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Updates all the resources existing as node properties.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									EditorNode : : get_singleton ( ) - > replace_resources_in_scenes ( selected_resources ,  converted_resources ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Overwrite the old resources.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  converted_resources . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Ref < Resource >  original_resource  =  selected_resources . get ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Ref < Resource >  new_resource  =  converted_resources . get ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Overwrite the path.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_resource - > set_path ( original_resource - > get_path ( ) ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ResourceSaver : : save ( new_resource ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-10 12:53:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Vector < String >  FileSystemDock : : _check_existing ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < String >  conflicting_items ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-09 18:33:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( const  FileOrFolder  & item  :  to_move )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										String  old_path  =  item . path . trim_suffix ( " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										String  new_path  =  to_move_path . path_join ( old_path . get_file ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-29 18:03:11 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-09 18:33:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ( item . is_file  & &  FileAccess : : exists ( new_path ) )  | |  ( ! item . is_file  & &  DirAccess : : exists ( new_path ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-10 12:53:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											conflicting_items . push_back ( old_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-29 18:03:11 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-10 12:53:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  conflicting_items ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-29 18:03:11 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _move_operation_confirm ( const  String  & p_to_path ,  bool  p_copy ,  Overwrite  p_overwrite )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_overwrite  = =  OVERWRITE_UNDECIDED )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-29 18:03:11 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										to_move_path  =  p_to_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										to_move_or_copy  =  p_copy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-10 12:53:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Vector < String >  conflicting_items  =  _check_existing ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! conflicting_items . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Ask to do something.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-18 00:09:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											overwrite_dialog_header - > set_text ( vformat ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													TTR ( " The following files or folders conflict with items in the target location '%s': " ) ,  to_move_path ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											overwrite_dialog_file_list - > set_text ( String ( " \n " ) . join ( conflicting_items ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											overwrite_dialog_footer - > set_text ( 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													p_copy  ?  TTRC ( " Do you wish to overwrite them or rename the copied files? " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														   :  TTRC ( " Do you wish to overwrite them or rename the moved files? " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-06 14:00:16 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											overwrite_dialog - > popup_centered ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-29 18:03:11 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  new_paths ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									new_paths . resize ( to_move . size ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-19 15:54:33 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  to_move . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( p_overwrite  = =  OVERWRITE_RENAME )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											new_paths . write [ i ]  =  _get_unique_name ( to_move [ i ] ,  p_to_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-08 08:23:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											new_paths . write [ i ]  =  p_to_path . path_join ( to_move [ i ] . path . trim_suffix ( " / " ) . get_file ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-19 15:54:33 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_copy )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  to_move . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-08 08:23:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( to_move [ i ] . path  ! =  new_paths [ i ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												_try_duplicate_item ( to_move [ i ] ,  new_paths [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-14 18:18:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												select_after_scan  =  new_paths [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-19 07:43:16 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Check groups.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  to_move . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( to_move [ i ] . is_file  & &  EditorFileSystem : : get_singleton ( ) - > is_group_file ( to_move [ i ] . path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												EditorFileSystem : : get_singleton ( ) - > move_group_file ( to_move [ i ] . path ,  new_paths [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 16:32:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										HashMap < String ,  ResourceUID : : ID >  uids ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										HashSet < String >  file_owners ;  // The files that use these moved/renamed resource files.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_before_move ( uids ,  file_owners ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bool  is_moved  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										HashMap < String ,  String >  file_renames ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										HashMap < String ,  String >  folder_renames ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-04 05:36:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  to_move . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-08 08:23:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( to_move [ i ] . path  ! =  new_paths [ i ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												_try_move_item ( to_move [ i ] ,  new_paths [ i ] ,  file_renames ,  folder_renames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												is_moved  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-04 05:36:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( is_moved )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-24 12:24:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											int  current_tab  =  EditorSceneTabs : : get_singleton ( ) - > get_current_tab ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_update_resource_paths_after_move ( file_renames ,  uids ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_update_dependencies_after_move ( file_renames ,  file_owners ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-06 12:41:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_update_project_settings_after_move ( file_renames ,  folder_renames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 21:53:54 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_update_favorites_after_move ( file_renames ,  folder_renames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-16 12:30:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-24 12:24:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorSceneTabs : : get_singleton ( ) - > set_current_tab ( current_tab ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											print_verbose ( " FileSystem: calling rescan. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_rescan ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											current_path  =  p_to_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											current_path_line_edit - > set_text ( current_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-19 07:43:16 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _before_move ( HashMap < String ,  ResourceUID : : ID >  & r_uids ,  HashSet < String >  & r_file_owners )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									HashSet < String >  renamed_files ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  to_move . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( to_move [ i ] . is_file )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											renamed_files . insert ( to_move [ i ] . path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ResourceUID : : ID  uid  =  ResourceLoader : : get_resource_uid ( to_move [ i ] . path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( uid  ! =  ResourceUID : : INVALID_ID )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												r_uids [ to_move [ i ] . path ]  =  uid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											EditorFileSystemDirectory  * current_folder  =  EditorFileSystem : : get_singleton ( ) - > get_filesystem_path ( to_move [ i ] . path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											List < EditorFileSystemDirectory  * >  folders ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											folders . push_back ( current_folder ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											while  ( folders . front ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												current_folder  =  folders . front ( ) - > get ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( int  j  =  0 ;  j  <  current_folder - > get_file_count ( ) ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													const  String  file_path  =  current_folder - > get_file_path ( j ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 16:16:38 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													renamed_files . insert ( file_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													ResourceUID : : ID  uid  =  ResourceLoader : : get_resource_uid ( file_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( uid  ! =  ResourceUID : : INVALID_ID )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														r_uids [ file_path ]  =  uid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( int  j  =  0 ;  j  <  current_folder - > get_subdir_count ( ) ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													folders . push_back ( current_folder - > get_subdir ( j ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												folders . pop_front ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Look for files that use these moved/renamed resource files.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_find_file_owners ( EditorFileSystem : : get_singleton ( ) - > get_filesystem ( ) ,  renamed_files ,  r_file_owners ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Open scenes with dependencies on the ones about to be moved will be reloaded,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// so save them first to prevent losing unsaved changes.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorNode : : get_singleton ( ) - > save_scene_list ( r_file_owners ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-14 19:35:19 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-21 21:46:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Vector < String >  FileSystemDock : : _tree_get_selected ( bool  remove_self_inclusion ,  bool  p_include_unselected_cursor )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Build a list of selected items with the active one at the first position.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  selected_strings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-21 13:55:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									TreeItem  * cursor_item  =  tree - > get_selected ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-21 21:46:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( cursor_item  & &  ( p_include_unselected_cursor  | |  cursor_item - > is_selected ( 0 ) )  & &  cursor_item  ! =  favorites_item )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-21 13:55:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										selected_strings . push_back ( cursor_item - > get_metadata ( 0 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									TreeItem  * selected  =  tree - > get_root ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									selected  =  tree - > get_next_selected ( selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									while  ( selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-11 16:20:31 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( selected  ! =  cursor_item  & &  selected  ! =  favorites_item  & &  selected - > is_visible_in_tree ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											selected_strings . push_back ( selected - > get_metadata ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										selected  =  tree - > get_next_selected ( selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-10 01:15:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( remove_self_inclusion )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										selected_strings  =  _remove_self_included_paths ( selected_strings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  selected_strings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-07-24 20:01:11 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Vector < String >  FileSystemDock : : _file_list_get_selected ( )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < String >  selected ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( int  idx  :  files - > get_selected_items ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										selected . push_back ( files - > get_item_metadata ( idx ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  selected ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-10 01:15:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Vector < String >  FileSystemDock : : _remove_self_included_paths ( Vector < String >  selected_strings )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Remove paths or files that are included into another.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-10 01:15:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( selected_strings . size ( )  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-02 16:50:23 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										selected_strings . sort_custom < FileNoCaseComparator > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  last_path  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  selected_strings . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! last_path . is_empty ( )  & &  selected_strings [ i ] . begins_with ( last_path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 16:17:03 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												selected_strings . remove_at ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												i - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( selected_strings [ i ] . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												last_path  =  selected_strings [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  selected_strings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _tree_rmb_option ( int  p_option )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-10 01:15:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  selected_strings  =  _tree_get_selected ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Execute the current option.
 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									switch  ( p_option )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FOLDER_EXPAND_ALL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  FOLDER_COLLAPSE_ALL :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Expand or collapse the folder
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( selected_strings . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-01 15:43:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												tree - > get_selected ( ) - > set_collapsed_recursive ( p_option  = =  FOLDER_COLLAPSE_ALL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-28 11:34:46 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-21 21:46:39 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_RENAME :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											selected_strings  =  _tree_get_selected ( false ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											[[fallthrough]] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_file_option ( p_option ,  selected_strings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-28 11:34:46 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_list_rmb_option ( int  p_option )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < int >  selected_id  =  files - > get_selected_items ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < String >  selected ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  selected_id . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										selected . push_back ( files - > get_item_metadata ( selected_id [ i ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_file_option ( p_option ,  selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _generic_rmb_option_selected ( int  p_option )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Used for submenu commands where we don't know whether we're
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// calling from the file_list_rmb menu or the _tree_rmb option.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( files - > has_focus ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_file_list_rmb_option ( p_option ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_tree_rmb_option ( p_option ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-10 11:54:12 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_option ( int  p_option ,  const  Vector < String >  & p_selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// The first one should be the active item.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch  ( p_option )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  FILE_SHOW_IN_EXPLORER :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Show the file/folder in the OS explorer.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  fpath  =  current_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( current_path  = =  " Favorites " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-06 22:49:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												fpath  =  p_selected [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  dir  =  ProjectSettings : : get_singleton ( ) - > globalize_path ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-07 11:33:35 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											OS : : get_singleton ( ) - > shell_show_in_file_manager ( dir ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-09 14:59:48 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-10 22:26:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_OPEN_EXTERNAL :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  fpath  =  current_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( current_path  = =  " Favorites " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-10 22:26:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												fpath  =  p_selected [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-19 00:19:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											const  String  file  =  ProjectSettings : : get_singleton ( ) - > globalize_path ( fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											const  String  extension  =  file . get_extension ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-10 22:26:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-19 00:19:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											const  String  resource_type  =  ResourceLoader : : get_resource_type ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-10 22:26:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  external_program ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-19 00:19:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ClassDB : : is_parent_class ( resource_type ,  " Script " )  | |  extension  = =  " tres "  | |  extension  = =  " tscn " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												external_program  =  EDITOR_GET ( " text_editor/external/exec_path " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( extension  = =  " res "  | |  extension  = =  " scn " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// Binary resources have no meaningful editor outside Godot, so just fallback to something default.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( resource_type  = =  " CompressedTexture2D "  | |  resource_type  = =  " Image " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( extension  = =  " svg "  | |  extension  = =  " svgz " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-10 22:26:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													external_program  =  EDITOR_GET ( " filesystem/external_programs/vector_image_editor " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													external_program  =  EDITOR_GET ( " filesystem/external_programs/raster_image_editor " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( ClassDB : : is_parent_class ( resource_type ,  " AudioStream " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												external_program  =  EDITOR_GET ( " filesystem/external_programs/audio_editor " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( resource_type  = =  " PackedScene " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-19 00:19:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												external_program  =  EDITOR_GET ( " filesystem/external_programs/3d_model_editor " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-10 22:26:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( external_program . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												OS : : get_singleton ( ) - > shell_open ( file ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												List < String >  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												args . push_back ( file ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												OS : : get_singleton ( ) - > create_process ( external_program ,  args ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_OPEN_IN_TERMINAL :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											String  fpath  =  current_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( current_path  = =  " Favorites " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fpath  =  p_selected [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Vector < String >  terminal_emulators ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											const  String  terminal_emulator_setting  =  EDITOR_GET ( " filesystem/external_programs/terminal_emulator " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( terminal_emulator_setting . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// Figure out a default terminal emulator to use.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# if defined(WINDOWS_ENABLED) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// Default to PowerShell as done by Windows 10 and later.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( " powershell " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# elif defined(MACOS_ENABLED) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( " /System/Applications/Utilities/Terminal.app " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# elif defined(LINUXBSD_ENABLED) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// Try terminal emulators that ship with common Linux distributions first.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( " gnome-terminal " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( " konsole " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( " xfce4-terminal " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( " lxterminal " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( " kitty " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( " alacritty " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( " urxvt " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( " xterm " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// Use the user-specified terminal.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulators . push_back ( terminal_emulator_setting ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-10 10:25:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  flags  =  EDITOR_GET ( " filesystem/external_programs/terminal_emulator_flags " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											String  arguments  =  flags ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( arguments . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// NOTE: This default value is ignored further below if the terminal executable is `powershell` or `cmd`,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// due to these terminals requiring nonstandard syntax to start in a specified folder.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												arguments  =  " {directory} " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef LINUXBSD_ENABLED 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											String  chosen_terminal_emulator ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( const  String  & terminal_emulator  :  terminal_emulators )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-10 10:25:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												String  pipe ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												List < String >  test_args ;  // Required for `execute()`, as it doesn't accept `Vector<String>`.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-10 10:25:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												test_args . push_back ( " -cr " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												test_args . push_back ( " command -v  "  +  terminal_emulator ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												const  Error  err  =  OS : : get_singleton ( ) - > execute ( " bash " ,  test_args ,  & pipe ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// Check if a path to the terminal executable exists.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-05 17:56:08 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( err  = =  OK  & &  pipe . contains_char ( ' / ' ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													chosen_terminal_emulator  =  terminal_emulator ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  if  ( err  = =  ERR_CANT_FORK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ERR_PRINT_ED ( vformat ( TTR ( " Couldn't run external program to check for terminal emulator presence: command -v %s " ) ,  terminal_emulator ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# else 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// On Windows and macOS, the first (and only) terminal emulator in the list is always available.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											String  chosen_terminal_emulator  =  terminal_emulators [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											List < String >  terminal_emulator_args ;  // Required for `execute()`, as it doesn't accept `Vector<String>`.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef LINUXBSD_ENABLED 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Prepend default arguments based on the terminal emulator name.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Use `String.ends_with()` so that installations in non-default paths
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// or `/usr/local/bin` are detected correctly.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-10 10:25:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( flags . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( chosen_terminal_emulator . ends_with ( " konsole " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													terminal_emulator_args . push_back ( " --workdir " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  if  ( chosen_terminal_emulator . ends_with ( " gnome-terminal " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													terminal_emulator_args . push_back ( " --working-directory " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  if  ( chosen_terminal_emulator . ends_with ( " urxvt " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													terminal_emulator_args . push_back ( " -cd " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-23 20:41:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												}  else  if  ( chosen_terminal_emulator . ends_with ( " xfce4-terminal " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													terminal_emulator_args . push_back ( " --working-directory " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-10 10:25:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											bool  append_default_args  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef WINDOWS_ENABLED 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Prepend default arguments based on the terminal emulator name.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Use `String.get_basename().to_lower()` to handle Windows' case-insensitive paths
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// with optional file extensions for executables in `PATH`.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( chosen_terminal_emulator . get_basename ( ) . to_lower ( )  = =  " powershell " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulator_args . push_back ( " -noexit " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulator_args . push_back ( " -command " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulator_args . push_back ( " cd '{directory}' " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												append_default_args  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( chosen_terminal_emulator . get_basename ( ) . to_lower ( )  = =  " cmd " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulator_args . push_back ( " /K " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulator_args . push_back ( " cd /d {directory} " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												append_default_args  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Vector < String >  arguments_array  =  arguments . split ( "   " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( const  String  & argument  :  arguments_array )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! append_default_args  & &  argument  = =  " {directory} " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													// Prevent appending a `{directory}` placeholder twice when using powershell or cmd.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													// This allows users to enter the path to cmd or PowerShell in the custom terminal emulator path,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													// and make it work without having to enter custom arguments.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												terminal_emulator_args . push_back ( argument ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											const  bool  is_directory  =  fpath . ends_with ( " / " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-15 15:18:34 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											for  ( String  & terminal_emulator_arg  :  terminal_emulator_args )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( is_directory )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-15 15:18:34 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													terminal_emulator_arg  =  terminal_emulator_arg . replace ( " {directory} " ,  ProjectSettings : : get_singleton ( ) - > globalize_path ( fpath ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-15 15:18:34 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													terminal_emulator_arg  =  terminal_emulator_arg . replace ( " {directory} " ,  ProjectSettings : : get_singleton ( ) - > globalize_path ( fpath ) . get_base_dir ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( OS : : get_singleton ( ) - > is_stdout_verbose ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// Print full command line to help with troubleshooting.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												String  command_string  =  chosen_terminal_emulator ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( const  String  & arg  :  terminal_emulator_args )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													command_string  + =  "   "  +  arg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												print_line ( " Opening terminal emulator: " ,  command_string ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											const  Error  err  =  OS : : get_singleton ( ) - > create_process ( chosen_terminal_emulator ,  terminal_emulator_args ,  nullptr ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( err  ! =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												String  args_string ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-15 15:18:34 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												for  ( const  String  & terminal_emulator_arg  :  terminal_emulator_args )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													args_string  + =  terminal_emulator_arg ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ERR_PRINT_ED ( vformat ( TTR ( " Couldn't run external terminal program (error code %d): %s %s \n Check `filesystem/external_programs/terminal_emulator` and `filesystem/external_programs/terminal_emulator_flags` in the Editor Settings. " ) ,  err ,  chosen_terminal_emulator ,  args_string ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_OPEN :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Open folders.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-10 17:50:43 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											TreeItem  * selected  =  tree - > get_root ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											selected  =  tree - > get_next_selected ( selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											while  ( selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-06 16:20:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( p_selected . has ( selected - > get_metadata ( 0 ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-10 17:50:43 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													selected - > set_collapsed ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												selected  =  tree - > get_next_selected ( selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Open the file.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											for  ( int  i  =  0 ;  i  <  p_selected . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												_select_file ( p_selected [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 16:01:50 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-07 23:35:23 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_INHERIT :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Create a new scene inherited from the selected one.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-07 23:35:23 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( p_selected . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												emit_signal ( SNAME ( " inherit " ) ,  p_selected [ 0 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-07 23:35:23 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-30 03:24:38 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_MAIN_SCENE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Set as main scene with selected scene file.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( p_selected . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-14 20:01:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ProjectSettings : : get_singleton ( ) - > set ( " application/run/main_scene " ,  ResourceUID : : path_to_uid ( p_selected [ 0 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-30 03:24:38 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ProjectSettings : : get_singleton ( ) - > save ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												_update_tree ( get_uncollapsed_paths ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-09 09:51:31 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												_update_file_list ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-30 03:24:38 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 00:13:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_INSTANTIATE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Instantiate all selected scenes.
 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-20 14:09:03 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Vector < String >  paths ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											for  ( int  i  =  0 ;  i  <  p_selected . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												const  String  & fpath  =  p_selected [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( EditorFileSystem : : get_singleton ( ) - > get_file_type ( fpath )  = =  " PackedScene " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													paths . push_back ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! paths . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 00:13:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												emit_signal ( SNAME ( " instantiate " ) ,  paths ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-20 14:09:03 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_ADD_FAVORITE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Add the files from favorites.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Vector < String >  favorites_list  =  EditorSettings : : get_singleton ( ) - > get_favorites ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											for  ( int  i  =  0 ;  i  <  p_selected . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( ! favorites_list . has ( p_selected [ i ] ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													favorites_list . push_back ( p_selected [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorSettings : : get_singleton ( ) - > set_favorites ( favorites_list ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_update_tree ( get_uncollapsed_paths ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  FILE_REMOVE_FAVORITE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Remove the files from favorites.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Vector < String >  favorites_list  =  EditorSettings : : get_singleton ( ) - > get_favorites ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											for  ( int  i  =  0 ;  i  <  p_selected . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												favorites_list . erase ( p_selected [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorSettings : : get_singleton ( ) - > set_favorites ( favorites_list ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_update_tree ( get_uncollapsed_paths ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( current_path  = =  " Favorites " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												_update_file_list ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-25 14:43:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_SHOW_IN_FILESYSTEM :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! p_selected . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												navigate_to_path ( p_selected [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_DEPENDENCIES :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Checkout the file dependencies.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! p_selected . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												const  String  & fpath  =  p_selected [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												deps_editor - > edit ( fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_OWNERS :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Checkout the file owners.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! p_selected . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												const  String  & fpath  =  p_selected [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												owners_editor - > show ( fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_MOVE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Move or copy the files to a given location.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											to_move . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-10 01:15:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Vector < String >  collapsed_paths  =  _remove_self_included_paths ( p_selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( int  i  =  collapsed_paths . size ( )  -  1 ;  i  > =  0 ;  i - - )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												const  String  & fpath  =  collapsed_paths [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( fpath  ! =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													to_move . push_back ( FileOrFolder ( fpath ,  ! fpath . ends_with ( " / " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( to_move . size ( )  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-24 13:59:32 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												move_dialog - > config ( p_selected ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												move_dialog - > popup_centered_ratio ( 0.4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_RENAME :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! p_selected . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// Set to_rename variable for callback execution.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												to_rename . path  =  p_selected [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												to_rename . is_file  =  ! to_rename . path . ends_with ( " / " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( to_rename . path  = =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-16 15:17:05 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// Rename has same logic as move for resource files.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												to_move . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												to_move . push_back ( to_rename ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( tree - > has_focus ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													// Edit node in Tree.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													tree - > edit_selected ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( to_rename . is_file )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														String  name  =  to_rename . path . get_file ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-16 18:52:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														tree - > set_editor_selection ( 0 ,  name . rfind_char ( ' . ' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														String  name  =  to_rename . path . left ( - 1 ) . get_file ( ) ;  // Removes the "/" suffix for folders.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														tree - > set_editor_selection ( 0 ,  name . length ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  if  ( files - > has_focus ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													files - > edit_selected ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_REMOVE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Remove the selected files.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 23:24:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Vector < String >  remove_files ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Vector < String >  remove_folders ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-10 01:15:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Vector < String >  collapsed_paths  =  _remove_self_included_paths ( p_selected ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-10 01:15:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											for  ( int  i  =  0 ;  i  <  collapsed_paths . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												const  String  & fpath  =  collapsed_paths [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( fpath  ! =  " res:// " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( fpath . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														remove_folders . push_back ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 23:24:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														remove_files . push_back ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 23:24:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 23:24:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( remove_files . size ( )  +  remove_folders . size ( )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												remove_dialog - > show ( remove_folders ,  remove_files ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 14:13:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_DUPLICATE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-10 08:12:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( p_selected . size ( )  ! =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											to_duplicate . path  =  p_selected [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											to_duplicate . is_file  =  ! to_duplicate . path . ends_with ( " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( to_duplicate . is_file )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												String  name  =  to_duplicate . path . get_file ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												make_dir_dialog - > config ( to_duplicate . path . get_base_dir ( ) ,  callable_mp ( this ,  & FileSystemDock : : _duplicate_operation_confirm ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														DirectoryCreateDialog : : MODE_FILE ,  TTR ( " Duplicating file: " )  +  "   "  +  name ,  name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												String  name  =  to_duplicate . path . trim_suffix ( " / " ) . get_file ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												make_dir_dialog - > config ( to_duplicate . path . trim_suffix ( " / " ) . get_base_dir ( ) ,  callable_mp ( this ,  & FileSystemDock : : _duplicate_operation_confirm ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														DirectoryCreateDialog : : MODE_DIRECTORY ,  TTR ( " Duplicating folder: " )  +  "   "  +  name ,  name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 14:13:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-10 08:12:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											make_dir_dialog - > popup_centered ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 14:13:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  FILE_REIMPORT :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-20 14:47:41 +07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ImportDock : : get_singleton ( ) - > reimport_resources ( p_selected ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-27 14:18:40 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 23:33:43 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_NEW_FOLDER :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  directory  =  current_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 18:15:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! directory . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												directory  =  directory . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-10 08:12:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											make_dir_dialog - > config ( directory ,  callable_mp ( this ,  & FileSystemDock : : create_directory ) . bind ( directory ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													DirectoryCreateDialog : : MODE_DIRECTORY ,  TTR ( " Create Folder " ) ,  " new folder " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 18:15:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											make_dir_dialog - > popup_centered ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 23:33:43 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 19:47:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_NEW_SCENE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  directory  =  current_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-12 02:11:52 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! directory . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												directory  =  directory . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											make_scene_dialog - > config ( directory ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											make_scene_dialog - > popup_centered ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 19:47:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-25 00:18:10 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_NEW_SCRIPT :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  fpath  =  current_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! fpath . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fpath  =  fpath . get_base_dir ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-25 00:18:10 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 19:34:01 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											make_script_dialog - > config ( " Node " ,  fpath . path_join ( " new_script.gd " ) ,  false ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-08 01:15:05 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											make_script_dialog - > popup_centered ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-25 00:18:10 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-09 14:59:48 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_COPY_PATH :  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! p_selected . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												const  String  & fpath  =  p_selected [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-03 10:36:29 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												DisplayServer : : get_singleton ( ) - > clipboard_set ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-09 14:59:48 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-09 09:38:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_COPY_ABSOLUTE_PATH :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! p_selected . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												const  String  & fpath  =  p_selected [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												const  String  absolute_path  =  ProjectSettings : : get_singleton ( ) - > globalize_path ( fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												DisplayServer : : get_singleton ( ) - > clipboard_set ( absolute_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-02 11:51:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_COPY_UID :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! p_selected . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ResourceUID : : ID  uid  =  ResourceLoader : : get_resource_uid ( p_selected [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( uid  ! =  ResourceUID : : INVALID_ID )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													String  uid_string  =  ResourceUID : : get_singleton ( ) - > id_to_text ( uid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													DisplayServer : : get_singleton ( ) - > clipboard_set ( uid_string ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-22 21:23:40 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_NEW_RESOURCE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											new_resource_dialog - > popup_create ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 22:09:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  FILE_NEW_TEXTFILE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  fpath  =  current_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 22:09:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! fpath . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fpath  =  fpath . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-14 16:43:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  dir  =  ProjectSettings : : get_singleton ( ) - > globalize_path ( fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ScriptEditor : : get_singleton ( ) - > open_text_file_create_dialog ( dir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 22:09:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-03 23:07:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										default :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-19 15:33:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( p_option  > =  EditorContextMenuPlugin : : BASE_ID )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! EditorContextMenuPluginManager : : get_singleton ( ) - > activate_custom_option ( EditorContextMenuPlugin : : CONTEXT_SLOT_FILESYSTEM ,  p_option ,  p_selected ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													EditorContextMenuPluginManager : : get_singleton ( ) - > activate_custom_option ( EditorContextMenuPlugin : : CONTEXT_SLOT_FILESYSTEM_CREATE ,  p_option ,  p_selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( p_option  > =  CONVERT_BASE_ID )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												selected_conversion_id  =  p_option  -  CONVERT_BASE_ID ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ERR_FAIL_INDEX ( selected_conversion_id ,  ( int ) cached_valid_conversion_targets . size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												to_convert . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( const  String  & S  :  p_selected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													to_convert . push_back ( S ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  conversion_id  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( const  String  & E  :  cached_valid_conversion_targets )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( conversion_id  = =  selected_conversion_id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														conversion_dialog - > set_text ( vformat ( TTR ( " Do you wish to convert these files to %s? (This operation cannot be undone!) " ) ,  E ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														conversion_dialog - > popup_centered ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													conversion_id + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-03 23:07:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-03 23:07:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 17:44:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _resource_created ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  fpath  =  current_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-03 17:45:32 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! fpath . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fpath  =  fpath . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									String  type_name  =  new_resource_dialog - > get_selected_type ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( type_name  = =  " Shader " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 19:34:01 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										make_shader_dialog - > config ( fpath . path_join ( " new_shader " ) ,  false ,  false ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-03 17:45:32 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										make_shader_dialog - > popup_centered ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( type_name  = =  " VisualShader " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 19:34:01 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										make_shader_dialog - > config ( fpath . path_join ( " new_shader " ) ,  false ,  false ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-03 17:45:32 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										make_shader_dialog - > popup_centered ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-08 13:39:16 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  if  ( type_name  = =  " ShaderInclude " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 19:34:01 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										make_shader_dialog - > config ( fpath . path_join ( " new_shader_include " ) ,  false ,  false ,  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-08 13:39:16 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										make_shader_dialog - > popup_centered ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-03 17:45:32 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 00:13:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Variant  c  =  new_resource_dialog - > instantiate_selected ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-22 21:23:40 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ERR_FAIL_COND ( ! c ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Resource  * r  =  Object : : cast_to < Resource > ( c ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ERR_FAIL_NULL ( r ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-22 21:23:40 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-09 14:21:10 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PackedScene  * scene  =  Object : : cast_to < PackedScene > ( r ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( scene )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Node  * node  =  memnew ( Node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										node - > set_name ( " Node " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										scene - > pack ( node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										memdelete ( node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-27 10:36:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorNode : : get_singleton ( ) - > push_item ( r ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorNode : : get_singleton ( ) - > save_resource_as ( Ref < Resource > ( r ) ,  fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-10 13:19:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _search_changed ( const  String  & p_text ,  const  Control  * p_from )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 02:22:16 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( searched_tokens . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Register the uncollapsed paths before they change.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										uncollapsed_paths_before_search  =  get_uncollapsed_paths ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 23:28:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 02:22:16 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  String  searched_string  =  p_text . to_lower ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									searched_tokens  =  searched_string . split ( "   " ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_from  = =  tree_search_box )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										file_list_search_box - > set_text ( searched_string ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  {  // File_list_search_box.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										tree_search_box - > set_text ( searched_string ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-08-03 22:05:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_update_filtered_items ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( display_mode  = =  DISPLAY_MODE_HSPLIT  | |  display_mode  = =  DISPLAY_MODE_VSPLIT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_update_file_list ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( searched_tokens . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_navigate_to_path ( current_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 02:22:16 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  FileSystemDock : : _matches_all_search_tokens ( const  String  & p_text )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( searched_tokens . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  String  s  =  p_text . to_lower ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( const  String  & t  :  searched_tokens )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! s . contains ( t ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _rescan ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-07 00:26:02 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( tree - > has_focus ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										had_focus  =  tree ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( files - > has_focus ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										had_focus  =  files ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-06-11 11:46:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_set_scanning_mode ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									EditorFileSystem : : get_singleton ( ) - > scan ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _change_bottom_dock_placement ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									EditorDockManager : : get_singleton ( ) - > bottom_dock_show_placement_popup ( button_dock_placement - > get_screen_rect ( ) ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _change_split_mode ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									DisplayMode  next_mode  =  DISPLAY_MODE_TREE_ONLY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( display_mode  = =  DISPLAY_MODE_VSPLIT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										next_mode  =  DISPLAY_MODE_HSPLIT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( display_mode  = =  DISPLAY_MODE_TREE_ONLY )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										next_mode  =  DISPLAY_MODE_VSPLIT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									set_display_mode ( next_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									emit_signal ( SNAME ( " display_mode_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-14 00:16:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-23 21:01:01 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _split_dragged ( int  p_offset )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( split_box - > is_vertical ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										split_box_offset_v  =  p_offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										split_box_offset_h  =  p_offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : fix_dependencies ( const  String  & p_for_file )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									deps_editor - > edit ( p_for_file ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-16 15:52:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : update_all ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( tree - > is_visible ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-03 16:29:00 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_update_tree ( get_uncollapsed_paths ( ) ,  false ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-16 15:52:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( file_list_vb - > is_visible ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_update_file_list ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-30 20:11:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : focus_on_path ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									current_path_line_edit - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									current_path_line_edit - > select_all ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : focus_on_filter ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 19:22:50 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									LineEdit  * current_search_box  =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( display_mode  = =  DISPLAY_MODE_TREE_ONLY )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										current_search_box  =  tree_search_box ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 19:22:50 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										current_search_box  =  file_list_search_box ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( current_search_box )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										current_search_box - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										current_search_box - > select_all ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-10 08:12:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : create_directory ( const  String  & p_path ,  const  String  & p_base_dir )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-12 05:22:01 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  trimmed_path  =  p_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! p_base_dir . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Trims off the joining '/' if the base didn't end with one. If the base did have it
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// and there's two slashes, the empty directory is safe to trim off anyways.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										trimmed_path  =  trimmed_path . trim_prefix ( p_base_dir ) . trim_prefix ( " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Error  err  =  EditorFileSystem : : get_singleton ( ) - > make_dir_recursive ( trimmed_path ,  p_base_dir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-10 08:12:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( err  ! =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( vformat ( TTR ( " Could not create folder: %s " ) ,  error_names [ err ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 19:46:31 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								ScriptCreateDialog  * FileSystemDock : : get_script_create_dialog ( )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  make_script_dialog ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-25 23:39:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : set_file_list_display_mode ( FileListDisplayMode  p_mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_mode  = =  file_list_display_mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-16 13:25:42 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-15 13:39:13 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-05 03:55:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_toggle_file_display ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-15 13:39:13 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : add_resource_tooltip_plugin ( const  Ref < EditorResourceTooltipPlugin >  & p_plugin )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tooltip_plugins . push_back ( p_plugin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : remove_resource_tooltip_plugin ( const  Ref < EditorResourceTooltipPlugin >  & p_plugin )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  index  =  tooltip_plugins . find ( p_plugin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ERR_FAIL_COND_MSG ( index  = =  - 1 ,  " Can't remove plugin that wasn't registered. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tooltip_plugins . remove_at ( index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-11-20 04:28:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								String  FileSystemDock : : get_folder_path_at_mouse_position ( )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									TreeItem  * item  =  tree - > get_item_at_position ( tree - > get_local_mouse_position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  String ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									String  fpath  =  item - > get_metadata ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  fpath . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Control  * FileSystemDock : : create_tooltip_for_path ( const  String  & p_path )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-24 14:22:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_path  = =  " Favorites " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// No tooltip for the "Favorites" group.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( DirAccess : : exists ( p_path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// No tooltip for directory.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-17 11:37:52 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ERR_FAIL_COND_V ( ! FileAccess : : exists ( p_path ) ,  nullptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  String  type  =  ResourceLoader : : get_resource_type ( p_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-18 17:03:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Control  * tooltip  =  EditorResourceTooltipPlugin : : make_default_tooltip ( p_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( const  Ref < EditorResourceTooltipPlugin >  & plugin  :  tooltip_plugins )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( plugin - > handles ( type ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-18 17:03:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											tooltip  =  plugin - > make_tooltip_for_path ( p_path ,  EditorResourcePreview : : get_singleton ( ) - > get_preview_metadata ( p_path ) ,  tooltip ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  tooltip ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								Variant  FileSystemDock : : get_drag_data_fw ( const  Point2  & p_point ,  Control  * p_from )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bool  all_favorites  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  all_not_favorites  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 23:09:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  paths ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_from  = =  tree )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Check if the first selected is in favorite.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										TreeItem  * selected  =  tree - > get_next_selected ( tree - > get_root ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										while  ( selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( selected  = =  favorites_item )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												// The "Favorites" item is not draggable.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												return  Variant ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-07 21:07:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											bool  is_favorite  =  selected - > get_parent ( )  ! =  nullptr  & &  tree - > get_root ( ) - > get_first_child ( )  = =  selected - > get_parent ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											all_favorites  & =  is_favorite ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											all_not_favorites  & =  ! is_favorite ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											selected  =  tree - > get_next_selected ( selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-20 19:39:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! all_not_favorites )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											paths  =  _tree_get_selected ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											paths  =  _tree_get_selected ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 23:09:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  if  ( p_from  = =  files )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  files - > get_item_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( files - > is_selected ( i ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 23:09:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												paths . push_back ( files - > get_item_metadata ( i ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										all_favorites  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										all_not_favorites  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 23:09:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( paths . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 23:09:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  Variant ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 23:09:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Dictionary  drag_data  =  EditorNode : : get_singleton ( ) - > drag_files_and_dirs ( paths ,  p_from ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-20 19:39:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! all_not_favorites )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										drag_data [ " favorite " ]  =  all_favorites  ?  " all "  :  " mixed " ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 23:09:04 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  drag_data ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  FileSystemDock : : can_drop_data_fw ( const  Point2  & p_point ,  const  Variant  & p_data ,  Control  * p_from )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Dictionary  drag_data  =  p_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-20 19:39:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( drag_data . has ( " favorite " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( String ( drag_data [ " favorite " ] )  ! =  " all " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Moving favorite around.
 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-10 11:21:05 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										TreeItem  * ti  =  ( p_point  = =  Vector2 ( Math : : INF ,  Math : : INF ) )  ?  tree - > get_selected ( )  :  tree - > get_item_at_position ( p_point ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! ti )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-04-10 11:21:05 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										int  drop_section  =  ( p_point  = =  Vector2 ( Math : : INF ,  Math : : INF ) )  ?  tree - > get_drop_section_at_position ( tree - > get_item_rect ( ti ) . position )  :  tree - > get_drop_section_at_position ( p_point ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ti  = =  favorites_item )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return  ( drop_section  = =  1 ) ;  // The parent, first fav.
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ti - > get_parent ( )  & &  favorites_item  = =  ti - > get_parent ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  true ;  // A favorite
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ti  = =  resources_item )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return  ( drop_section  = =  - 1 ) ;  // The tree, last fav.
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( drag_data . has ( " type " )  & &  String ( drag_data [ " type " ] )  = =  " resource " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Move resources.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  to_dir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										bool  favorite ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_get_drag_target_folder ( to_dir ,  favorite ,  p_point ,  p_from ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  ! favorite ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( drag_data . has ( " type " )  & &  ( String ( drag_data [ " type " ] )  = =  " files "  | |  String ( drag_data [ " type " ] )  = =  " files_and_dirs " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Move files or dir.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  to_dir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										bool  favorite ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_get_drag_target_folder ( to_dir ,  favorite ,  p_point ,  p_from ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( favorite )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( to_dir . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 15:27:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Attempting to move a folder into itself will fail later,
 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-04 19:20:01 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// rather than bring up a message don't try to do it in the first place.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 15:27:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										to_dir  =  to_dir . ends_with ( " / " )  ?  to_dir  :  ( to_dir  +  " / " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Vector < String >  fnames  =  drag_data [ " files " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 15:27:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  fnames . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( fnames [ i ] . ends_with ( " / " )  & &  to_dir . begins_with ( fnames [ i ] ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 15:27:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-09 00:43:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( drag_data . has ( " type " )  & &  String ( drag_data [ " type " ] )  = =  " nodes " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Save branch as scene.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										String  to_dir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										bool  favorite ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_get_drag_target_folder ( to_dir ,  favorite ,  p_point ,  p_from ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  ! favorite  & &  Array ( drag_data [ " nodes " ] ) . size ( )  = =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : drop_data_fw ( const  Point2  & p_point ,  const  Variant  & p_data ,  Control  * p_from )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! can_drop_data_fw ( p_point ,  p_data ,  p_from ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Dictionary  drag_data  =  p_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-18 14:02:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  dirs  =  EditorSettings : : get_singleton ( ) - > get_favorites ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-20 19:39:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( drag_data . has ( " favorite " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( String ( drag_data [ " favorite " ] )  ! =  " all " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Moving favorite around.
 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-10 11:21:05 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										TreeItem  * ti  =  ( p_point  = =  Vector2 ( Math : : INF ,  Math : : INF ) )  ?  tree - > get_selected ( )  :  tree - > get_item_at_position ( p_point ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! ti )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-10 11:21:05 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										int  drop_section  =  ( p_point  = =  Vector2 ( Math : : INF ,  Math : : INF ) )  ?  tree - > get_drop_section_at_position ( tree - > get_item_rect ( ti ) . position )  :  tree - > get_drop_section_at_position ( p_point ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										int  drop_position ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Vector < String >  drag_files  =  drag_data [ " files " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ti  = =  favorites_item )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Drop on the favorite folder.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											drop_position  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( ti  = =  resources_item )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Drop on the resource item.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											drop_position  =  dirs . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Drop in the list.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											drop_position  =  dirs . find ( ti - > get_metadata ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( drop_section  = =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												drop_position + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Remove dragged favorites.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Vector < int >  to_remove ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  offset  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  drag_files . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											int  to_remove_pos  =  dirs . find ( drag_files [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											to_remove . push_back ( to_remove_pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-14 13:59:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( to_remove_pos  <  drop_position )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												offset + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										drop_position  - =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										to_remove . sort ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  to_remove . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-03 16:17:03 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											dirs . remove_at ( to_remove [ i ]  -  i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Re-add them at the right position.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  drag_files . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											dirs . insert ( drop_position ,  drag_files [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											drop_position + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-18 14:02:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorSettings : : get_singleton ( ) - > set_favorites ( dirs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_update_tree ( get_uncollapsed_paths ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( display_mode  ! =  DISPLAY_MODE_TREE_ONLY  & &  current_path  = =  " Favorites " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 00:11:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_update_file_list ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( drag_data . has ( " type " )  & &  String ( drag_data [ " type " ] )  = =  " resource " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Moving resource.
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Ref < Resource >  res  =  drag_data [ " resource " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  to_dir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										bool  favorite ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										tree - > set_drop_mode_flags ( Tree : : DROP_MODE_ON_ITEM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_get_drag_target_folder ( to_dir ,  favorite ,  p_point ,  p_from ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( to_dir . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											to_dir  =  get_current_directory ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( res . is_valid ( )  & &  ! to_dir . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 15:40:33 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorNode : : get_singleton ( ) - > push_item ( res . ptr ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											EditorNode : : get_singleton ( ) - > save_resource_as ( res ,  to_dir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( drag_data . has ( " type " )  & &  ( String ( drag_data [ " type " ] )  = =  " files "  | |  String ( drag_data [ " type " ] )  = =  " files_and_dirs " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Move files or add to favorites.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  to_dir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										bool  favorite ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_get_drag_target_folder ( to_dir ,  favorite ,  p_point ,  p_from ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! to_dir . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Vector < String >  fnames  =  drag_data [ " files " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 22:59:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											to_move . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-01 19:21:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											String  target_dir  =  to_dir  = =  " res:// "  ?  to_dir  :  to_dir . trim_suffix ( " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											for  ( int  i  =  0 ;  i  <  fnames . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-01 19:21:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( fnames [ i ] . trim_suffix ( " / " ) . get_base_dir ( )  ! =  target_dir )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-04 19:20:01 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													to_move . push_back ( FileOrFolder ( fnames [ i ] ,  ! fnames [ i ] . ends_with ( " / " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! to_move . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-08 23:24:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( Input : : get_singleton ( ) - > is_key_pressed ( Key : : CMD_OR_CTRL ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-25 20:58:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													_move_operation_confirm ( to_dir ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-05 01:53:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													_move_operation_confirm ( to_dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( favorite )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-04 19:20:01 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Add the files from favorites.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Vector < String >  fnames  =  drag_data [ " files " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Vector < String >  favorites_list  =  EditorSettings : : get_singleton ( ) - > get_favorites ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											for  ( int  i  =  0 ;  i  <  fnames . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( ! favorites_list . has ( fnames [ i ] ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													favorites_list . push_back ( fnames [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											EditorSettings : : get_singleton ( ) - > set_favorites ( favorites_list ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_update_tree ( get_uncollapsed_paths ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-09 00:43:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( drag_data . has ( " type " )  & &  String ( drag_data [ " type " ] )  = =  " nodes " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										String  to_dir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										bool  favorite ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										tree - > set_drop_mode_flags ( Tree : : DROP_MODE_ON_ITEM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-09 00:43:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_get_drag_target_folder ( to_dir ,  favorite ,  p_point ,  p_from ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( to_dir . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											to_dir  =  get_current_directory ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 21:08:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										SceneTreeDock : : get_singleton ( ) - > save_branch_to_file ( to_dir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-09 00:43:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _get_drag_target_folder ( String  & target ,  bool  & target_favorites ,  const  Point2  & p_point ,  Control  * p_from )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									target  =  String ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									target_favorites  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// In the file list.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 15:27:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_from  = =  files )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-10 11:21:05 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										int  pos  =  ( p_point  = =  Vector2 ( Math : : INF ,  Math : : INF ) )  ?  - 1  :  files - > get_item_at_position ( p_point ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( pos  = =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											target  =  get_current_directory ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 15:27:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  ltarget  =  files - > get_item_metadata ( pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										target  =  ltarget . ends_with ( " / " )  ?  ltarget  :  current_path . get_base_dir ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 15:27:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// In the tree.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 15:27:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_from  = =  tree )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-04-10 11:21:05 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										TreeItem  * ti  =  ( p_point  = =  Vector2 ( Math : : INF ,  Math : : INF ) )  ?  tree - > get_selected ( )  :  tree - > get_item_at_position ( p_point ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  section  =  ( p_point  = =  Vector2 ( Math : : INF ,  Math : : INF ) )  ?  tree - > get_drop_section_at_position ( tree - > get_item_rect ( ti ) . position )  :  tree - > get_drop_section_at_position ( p_point ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ti )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// Check the favorites first.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-07 21:07:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ti  = =  tree - > get_root ( ) - > get_first_child ( )  & &  section  > =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												target_favorites  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-07 21:07:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  if  ( ti - > get_parent ( )  = =  tree - > get_root ( ) - > get_first_child ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												target_favorites  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												String  fpath  =  ti - > get_metadata ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( section  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( fpath . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														// We drop on a folder.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														target  =  fpath ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-04 19:20:01 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														// We drop on the folder that the target file is in.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														target  =  fpath . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														return ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-07 21:07:30 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( ti - > get_parent ( )  ! =  tree - > get_root ( ) - > get_first_child ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														// Not in the favorite section.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 22:38:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														if  ( fpath  ! =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															// We drop between two files
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															if  ( fpath . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
																fpath  =  fpath . substr ( 0 ,  fpath . length ( )  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															target  =  fpath . get_base_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															return ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 15:27:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-06 12:41:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _update_folder_colors_setting ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! ProjectSettings : : get_singleton ( ) - > has_setting ( " file_customization/folder_colors " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ProjectSettings : : get_singleton ( ) - > set_setting ( " file_customization/folder_colors " ,  assigned_folder_colors ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( assigned_folder_colors . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ProjectSettings : : get_singleton ( ) - > set_setting ( " file_customization/folder_colors " ,  Variant ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ProjectSettings : : get_singleton ( ) - > save ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _folder_color_index_pressed ( int  p_index ,  PopupMenu  * p_menu )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Variant  chosen_color_name  =  p_menu - > get_item_metadata ( p_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < String >  selected ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Get all selected folders based on whether the files panel or tree panel is currently focused.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( files - > has_focus ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Vector < int >  files_selected_ids  =  files - > get_selected_items ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  files_selected_ids . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											selected . push_back ( files - > get_item_metadata ( files_selected_ids [ i ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										TreeItem  * tree_selected  =  tree - > get_root ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										tree_selected  =  tree - > get_next_selected ( tree_selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										while  ( tree_selected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											selected . push_back ( tree_selected - > get_metadata ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											tree_selected  =  tree - > get_next_selected ( tree_selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Update project settings with new folder colors.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  selected . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  String  & fpath  =  selected [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( chosen_color_name )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											assigned_folder_colors [ fpath ]  =  chosen_color_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											assigned_folder_colors . erase ( fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-06 12:41:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_update_folder_colors_setting ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-16 15:52:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									update_all ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-14 02:09:49 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									emit_signal ( SNAME ( " folder_color_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-15 13:25:58 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_and_folders_fill_popup ( PopupMenu  * p_popup ,  const  Vector < String >  & p_paths ,  bool  p_display_path_dependent_options )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Add options for files and folders.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ERR_FAIL_COND_MSG ( p_paths . is_empty ( ) ,  " Path cannot be empty. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-09 14:59:48 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  filenames ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < String >  foldernames ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  favorites_list  =  EditorSettings : : get_singleton ( ) - > get_favorites ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-09 14:59:48 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bool  all_files  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  all_files_scenes  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  all_folders  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bool  all_favorites  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  all_not_favorites  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 14:57:51 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  p_paths . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  String  & fpath  =  p_paths [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( fpath . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											foldernames . push_back ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-09 14:59:48 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											all_files  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-27 14:18:40 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											filenames . push_back ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-09 14:59:48 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											all_folders  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											all_files_scenes  & =  ( EditorFileSystem : : get_singleton ( ) - > get_file_type ( fpath )  = =  " PackedScene " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-27 14:18:40 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Check if in favorites.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bool  found  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  j  =  0 ;  j  <  favorites_list . size ( ) ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( favorites_list [ j ]  = =  fpath )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 18:11:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												found  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( found )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											all_not_favorites  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											all_favorites  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-12-01 16:01:50 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( all_files )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-07 23:35:23 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( all_files_scenes )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( filenames . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Load " ) ) ,  TTRC ( " Open Scene " ) ,  FILE_OPEN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " CreateNewSceneFrom " ) ) ,  TTRC ( " New Inherited Scene " ) ,  FILE_INHERIT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 16:43:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( GLOBAL_GET ( " application/run/main_scene " )  ! =  filenames [ 0 ] )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " PlayScene " ) ) ,  TTRC ( " Set as Main Scene " ) ,  FILE_MAIN_SCENE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-11 12:41:46 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-07 23:35:23 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Load " ) ) ,  TTRC ( " Open Scenes " ) ,  FILE_OPEN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-07 23:35:23 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Instance " ) ) ,  TTRC ( " Instantiate " ) ,  FILE_INSTANTIATE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-07 23:35:23 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( filenames . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Load " ) ) ,  TTRC ( " Open " ) ,  FILE_OPEN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-09 10:33:28 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( filenames . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_item ( TTRC ( " Edit Dependencies... " ) ,  FILE_DEPENDENCIES ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											p_popup - > add_item ( TTRC ( " View Owners... " ) ,  FILE_OWNERS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-09 14:59:48 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_paths . size ( )  = =  1  & &  p_display_path_dependent_options )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PopupMenu  * new_menu  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										new_menu - > connect ( SceneStringName ( id_pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _generic_rmb_option_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > add_submenu_node_item ( TTRC ( " Create New " ) ,  new_menu ,  FILE_NEW ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > set_item_icon ( p_popup - > get_item_index ( FILE_NEW ) ,  get_editor_theme_icon ( SNAME ( " Add " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										new_menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Folder " ) ) ,  TTRC ( " Folder... " ) ,  FILE_NEW_FOLDER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " PackedScene " ) ) ,  TTRC ( " Scene... " ) ,  FILE_NEW_SCENE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Script " ) ) ,  TTRC ( " Script... " ) ,  FILE_NEW_SCRIPT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Object " ) ) ,  TTRC ( " Resource... " ) ,  FILE_NEW_RESOURCE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " TextFile " ) ) ,  TTRC ( " TextFile... " ) ,  FILE_NEW_TEXTFILE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-21 16:43:53 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-03 23:07:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										EditorContextMenuPluginManager : : get_singleton ( ) - > add_options_from_plugins ( new_menu ,  EditorContextMenuPlugin : : CONTEXT_SLOT_FILESYSTEM_CREATE ,  p_paths ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-07 18:41:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Check if the root path is selected, we must check p_paths[1] because the first string in
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// the list of paths obtained by _tree_get_selected(...) is not always the root path.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  root_path_not_selected  =  p_paths [ 0 ]  ! =  " res:// "  & &  ( p_paths . size ( )  < =  1  | |  p_paths [ 1 ]  ! =  " res:// " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( all_folders  & &  foldernames . size ( )  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Load " ) ) ,  TTRC ( " Expand Folder " ) ,  FILE_OPEN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( foldernames . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " GuiTreeArrowDown " ) ) ,  TTRC ( " Expand Hierarchy " ) ,  FOLDER_EXPAND_ALL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " GuiTreeArrowRight " ) ) ,  TTRC ( " Collapse Hierarchy " ) ,  FOLDER_COLLAPSE_ALL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-09 10:33:28 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-07 18:41:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Only add the 'Set Folder Color...' option if the root path is not selected.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( root_path_not_selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											PopupMenu  * folder_colors_menu  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:13:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											folder_colors_menu - > connect ( SceneStringName ( id_pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _folder_color_index_pressed ) . bind ( folder_colors_menu ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_submenu_node_item ( TTRC ( " Set Folder Color... " ) ,  folder_colors_menu ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-17 19:23:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > set_item_icon ( - 1 ,  get_editor_theme_icon ( SNAME ( " Paint " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											folder_colors_menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Folder " ) ) ,  TTRC ( " Default (Reset) " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											folder_colors_menu - > set_item_icon_modulate ( 0 ,  get_theme_color ( SNAME ( " folder_icon_color " ) ,  SNAME ( " FileDialog " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											folder_colors_menu - > add_separator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( const  KeyValue < String ,  Color >  & E  :  folder_colors )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-05 17:20:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												folder_colors_menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Folder " ) ) ,  E . key . capitalize ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												folder_colors_menu - > set_item_icon_modulate ( - 1 ,  editor_is_dark_theme  ?  E . value  :  E . value  *  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												folder_colors_menu - > set_item_metadata ( - 1 ,  E . key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-07 18:41:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Add the options that are only available when a single item is selected.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_paths . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " ActionCopy " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/copy_path " ) ,  FILE_COPY_PATH ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-09 09:38:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > add_shortcut ( ED_GET_SHORTCUT ( " filesystem_dock/copy_absolute_path " ) ,  FILE_COPY_ABSOLUTE_PATH ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-02 11:51:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ResourceLoader : : get_resource_uid ( p_paths [ 0 ] )  ! =  ResourceUID : : INVALID_ID )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " Instance " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/copy_uid " ) ,  FILE_COPY_UID ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-02 11:51:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-07 18:41:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( root_path_not_selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " Rename " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/rename " ) ,  FILE_RENAME ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											p_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " Duplicate " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/duplicate " ) ,  FILE_DUPLICATE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-10 01:15:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-07 18:41:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Add the options that are only available when the root path is not selected.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( root_path_not_selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " MoveUp " ) ) ,  TTRC ( " Move/Duplicate To... " ) ,  FILE_MOVE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " Remove " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/delete " ) ,  FILE_REMOVE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-10 01:15:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-07 18:41:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Only add a separator if we have actually placed any options in the menu since the last separator.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_paths . size ( )  = =  1  | |  root_path_not_selected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										p_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-07 18:41:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Add the options that are available when one or more items are selected.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_paths . size ( )  > =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! all_favorites )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Favorites " ) ) ,  TTRC ( " Add to Favorites " ) ,  FILE_ADD_FAVORITE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-03 18:36:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! all_not_favorites )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " NonFavorite " ) ) ,  TTRC ( " Remove from Favorites " ) ,  FILE_REMOVE_FAVORITE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-20 14:47:41 +07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-07 18:41:37 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( root_path_not_selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											cached_valid_conversion_targets  =  _get_valid_conversions_for_file_paths ( p_paths ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											int  relative_id  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! cached_valid_conversion_targets . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												p_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// If we have more than one type we can convert into, collapse it into a submenu.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												const  int  CONVERSION_SUBMENU_THRESHOLD  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												PopupMenu  * container_menu  =  p_popup ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												String  conversion_string_template  =  " Convert to %s " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( cached_valid_conversion_targets . size ( )  >  CONVERSION_SUBMENU_THRESHOLD )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													container_menu  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-02 16:15:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													container_menu - > connect ( SceneStringName ( id_pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _generic_rmb_option_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													p_popup - > add_submenu_node_item ( TTRC ( " Convert to... " ) ,  container_menu ,  FILE_NEW ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													conversion_string_template  =  " %s " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( const  String  & E  :  cached_valid_conversion_targets )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													Ref < Texture2D >  icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( has_theme_icon ( E ,  SNAME ( " EditorIcons " ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														icon  =  get_editor_theme_icon ( E ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-17 13:59:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														icon  =  get_editor_theme_icon ( SNAME ( " Object " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													container_menu - > add_icon_item ( icon ,  vformat ( TTR ( conversion_string_template ) ,  E ) ,  CONVERT_BASE_ID  +  relative_id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													relative_id + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-20 14:47:41 +07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											List < String >  resource_extensions ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ResourceFormatImporter : : get_singleton ( ) - > get_recognized_extensions_for_type ( " Resource " ,  & resource_extensions ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											HashSet < String >  extension_list ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( const  String  & extension  :  resource_extensions )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												extension_list . insert ( extension ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											bool  resource_valid  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											String  main_extension ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( int  i  =  0 ;  i  ! =  p_paths . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												String  extension  =  p_paths [ i ] . get_extension ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( extension_list . has ( extension ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( main_extension . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														main_extension  =  extension ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													}  else  if  ( extension  ! =  main_extension )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														resource_valid  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													resource_valid  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( resource_valid )  { 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Load " ) ) ,  TTRC ( " Reimport " ) ,  FILE_REIMPORT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-20 14:47:41 +07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_paths . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  String  & fpath  =  p_paths [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 22:50:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-16 12:56:27 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										[[maybe_unused]]  bool  added_separator  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-25 14:43:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( favorites_list . has ( fpath ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											TreeItem  * cursor_item  =  tree - > get_selected ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											bool  is_item_in_favorites  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											while  ( cursor_item  ! =  nullptr )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( cursor_item  = =  favorites_item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													is_item_in_favorites  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												cursor_item  =  cursor_item - > get_parent ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( is_item_in_favorites )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												p_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												added_separator  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												p_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " ShowInFileSystem " ) ) ,  TTRC ( " Show in FileSystem " ) ,  FILE_SHOW_IN_FILESYSTEM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-25 14:43:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 22:50:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED) 
 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-25 14:43:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! added_separator )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											p_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											added_separator  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-17 20:37:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 22:50:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Opening the system file manager is not supported on the Android and web editors.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										const  bool  is_directory  =  fpath . ends_with ( " / " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-12 16:50:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " Terminal " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/open_in_terminal " ) ,  FILE_OPEN_IN_TERMINAL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > set_item_text ( p_popup - > get_item_index ( FILE_OPEN_IN_TERMINAL ) ,  is_directory  ?  TTRC ( " Open in Terminal " )  :  TTRC ( " Open Folder in Terminal " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-10 22:26:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! is_directory )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											p_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " ExternalLink " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/open_in_external_program " ) ,  FILE_OPEN_EXTERNAL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-10 22:26:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-12 16:50:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " Filesystem " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/show_in_explorer " ) ,  FILE_SHOW_IN_EXPLORER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										p_popup - > set_item_text ( p_popup - > get_item_index ( FILE_SHOW_IN_EXPLORER ) ,  is_directory  ?  TTRC ( " Open in File Manager " )  :  TTRC ( " Show in File Manager " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 22:50:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										current_path  =  fpath ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-03 23:07:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									EditorContextMenuPluginManager : : get_singleton ( ) - > add_options_from_plugins ( p_popup ,  EditorContextMenuPlugin : : CONTEXT_SLOT_FILESYSTEM ,  p_paths ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 09:33:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _tree_rmb_select ( const  Vector2  & p_pos ,  MouseButton  p_button )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_button  ! =  MouseButton : : RIGHT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Right click is pressed in the tree.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-10 01:15:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  paths  =  _tree_get_selected ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-11 14:43:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-07 22:09:53 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_popup - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-18 15:37:59 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Popup.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! paths . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-20 11:04:57 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										tree_popup - > reset_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_file_and_folders_fill_popup ( tree_popup ,  paths ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-01 14:44:19 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										tree_popup - > set_position ( tree - > get_screen_position ( )  +  p_pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-31 17:43:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										tree_popup - > reset_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										tree_popup - > popup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-11 11:46:08 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 09:33:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _tree_empty_click ( const  Vector2  & p_pos ,  MouseButton  p_button )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_button  ! =  MouseButton : : RIGHT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Right click is pressed in the empty space of the tree.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path  =  " res:// " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-09 11:22:14 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_popup - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-20 11:04:57 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_popup - > reset_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Folder " ) ) ,  TTRC ( " New Folder... " ) ,  FILE_NEW_FOLDER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " PackedScene " ) ) ,  TTRC ( " New Scene... " ) ,  FILE_NEW_SCENE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Script " ) ) ,  TTRC ( " New Script... " ) ,  FILE_NEW_SCRIPT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Object " ) ) ,  TTRC ( " New Resource... " ) ,  FILE_NEW_RESOURCE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " TextFile " ) ) ,  TTRC ( " New TextFile... " ) ,  FILE_NEW_TEXTFILE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 22:50:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Opening the system file manager is not supported on the Android and web editors.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-18 23:51:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " Terminal " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/open_in_terminal " ) ,  FILE_OPEN_IN_TERMINAL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-12 16:50:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " Filesystem " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/show_in_explorer " ) ,  FILE_SHOW_IN_EXPLORER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 22:50:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-18 23:51:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-31 17:43:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_popup - > set_position ( tree - > get_screen_position ( )  +  p_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree_popup - > reset_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-09 11:22:14 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_popup - > popup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-09 14:54:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _tree_empty_selected ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree - > deselect_all ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-09 21:17:04 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_list_item_clicked ( int  p_item ,  const  Vector2  & p_pos ,  MouseButton  p_mouse_button_index )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-26 00:53:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_mouse_button_index  ! =  MouseButton : : RIGHT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > grab_focus ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-26 00:53:27 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Right click is pressed in the file list.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  paths ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  files - > get_item_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! files - > is_selected ( i ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( files - > get_item_text ( p_item )  = =  " .. " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-21 10:26:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											files - > deselect ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										paths . push_back ( files - > get_item_metadata ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-20 21:25:13 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Popup.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! paths . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										file_list_popup - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 02:22:16 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										_file_and_folders_fill_popup ( file_list_popup ,  paths ,  searched_tokens . is_empty ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-31 17:43:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										file_list_popup - > set_position ( files - > get_screen_position ( )  +  p_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										file_list_popup - > reset_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										file_list_popup - > popup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-09 21:17:04 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_list_empty_clicked ( const  Vector2  & p_pos ,  MouseButton  p_mouse_button_index )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_mouse_button_index  ! =  MouseButton : : RIGHT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Right click on empty space for file list.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 02:22:16 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! searched_tokens . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-03 18:36:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-03 18:36:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path  =  current_path_line_edit - > get_text ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-18 23:51:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-04 17:37:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Favorites isn't a directory so don't show menu.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( current_path  = =  " Favorites " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_popup - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-20 11:04:57 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_popup - > reset_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Folder " ) ) ,  TTRC ( " New Folder... " ) ,  FILE_NEW_FOLDER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									file_list_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " PackedScene " ) ) ,  TTRC ( " New Scene... " ) ,  FILE_NEW_SCENE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									file_list_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Script " ) ) ,  TTRC ( " New Script... " ) ,  FILE_NEW_SCRIPT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									file_list_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Object " ) ) ,  TTRC ( " New Resource... " ) ,  FILE_NEW_RESOURCE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									file_list_popup - > add_icon_item ( get_editor_theme_icon ( SNAME ( " TextFile " ) ) ,  TTRC ( " New TextFile... " ) ,  FILE_NEW_TEXTFILE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_popup - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-18 19:34:23 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " Terminal " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/open_in_terminal " ) ,  FILE_OPEN_IN_TERMINAL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-12 16:50:16 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_popup - > add_icon_shortcut ( get_editor_theme_icon ( SNAME ( " Filesystem " ) ) ,  ED_GET_SHORTCUT ( " filesystem_dock/show_in_explorer " ) ,  FILE_SHOW_IN_EXPLORER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-10 22:26:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-31 17:43:35 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_popup - > set_position ( files - > get_screen_position ( )  +  p_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									file_list_popup - > reset_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_popup - > popup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-20 21:25:13 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-25 14:30:40 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : select_file ( const  String  & p_file )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-17 20:40:38 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									_navigate_to_path ( p_file ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-25 14:30:40 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_multi_selected ( int  p_index ,  bool  p_selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Set the path to the current focused item.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  current  =  files - > get_current ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( current  = =  p_index )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										String  fpath  =  files - > get_item_metadata ( current ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! fpath . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											current_path  =  fpath ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Update the import dock.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-02 22:05:34 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									import_dock_needs_update  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-18 15:46:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									callable_mp ( this ,  & FileSystemDock : : _update_import_dock ) . call_deferred ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _tree_mouse_exited ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( holding_branch )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_reselect_items_selected_on_drag_begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _reselect_items_selected_on_drag_begin ( bool  reset )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									TreeItem  * selected_item  =  tree - > get_next_selected ( tree - > get_root ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( selected_item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										selected_item - > deselect ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! tree_items_selected_on_drag_begin . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										bool  reselected  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( TreeItem  * item  :  tree_items_selected_on_drag_begin )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( item - > get_tree ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												item - > select ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												reselected  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( reset )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											tree_items_selected_on_drag_begin . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! reselected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// If couldn't reselect the items selected on drag begin, select the "res://" item.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											tree - > get_root ( ) - > get_child ( 1 ) - > select ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									files - > deselect_all ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! list_items_selected_on_drag_begin . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( const  int  idx  :  list_items_selected_on_drag_begin )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											files - > select ( idx ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( reset )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											list_items_selected_on_drag_begin . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _tree_gui_input ( Ref < InputEvent >  p_event )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-05 14:45:54 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < InputEventKey >  key  =  p_event ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Ref < InputEventMouseMotion >  mm  =  p_event ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( mm . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										TreeItem  * item  =  tree - > get_item_at_position ( mm - > get_position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( item  & &  holding_branch )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											String  fpath  =  item - > get_metadata ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											while  ( ! fpath . ends_with ( " / " )  & &  fpath  ! =  " res:// "  & &  item - > get_parent ( ) )  {  // Find the parent folder tree item.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												item  =  item - > get_parent ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fpath  =  item - > get_metadata ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											TreeItem  * deselect_item  =  tree - > get_next_selected ( tree - > get_root ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											while  ( deselect_item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												deselect_item - > deselect ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												deselect_item  =  tree - > get_next_selected ( deselect_item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											item - > select ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( display_mode  ! =  DisplayMode : : DISPLAY_MODE_TREE_ONLY )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												files - > deselect_all ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// Try to select the corresponding file list item.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												const  int  files_item_idx  =  files - > find_metadata ( fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( files_item_idx  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													files - > select ( files_item_idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-05 14:45:54 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( key . is_valid ( )  & &  key - > is_pressed ( )  & &  ! key - > is_echo ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ED_IS_SHORTCUT ( " filesystem_dock/duplicate " ,  p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_tree_rmb_option ( FILE_DUPLICATE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-05 14:45:54 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/copy_path " ,  p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_tree_rmb_option ( FILE_COPY_PATH ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-09 09:38:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/copy_absolute_path " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_tree_rmb_option ( FILE_COPY_ABSOLUTE_PATH ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-02 11:51:23 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/copy_uid " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_tree_rmb_option ( FILE_COPY_UID ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-05 14:45:54 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/delete " ,  p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_tree_rmb_option ( FILE_REMOVE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-26 13:50:48 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/rename " ,  p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											_tree_rmb_option ( FILE_RENAME ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-08 11:00:07 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/show_in_explorer " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_tree_rmb_option ( FILE_SHOW_IN_EXPLORER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-22 01:29:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/open_in_external_program " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_tree_rmb_option ( FILE_OPEN_EXTERNAL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/open_in_terminal " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_tree_rmb_option ( FILE_OPEN_IN_TERMINAL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-30 20:11:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " file_dialog/focus_path " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											focus_on_path ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-13 20:13:17 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " editor/open_search " ,  p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 19:22:50 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											focus_on_filter ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-03 08:15:33 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-03 23:07:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Callable  custom_callback  =  EditorContextMenuPluginManager : : get_singleton ( ) - > match_custom_shortcut ( EditorContextMenuPlugin : : CONTEXT_SLOT_FILESYSTEM ,  p_event ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! custom_callback . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												custom_callback  =  EditorContextMenuPluginManager : : get_singleton ( ) - > match_custom_shortcut ( EditorContextMenuPlugin : : CONTEXT_SLOT_FILESYSTEM_CREATE ,  p_event ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( custom_callback . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												EditorContextMenuPluginManager : : get_singleton ( ) - > invoke_callback ( custom_callback ,  _tree_get_selected ( false ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-07-21 16:43:53 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-05 14:45:54 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-03 08:15:33 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										accept_event ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-05 14:45:54 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_list_gui_input ( Ref < InputEvent >  p_event )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < InputEventMouseMotion >  mm  =  p_event ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( mm . is_valid ( )  & &  holding_branch )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  int  item_idx  =  files - > get_item_at_position ( mm - > get_position ( ) ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										files - > deselect_all ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										String  fpath ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( item_idx  ! =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											fpath  =  files - > get_item_metadata ( item_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( fpath . ends_with ( " / " )  | |  fpath  = =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												files - > select ( item_idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fpath  =  get_current_directory ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										TreeItem  * deselect_item  =  tree - > get_next_selected ( tree - > get_root ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										while  ( deselect_item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											deselect_item - > deselect ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											deselect_item  =  tree - > get_next_selected ( deselect_item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Try to select the corresponding tree item.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										TreeItem  * tree_item  =  ( item_idx  ! =  - 1 )  ?  tree - > get_item_with_text ( files - > get_item_text ( item_idx ) )  :  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( tree_item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											tree_item - > select ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// Find parent folder.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-16 18:52:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											fpath  =  fpath . substr ( 0 ,  fpath . rfind_char ( ' / ' )  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( fpath . size ( )  >  String ( " res:// " ) . size ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fpath  =  fpath . left ( fpath . size ( )  -  2 ) ;  // Remove last '/'.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-16 18:52:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												const  int  slash_idx  =  fpath . rfind_char ( ' / ' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-26 11:41:11 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												fpath  =  fpath . substr ( slash_idx  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-03-31 05:41:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											tree_item  =  tree - > get_item_with_text ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 21:36:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( tree_item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												tree_item - > select ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < InputEventKey >  key  =  p_event ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( key . is_valid ( )  & &  key - > is_pressed ( )  & &  ! key - > is_echo ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ED_IS_SHORTCUT ( " filesystem_dock/duplicate " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_file_list_rmb_option ( FILE_DUPLICATE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/copy_path " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_file_list_rmb_option ( FILE_COPY_PATH ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-09 09:38:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/copy_absolute_path " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_file_list_rmb_option ( FILE_COPY_ABSOLUTE_PATH ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/delete " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_file_list_rmb_option ( FILE_REMOVE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/rename " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_file_list_rmb_option ( FILE_RENAME ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-08 11:00:07 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/show_in_explorer " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_file_list_rmb_option ( FILE_SHOW_IN_EXPLORER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-16 09:24:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " filesystem_dock/open_in_terminal " ,  p_event ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											_file_list_rmb_option ( FILE_OPEN_IN_TERMINAL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-13 20:13:17 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  if  ( ED_IS_SHORTCUT ( " editor/open_search " ,  p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 19:22:50 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											focus_on_filter ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-03 08:15:33 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-03 23:07:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Callable  custom_callback  =  EditorContextMenuPluginManager : : get_singleton ( ) - > match_custom_shortcut ( EditorContextMenuPlugin : : CONTEXT_SLOT_FILESYSTEM ,  p_event ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! custom_callback . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												custom_callback  =  EditorContextMenuPluginManager : : get_singleton ( ) - > match_custom_shortcut ( EditorContextMenuPlugin : : CONTEXT_SLOT_FILESYSTEM_CREATE ,  p_event ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( custom_callback . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												EditorContextMenuPluginManager : : get_singleton ( ) - > invoke_callback ( custom_callback ,  files - > get_selected_items ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-03 08:15:33 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										accept_event ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-02 22:05:34 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 00:20:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  FileSystemDock : : _get_imported_files ( const  String  & p_path ,  String  & r_extension ,  Vector < String >  & r_files )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! p_path . ends_with ( " / " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( FileAccess : : exists ( p_path  +  " .import " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 00:20:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( r_extension . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												r_extension  =  p_path . get_extension ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  if  ( r_extension  ! =  p_path . get_extension ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												r_files . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  false ;  // File type mismatch, stop search.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											r_files . push_back ( p_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 00:20:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-02 22:05:34 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 11:08:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Ref < DirAccess >  da  =  DirAccess : : open ( p_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-26 03:07:43 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ERR_FAIL_COND_V ( da . is_null ( ) ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									da - > list_dir_begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									String  n  =  da - > get_next ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									while  ( ! n . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( n  ! =  " . "  & &  n  ! =  " .. "  & &  ! n . ends_with ( " .import " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											String  npath  =  p_path  +  n  +  ( da - > current_is_dir ( )  ?  " / "  :  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 00:20:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! _get_imported_files ( npath ,  r_extension ,  r_files ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										n  =  da - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									da - > list_dir_end ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 00:20:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _update_import_dock ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-05 14:09:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! import_dock_needs_update )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-05 14:09:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// List selected.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-24 14:26:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  selected ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-25 23:39:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( display_mode  = =  DISPLAY_MODE_TREE_ONLY )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-24 14:26:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Use the tree
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										selected  =  _tree_get_selected ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// Use the file list.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-24 14:26:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  files - > get_item_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-05 14:09:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! files - > is_selected ( i ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-24 14:26:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-05 14:09:59 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-24 14:26:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											selected . push_back ( files - > get_item_metadata ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 00:20:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! selected . is_empty ( )  & &  selected [ 0 ]  = =  " res:// " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// Scanning res:// is costly and unlikely to yield any useful results.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Expand directory selection.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  efiles ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 00:20:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									String  extension ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( const  String  & fpath  :  selected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										_get_imported_files ( fpath ,  extension ,  efiles ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Check import.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Vector < String >  imports ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									String  import_type ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-13 23:31:41 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  efiles . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-18 17:40:56 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  String  & fpath  =  efiles [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Ref < ConfigFile >  cf ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-17 16:03:09 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										cf . instantiate ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Error  err  =  cf - > load ( fpath  +  " .import " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( err  ! =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											imports . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-23 11:20:14 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										String  type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( cf - > has_section_key ( " remap " ,  " type " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											type  =  cf - > get_value ( " remap " ,  " type " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( import_type . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											import_type  =  type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( import_type  ! =  type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-22 01:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// All should be the same type.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											imports . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										imports . push_back ( fpath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-03-20 00:07:31 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( imports . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 21:08:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ImportDock : : get_singleton ( ) - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  if  ( imports . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 21:08:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ImportDock : : get_singleton ( ) - > set_edit_path ( imports [ 0 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 21:08:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ImportDock : : get_singleton ( ) - > set_edit_multiple_paths ( imports ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-02 22:05:34 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									import_dock_needs_update  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-01 09:45:45 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-08 19:18:03 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _feature_profile_changed ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_update_display_mode ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-11 12:20:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _project_settings_changed ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									assigned_folder_colors  =  ProjectSettings : : get_singleton ( ) - > get_setting ( " file_customization/folder_colors " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : set_file_sort ( FileSortOption  p_file_sort )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  ! =  ( int ) FileSortOption : : FILE_SORT_MAX ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										tree_button_sort - > get_popup ( ) - > set_item_checked ( i ,  ( i  = =  ( int ) p_file_sort ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										file_list_button_sort - > get_popup ( ) - > set_item_checked ( i ,  ( i  = =  ( int ) p_file_sort ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									file_sort  =  p_file_sort ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Update everything needed.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-16 15:52:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									update_all ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _file_sort_popup ( int  p_id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									set_file_sort ( ( FileSortOption ) p_id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-13 13:15:25 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								const  HashMap < String ,  Color >  & FileSystemDock : : get_folder_colors ( )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  folder_colors ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Dictionary  FileSystemDock : : get_assigned_folder_colors ( )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  assigned_folder_colors ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								MenuButton  * FileSystemDock : : _create_file_menu_button ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									MenuButton  * button  =  memnew ( MenuButton ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-20 19:52:20 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button - > set_flat ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									button - > set_theme_type_variation ( " FlatMenuButton " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button - > set_tooltip_text ( TTRC ( " Sort Files " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button - > set_accessibility_name ( TTRC ( " Sort Files " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									PopupMenu  * p  =  button - > get_popup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:13:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									p - > connect ( SceneStringName ( id_pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _file_sort_popup ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									p - > add_radio_check_item ( TTRC ( " Sort by Name (Ascending) " ) ,  ( int ) FileSortOption : : FILE_SORT_NAME ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p - > add_radio_check_item ( TTRC ( " Sort by Name (Descending) " ) ,  ( int ) FileSortOption : : FILE_SORT_NAME_REVERSE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p - > add_radio_check_item ( TTRC ( " Sort by Type (Ascending) " ) ,  ( int ) FileSortOption : : FILE_SORT_TYPE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p - > add_radio_check_item ( TTRC ( " Sort by Type (Descending) " ) ,  ( int ) FileSortOption : : FILE_SORT_TYPE_REVERSE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p - > add_radio_check_item ( TTRC ( " Sort by Last Modified " ) ,  ( int ) FileSortOption : : FILE_SORT_MODIFIED_TIME ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p - > add_radio_check_item ( TTRC ( " Sort by First Modified " ) ,  ( int ) FileSortOption : : FILE_SORT_MODIFIED_TIME_REVERSE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									p - > set_item_checked ( ( int ) file_sort ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  button ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  FileSystemDock : : _can_dock_horizontal ( )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _set_dock_horizontal ( bool  p_enable )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( button_dock_placement - > is_visible ( )  = =  p_enable )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_enable )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_meta ( " _dock_display_mode " ,  get_display_mode ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_meta ( " _dock_file_display_mode " ,  get_file_list_display_mode ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										FileSystemDock : : DisplayMode  new_display_mode  =  FileSystemDock : : DisplayMode ( int ( get_meta ( " _bottom_display_mode " ,  int ( FileSystemDock : : DISPLAY_MODE_HSPLIT ) ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										FileSystemDock : : FileListDisplayMode  new_file_display_mode  =  FileSystemDock : : FileListDisplayMode ( int ( get_meta ( " _bottom_file_display_mode " ,  int ( FileSystemDock : : FILE_LIST_DISPLAY_THUMBNAILS ) ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_display_mode ( new_display_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_file_list_display_mode ( new_file_display_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_custom_minimum_size ( Size2 ( 0 ,  200 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_meta ( " _bottom_display_mode " ,  get_display_mode ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_meta ( " _bottom_file_display_mode " ,  get_file_list_display_mode ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										FileSystemDock : : DisplayMode  new_display_mode  =  FileSystemDock : : DISPLAY_MODE_TREE_ONLY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										FileSystemDock : : FileListDisplayMode  new_file_display_mode  =  FileSystemDock : : FILE_LIST_DISPLAY_LIST ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_display_mode  =  FileSystemDock : : DisplayMode ( int ( get_meta ( " _dock_display_mode " ,  new_display_mode ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										new_file_display_mode  =  FileSystemDock : : FileListDisplayMode ( int ( get_meta ( " _dock_file_display_mode " ,  new_file_display_mode ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_display_mode ( new_display_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_file_list_display_mode ( new_file_display_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_custom_minimum_size ( Size2 ( 0 ,  0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									button_dock_placement - > set_visible ( p_enable ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _bind_methods ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-12 13:10:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _file_list_thumbnail_done " ) ,  & FileSystemDock : : _file_list_thumbnail_done ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _tree_thumbnail_done " ) ,  & FileSystemDock : : _tree_thumbnail_done ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-13 12:47:24 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-01 14:18:13 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ClassDB : : bind_method ( D_METHOD ( " navigate_to_path " ,  " path " ) ,  & FileSystemDock : : navigate_to_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-03 13:15:15 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ClassDB : : bind_method ( D_METHOD ( " add_resource_tooltip_plugin " ,  " plugin " ) ,  & FileSystemDock : : add_resource_tooltip_plugin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ClassDB : : bind_method ( D_METHOD ( " remove_resource_tooltip_plugin " ,  " plugin " ) ,  & FileSystemDock : : remove_resource_tooltip_plugin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _set_dock_horizontal " ,  " enable " ) ,  & FileSystemDock : : _set_dock_horizontal ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _can_dock_horizontal " ) ,  & FileSystemDock : : _can_dock_horizontal ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-18 15:57:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _save_layout_to_config " ) ,  & FileSystemDock : : _save_layout_to_config ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _load_layout_from_config " ) ,  & FileSystemDock : : _load_layout_from_config ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-07 23:35:23 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ADD_SIGNAL ( MethodInfo ( " inherit " ,  PropertyInfo ( Variant : : STRING ,  " file " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 00:13:39 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ADD_SIGNAL ( MethodInfo ( " instantiate " ,  PropertyInfo ( Variant : : PACKED_STRING_ARRAY ,  " files " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-13 20:17:33 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-23 12:01:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ADD_SIGNAL ( MethodInfo ( " resource_removed " ,  PropertyInfo ( Variant : : OBJECT ,  " resource " ,  PROPERTY_HINT_RESOURCE_TYPE ,  " Resource " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-13 20:17:33 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ADD_SIGNAL ( MethodInfo ( " file_removed " ,  PropertyInfo ( Variant : : STRING ,  " file " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ADD_SIGNAL ( MethodInfo ( " folder_removed " ,  PropertyInfo ( Variant : : STRING ,  " folder " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ADD_SIGNAL ( MethodInfo ( " files_moved " ,  PropertyInfo ( Variant : : STRING ,  " old_file " ) ,  PropertyInfo ( Variant : : STRING ,  " new_file " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-07 13:38:29 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ADD_SIGNAL ( MethodInfo ( " folder_moved " ,  PropertyInfo ( Variant : : STRING ,  " old_folder " ) ,  PropertyInfo ( Variant : : STRING ,  " new_folder " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-14 02:09:49 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ADD_SIGNAL ( MethodInfo ( " folder_color_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-25 23:39:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ADD_SIGNAL ( MethodInfo ( " display_mode_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-18 15:57:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _save_layout_to_config ( Ref < ConfigFile >  p_layout ,  const  String  & p_section )  const  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-27 15:55:07 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									p_layout - > set_value ( p_section ,  " dock_filesystem_h_split_offset " ,  get_h_split_offset ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p_layout - > set_value ( p_section ,  " dock_filesystem_v_split_offset " ,  get_v_split_offset ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p_layout - > set_value ( p_section ,  " dock_filesystem_display_mode " ,  get_display_mode ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-22 20:47:20 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									p_layout - > set_value ( p_section ,  " dock_filesystem_file_sort " ,  ( int ) get_file_sort ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-27 15:55:07 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									p_layout - > set_value ( p_section ,  " dock_filesystem_file_list_display_mode " ,  get_file_list_display_mode ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									PackedStringArray  selected_files  =  get_selected_paths ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p_layout - > set_value ( p_section ,  " dock_filesystem_selected_paths " ,  selected_files ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Vector < String >  uncollapsed_paths  =  get_uncollapsed_paths ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-15 00:31:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									p_layout - > set_value ( p_section ,  " dock_filesystem_uncollapsed_paths " ,  searched_tokens . is_empty ( )  ?  uncollapsed_paths  :  uncollapsed_paths_before_search ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-27 15:55:07 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-18 15:57:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  FileSystemDock : : _load_layout_from_config ( Ref < ConfigFile >  p_layout ,  const  String  & p_section )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-27 15:55:07 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( p_layout - > has_section_key ( p_section ,  " dock_filesystem_h_split_offset " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  fs_h_split_ofs  =  p_layout - > get_value ( p_section ,  " dock_filesystem_h_split_offset " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_h_split_offset ( fs_h_split_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_layout - > has_section_key ( p_section ,  " dock_filesystem_v_split_offset " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  fs_v_split_ofs  =  p_layout - > get_value ( p_section ,  " dock_filesystem_v_split_offset " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_v_split_offset ( fs_v_split_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_layout - > has_section_key ( p_section ,  " dock_filesystem_display_mode " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DisplayMode  dock_filesystem_display_mode  =  DisplayMode ( int ( p_layout - > get_value ( p_section ,  " dock_filesystem_display_mode " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_display_mode ( dock_filesystem_display_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_layout - > has_section_key ( p_section ,  " dock_filesystem_file_sort " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										FileSortOption  dock_filesystem_file_sort  =  FileSortOption ( int ( p_layout - > get_value ( p_section ,  " dock_filesystem_file_sort " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_file_sort ( dock_filesystem_file_sort ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_layout - > has_section_key ( p_section ,  " dock_filesystem_file_list_display_mode " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										FileListDisplayMode  dock_filesystem_file_list_display_mode  =  FileListDisplayMode ( int ( p_layout - > get_value ( p_section ,  " dock_filesystem_file_list_display_mode " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										set_file_list_display_mode ( dock_filesystem_file_list_display_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_layout - > has_section_key ( p_section ,  " dock_filesystem_selected_paths " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PackedStringArray  dock_filesystem_selected_paths  =  p_layout - > get_value ( p_section ,  " dock_filesystem_selected_paths " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  dock_filesystem_selected_paths . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											select_file ( dock_filesystem_selected_paths [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Restore collapsed state.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									PackedStringArray  uncollapsed_tis ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( p_layout - > has_section_key ( p_section ,  " dock_filesystem_uncollapsed_paths " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										uncollapsed_tis  =  p_layout - > get_value ( p_section ,  " dock_filesystem_uncollapsed_paths " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										uncollapsed_tis  =  {  " res:// "  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! uncollapsed_tis . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( int  i  =  0 ;  i  <  uncollapsed_tis . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											TreeItem  * uncollapsed_ti  =  get_tree_control ( ) - > get_item_with_metadata ( uncollapsed_tis [ i ] ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( uncollapsed_ti )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												uncollapsed_ti - > set_collapsed ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										get_tree_control ( ) - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-27 10:36:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								FileSystemDock : : FileSystemDock ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 21:08:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									singleton  =  this ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-25 23:59:31 -02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									set_name ( " FileSystem " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path  =  " res:// " ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ProjectSettings : : get_singleton ( ) - > add_hidden_prefix ( " file_customization/ " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-02 12:37:48 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// `KeyModifierMask::CMD_OR_CTRL | Key::C` conflicts with other editor shortcuts.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-18 19:07:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_SHORTCUT ( " filesystem_dock/copy_path " ,  TTRC ( " Copy Path " ) ,  KeyModifierMask : : CMD_OR_CTRL  |  KeyModifierMask : : SHIFT  |  Key : : C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_SHORTCUT ( " filesystem_dock/copy_absolute_path " ,  TTRC ( " Copy Absolute Path " ) ,  KeyModifierMask : : CMD_OR_CTRL  |  KeyModifierMask : : ALT  |  Key : : C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_SHORTCUT ( " filesystem_dock/copy_uid " ,  TTRC ( " Copy UID " ) ,  KeyModifierMask : : CMD_OR_CTRL  |  KeyModifierMask : : ALT  |  KeyModifierMask : : SHIFT  |  Key : : C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_SHORTCUT ( " filesystem_dock/duplicate " ,  TTRC ( " Duplicate... " ) ,  KeyModifierMask : : CMD_OR_CTRL  |  Key : : D ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_SHORTCUT ( " filesystem_dock/delete " ,  TTRC ( " Delete " ) ,  Key : : KEY_DELETE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_SHORTCUT ( " filesystem_dock/rename " ,  TTRC ( " Rename... " ) ,  Key : : F2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_SHORTCUT_OVERRIDE ( " filesystem_dock/rename " ,  " macos " ,  Key : : ENTER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 22:50:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Opening the system file manager or opening in an external program is not supported on the Android and web editors.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-18 19:07:44 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_SHORTCUT ( " filesystem_dock/show_in_explorer " ,  TTRC ( " Open in File Manager " ) ,  KeyModifierMask : : CMD_OR_CTRL  |  KeyModifierMask : : ALT  |  Key : : R ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_SHORTCUT ( " filesystem_dock/open_in_external_program " ,  TTRC ( " Open in External Program " ) ,  KeyModifierMask : : CMD_OR_CTRL  |  KeyModifierMask : : ALT  |  Key : : E ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_SHORTCUT ( " filesystem_dock/open_in_terminal " ,  TTRC ( " Open in Terminal " ) ,  KeyModifierMask : : CMD_OR_CTRL  |  KeyModifierMask : : ALT  |  Key : : T ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-15 22:50:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-05 14:45:54 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-05 17:20:55 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Properly translating color names would require a separate HashMap, so for simplicity they are provided as comments.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									folder_colors [ " red " ]  =  Color ( 1.0 ,  0.271 ,  0.271 ) ;  // TTR("Red")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									folder_colors [ " orange " ]  =  Color ( 1.0 ,  0.561 ,  0.271 ) ;  // TTR("Orange")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									folder_colors [ " yellow " ]  =  Color ( 1.0 ,  0.890 ,  0.271 ) ;  // TTR("Yellow")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									folder_colors [ " green " ]  =  Color ( 0.502 ,  1.0 ,  0.271 ) ;  // TTR("Green")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									folder_colors [ " teal " ]  =  Color ( 0.271 ,  1.0 ,  0.635 ) ;  // TTR("Teal")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									folder_colors [ " blue " ]  =  Color ( 0.271 ,  0.843 ,  1.0 ) ;  // TTR("Blue")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									folder_colors [ " purple " ]  =  Color ( 0.502 ,  0.271 ,  1.0 ) ;  // TTR("Purple")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									folder_colors [ " pink " ]  =  Color ( 1.0 ,  0.271 ,  0.588 ) ;  // TTR("Pink")
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									folder_colors [ " gray " ]  =  Color ( 0.616 ,  0.616 ,  0.616 ) ;  // TTR("Gray")
 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									assigned_folder_colors  =  ProjectSettings : : get_singleton ( ) - > get_setting ( " file_customization/folder_colors " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-17 15:03:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									editor_is_dark_theme  =  EditorThemeManager : : is_dark_theme ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-18 21:39:18 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									VBoxContainer  * top_vbc  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									add_child ( top_vbc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-16 19:48:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									HBoxContainer  * toolbar_hbc  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									top_vbc - > add_child ( toolbar_hbc ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-21 22:02:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									HBoxContainer  * nav_hbc  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									nav_hbc - > add_theme_constant_override ( " separation " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									toolbar_hbc - > add_child ( nav_hbc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 20:49:04 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_prev  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									button_hist_prev - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_prev - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_prev - > set_focus_mode ( FOCUS_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_prev - > set_tooltip_text ( TTRC ( " Go to previous selected folder/file. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_prev - > set_accessibility_name ( TTRC ( " Previous " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-21 22:02:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									nav_hbc - > add_child ( button_hist_prev ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 20:49:04 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_next  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									button_hist_next - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_next - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									button_hist_next - > set_focus_mode ( FOCUS_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_next - > set_tooltip_text ( TTRC ( " Go to next selected folder/file. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_hist_next - > set_accessibility_name ( TTRC ( " Next " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-21 22:02:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									nav_hbc - > add_child ( button_hist_next ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path_line_edit  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									current_path_line_edit - > set_structured_text_bidi_override ( TextServer : : STRUCTURED_TEXT_FILE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path_line_edit - > set_accessibility_name ( TTRC ( " Path " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-11 04:17:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									current_path_line_edit - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									_set_current_path_line_edit_text ( current_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									toolbar_hbc - > add_child ( current_path_line_edit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-23 23:24:17 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-14 00:16:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_toggle_display_mode  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_toggle_display_mode - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _change_split_mode ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-14 00:16:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_toggle_display_mode - > set_focus_mode ( FOCUS_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_toggle_display_mode - > set_tooltip_text ( TTRC ( " Change Split Mode " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_toggle_display_mode - > set_accessibility_name ( TTRC ( " Change Split Mode " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-20 19:52:20 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_toggle_display_mode - > set_theme_type_variation ( " FlatMenuButton " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-14 00:16:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									toolbar_hbc - > add_child ( button_toggle_display_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_dock_placement  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-21 22:02:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_dock_placement - > set_theme_type_variation ( " FlatMenuButton " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_dock_placement - > set_accessibility_name ( TTRC ( " Dock Placement " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_dock_placement - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _change_bottom_dock_placement ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_dock_placement - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									toolbar_hbc - > add_child ( button_dock_placement ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									toolbar2_hbc  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									top_vbc - > add_child ( toolbar2_hbc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree_search_box  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree_search_box - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_search_box - > set_placeholder ( TTRC ( " Filter Files " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_search_box - > set_accessibility_name ( TTRC ( " Filter Files " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_search_box - > set_clear_button_enabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_search_box - > connect ( SceneStringName ( text_changed ) ,  callable_mp ( this ,  & FileSystemDock : : _search_changed ) . bind ( tree_search_box ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									toolbar2_hbc - > add_child ( tree_search_box ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_button_sort  =  _create_file_menu_button ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									toolbar2_hbc - > add_child ( tree_button_sort ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_popup  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-12 09:37:40 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_child ( file_list_popup ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_popup  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-12 09:37:40 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_child ( tree_popup ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-10 13:19:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									split_box  =  memnew ( SplitContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									split_box - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-23 21:01:01 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									split_box - > connect ( " dragged " ,  callable_mp ( this ,  & FileSystemDock : : _split_dragged ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									split_box_offset_h  =  240  *  EDSCALE ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_child ( split_box ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-16 19:48:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree  =  memnew ( FileSystemTree ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > set_accessibility_name ( TTRC ( " Directories " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-15 21:01:27 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > set_auto_translate_mode ( AUTO_TRANSLATE_MODE_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-03-17 16:28:18 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > set_auto_translate_mode ( AUTO_TRANSLATE_MODE_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > set_hide_root ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-14 03:37:19 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SET_DRAG_FORWARDING_GCD ( tree ,  FileSystemDock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-10 13:19:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > set_allow_rmb_select ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 17:00:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > set_select_mode ( Tree : : SELECT_MULTI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-03 23:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > set_custom_minimum_size ( Size2 ( 40  *  EDSCALE ,  15  *  EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-07 14:05:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > set_column_clip_content ( 0 ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									split_box - > add_child ( tree ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-16 19:48:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > connect ( " item_activated " ,  callable_mp ( this ,  & FileSystemDock : : _tree_activate_file ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree - > connect ( " multi_selected " ,  callable_mp ( this ,  & FileSystemDock : : _tree_multi_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-18 09:33:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > connect ( " item_mouse_selected " ,  callable_mp ( this ,  & FileSystemDock : : _tree_rmb_select ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree - > connect ( " empty_clicked " ,  callable_mp ( this ,  & FileSystemDock : : _tree_empty_click ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > connect ( " nothing_selected " ,  callable_mp ( this ,  & FileSystemDock : : _tree_empty_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-13 16:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > connect ( SceneStringName ( gui_input ) ,  callable_mp ( this ,  & FileSystemDock : : _tree_gui_input ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tree - > connect ( SceneStringName ( mouse_exited ) ,  callable_mp ( this ,  & FileSystemDock : : _tree_mouse_exited ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-26 15:58:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree - > connect ( " item_edited " ,  callable_mp ( this ,  & FileSystemDock : : _rename_operation_confirm ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									file_list_vb - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									split_box - > add_child ( file_list_vb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									path_hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_vb - > add_child ( path_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_search_box  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									file_list_search_box - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_search_box - > set_placeholder ( TTRC ( " Filter Files " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_search_box - > set_accessibility_name ( TTRC ( " Filter Files " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 14:36:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_search_box - > set_clear_button_enabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_search_box - > connect ( SceneStringName ( text_changed ) ,  callable_mp ( this ,  & FileSystemDock : : _search_changed ) . bind ( file_list_search_box ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-13 21:49:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									path_hb - > add_child ( file_list_search_box ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-07 21:56:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_button_sort  =  _create_file_menu_button ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									path_hb - > add_child ( file_list_button_sort ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 20:49:04 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_file_list_display_mode  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_file_list_display_mode - > set_accessibility_name ( TTRC ( " Display Mode " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-21 22:02:56 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									button_file_list_display_mode - > set_theme_type_variation ( " FlatMenuButton " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									path_hb - > add_child ( button_file_list_display_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files  =  memnew ( FileSystemList ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > set_accessibility_name ( TTRC ( " Files " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > set_select_mode ( ItemList : : SELECT_MULTI ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-06 17:10:05 +04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > set_theme_type_variation ( " ItemListSecondary " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-14 03:37:19 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SET_DRAG_FORWARDING_GCD ( files ,  FileSystemDock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-09 21:17:04 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > connect ( " item_clicked " ,  callable_mp ( this ,  & FileSystemDock : : _file_list_item_clicked ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-13 16:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > connect ( SceneStringName ( gui_input ) ,  callable_mp ( this ,  & FileSystemDock : : _file_list_gui_input ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > connect ( " multi_selected " ,  callable_mp ( this ,  & FileSystemDock : : _file_multi_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-09 21:17:04 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > connect ( " empty_clicked " ,  callable_mp ( this ,  & FileSystemDock : : _file_list_empty_clicked ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:04:14 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > connect ( " item_edited " ,  callable_mp ( this ,  & FileSystemDock : : _rename_operation_confirm ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-24 11:59:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > set_custom_minimum_size ( Size2 ( 0 ,  15  *  EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									files - > set_allow_rmb_select ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_vb - > add_child ( files ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									scanning_vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									scanning_vb - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									add_child ( scanning_vb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Label  * slabel  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									slabel - > set_text ( TTRC ( " Scanning Files, \n Please Wait... " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									slabel - > set_horizontal_alignment ( HORIZONTAL_ALIGNMENT_CENTER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									scanning_vb - > add_child ( slabel ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									scanning_progress  =  memnew ( ProgressBar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-21 09:55:22 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									scanning_progress - > set_accessibility_name ( TTRC ( " Filesystem Scan " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									scanning_vb - > add_child ( scanning_progress ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									deps_editor  =  memnew ( DependencyEditor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									add_child ( deps_editor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-27 10:36:51 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									owners_editor  =  memnew ( DependencyEditorOwners ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_child ( owners_editor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									remove_dialog  =  memnew ( DependencyRemoveDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-23 12:01:28 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									remove_dialog - > connect ( " resource_removed " ,  callable_mp ( this ,  & FileSystemDock : : _resource_removed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-17 01:40:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									remove_dialog - > connect ( " file_removed " ,  callable_mp ( this ,  & FileSystemDock : : _file_removed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									remove_dialog - > connect ( " folder_removed " ,  callable_mp ( this ,  & FileSystemDock : : _folder_removed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_child ( remove_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									move_dialog  =  memnew ( EditorDirDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-09 00:00:52 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_child ( move_dialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-24 13:59:32 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									move_dialog - > connect ( " move_pressed " ,  callable_mp ( this ,  & FileSystemDock : : _move_operation_confirm ) . bind ( false ,  OVERWRITE_UNDECIDED ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									move_dialog - > connect ( " copy_pressed " ,  callable_mp ( this ,  & FileSystemDock : : _move_operation_confirm ) . bind ( true ,  OVERWRITE_UNDECIDED ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-09 00:00:52 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-29 18:03:11 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									overwrite_dialog  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									add_child ( overwrite_dialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									overwrite_dialog - > set_ok_button_text ( TTRC ( " Overwrite " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog - > add_button ( TTRC ( " Keep Both " ) ,  true ) - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & FileSystemDock : : _overwrite_dialog_action ) . bind ( false ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:28:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									overwrite_dialog - > connect ( SceneStringName ( confirmed ) ,  callable_mp ( this ,  & FileSystemDock : : _overwrite_dialog_action ) . bind ( true ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-29 18:03:11 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-18 00:09:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									VBoxContainer  * overwrite_dialog_vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog - > add_child ( overwrite_dialog_vb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog_header  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog_vb - > add_child ( overwrite_dialog_header ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog_scroll  =  memnew ( ScrollContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog_vb - > add_child ( overwrite_dialog_scroll ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog_scroll - > set_custom_minimum_size ( Vector2 ( 400 ,  600 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog_file_list  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog_scroll - > add_child ( overwrite_dialog_file_list ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog_footer  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									overwrite_dialog_vb - > add_child ( overwrite_dialog_footer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 18:15:57 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									make_dir_dialog  =  memnew ( DirectoryCreateDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-01 23:33:43 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_child ( make_dir_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-12 02:11:52 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									make_scene_dialog  =  memnew ( SceneCreateDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 19:47:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_child ( make_scene_dialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:28:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									make_scene_dialog - > connect ( SceneStringName ( confirmed ) ,  callable_mp ( this ,  & FileSystemDock : : _make_scene_confirm ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-15 19:47:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-24 14:37:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									make_script_dialog  =  memnew ( ScriptCreateDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									make_script_dialog - > set_title ( TTRC ( " Create Script " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-24 14:37:55 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_child ( make_script_dialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-25 00:18:10 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-03 17:45:32 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									make_shader_dialog  =  memnew ( ShaderCreateDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									add_child ( make_shader_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-22 21:23:40 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									new_resource_dialog  =  memnew ( CreateDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									add_child ( new_resource_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									new_resource_dialog - > set_base_type ( " Resource " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									new_resource_dialog - > connect ( " create " ,  callable_mp ( this ,  & FileSystemDock : : _resource_created ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-22 21:23:40 +05:30 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									conversion_dialog  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									add_child ( conversion_dialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-03-25 00:27:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									conversion_dialog - > set_ok_button_text ( TTRC ( " Convert " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-09 19:39:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									conversion_dialog - > connect ( SceneStringName ( confirmed ) ,  callable_mp ( this ,  & FileSystemDock : : _convert_dialog_action ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-14 00:16:43 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									uncollapsed_paths_before_search  =  Vector < String > ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-12 13:10:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									tree_update_id  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-23 20:15:56 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									history_pos  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-03 21:35:18 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									history_max_size  =  20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									history . push_back ( " res:// " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-15 20:25:51 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-25 23:39:49 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									display_mode  =  DISPLAY_MODE_TREE_ONLY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									old_display_mode  =  DISPLAY_MODE_TREE_ONLY ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-13 19:05:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									file_list_display_mode  =  FILE_LIST_DISPLAY_THUMBNAILS ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-11 12:20:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ProjectSettings : : get_singleton ( ) - > connect ( " settings_changed " ,  callable_mp ( this ,  & FileSystemDock : : _project_settings_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 23:44:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_resource_tooltip_plugin ( memnew ( EditorTextureTooltipPlugin ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-12 22:39:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									add_resource_tooltip_plugin ( memnew ( EditorAudioStreamTooltipPlugin ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-16 19:48:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 10:34:57 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								FileSystemDock : : ~ FileSystemDock ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 21:08:55 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									singleton  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-16 19:48:23 +08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								}