2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/*************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*  project_manager.cpp                                                  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                       This file is part of:                           */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                           GODOT ENGINE                                */  
						 
					
						
							
								
									
										
										
										
											2017-08-27 14:16:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/*                      https://godotengine.org                          */  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/*************************************************************************/  
						 
					
						
							
								
									
										
										
										
											2020-01-01 11:16:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.                 */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/*                                                                       */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* 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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "project_manager.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-01-16 08:04:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-11 18:13:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "core/io/config_file.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/io/resource_saver.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/io/stream_peer_ssl.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/io/zip_io.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/os/dir_access.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/os/file_access.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/os/keyboard.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/os/os.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/translation.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/version.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "core/version_hash.gen.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor_scale.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "editor_settings.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "editor_themes.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "scene/gui/center_container.h" 
  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "scene/gui/line_edit.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/margin_container.h" 
  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "scene/gui/panel_container.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/separator.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-01-14 10:52:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/texture_rect.h" 
  
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/tool_button.h" 
  
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-02 17:29:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Used to test for GLES3 support.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# ifndef SERVER_ENABLED 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "drivers/gles3/rasterizer_gles3.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  inline  String  get_project_key_from_path ( const  String  & dir )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  dir . replace ( " / " ,  " :: " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								class  ProjectDialog  :  public  ConfirmationDialog  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									GDCLASS ( ProjectDialog ,  ConfirmationDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									enum  Mode  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MODE_NEW , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MODE_IMPORT , 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										MODE_INSTALL , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MODE_RENAME 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								private :  
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									enum  MessageType  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MESSAGE_ERROR , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MESSAGE_WARNING , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MESSAGE_SUCCESS 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									enum  InputType  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										PROJECT_PATH , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										INSTALL_PATH 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Mode  mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * browse ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * install_browse ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * create_dir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Container  * name_container ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Container  * path_container ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Container  * install_path_container ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Container  * rasterizer_container ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < ButtonGroup >  rasterizer_button_group ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Label  * msg ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									LineEdit  * project_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									LineEdit  * project_name ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									LineEdit  * install_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TextureRect  * status_rect ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TextureRect  * install_status_rect ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									FileDialog  * fdialog ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									FileDialog  * fdialog_install ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  zip_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  zip_title ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									AcceptDialog  * dialog_error ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  fav_dir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  created_folder_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_message ( const  String  & p_msg ,  MessageType  p_type  =  MESSAGE_SUCCESS ,  InputType  input_type  =  PROJECT_PATH )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										msg - > set_text ( p_msg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Ref < Texture >  current_path_icon  =  status_rect - > get_texture ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Ref < Texture >  current_install_icon  =  install_status_rect - > get_texture ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Ref < Texture >  new_icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										switch  ( p_type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  MESSAGE_ERROR :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												msg - > add_color_override ( " font_color " ,  get_color ( " error_color " ,  " Editor " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												msg - > set_modulate ( Color ( 1 ,  1 ,  1 ,  1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												new_icon  =  get_icon ( " StatusError " ,  " EditorIcons " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  MESSAGE_WARNING :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												msg - > add_color_override ( " font_color " ,  get_color ( " warning_color " ,  " Editor " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												msg - > set_modulate ( Color ( 1 ,  1 ,  1 ,  1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												new_icon  =  get_icon ( " StatusWarning " ,  " EditorIcons " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  MESSAGE_SUCCESS :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												msg - > set_modulate ( Color ( 1 ,  1 ,  1 ,  0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												new_icon  =  get_icon ( " StatusSuccess " ,  " EditorIcons " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( current_path_icon  ! =  new_icon  & &  input_type  = =  PROJECT_PATH )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											status_rect - > set_texture ( new_icon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( current_install_icon  ! =  new_icon  & &  input_type  = =  INSTALL_PATH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											install_status_rect - > set_texture ( new_icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										set_size ( Size2 ( 500 ,  0 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-14 21:40:05 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  _test_path ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										DirAccess  * d  =  DirAccess : : create ( DirAccess : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  valid_path ,  valid_install_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( d - > change_dir ( project_path - > get_text ( ) )  = =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											valid_path  =  project_path - > get_text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( d - > change_dir ( project_path - > get_text ( ) . strip_edges ( ) )  = =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											valid_path  =  project_path - > get_text ( ) . strip_edges ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( project_path - > get_text ( ) . ends_with ( " .zip " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( d - > file_exists ( project_path - > get_text ( ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												valid_path  =  project_path - > get_text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( project_path - > get_text ( ) . strip_edges ( ) . ends_with ( " .zip " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( d - > file_exists ( project_path - > get_text ( ) . strip_edges ( ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												valid_path  =  project_path - > get_text ( ) . strip_edges ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-14 21:40:05 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( valid_path  = =  " " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-03 21:35:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											set_message ( TTR ( " The path specified doesn't exist. " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											memdelete ( d ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											get_ok ( ) - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-14 21:40:05 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  " " ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mode  = =  MODE_IMPORT  & &  valid_path . ends_with ( " .zip " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( d - > change_dir ( install_path - > get_text ( ) )  = =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												valid_install_path  =  install_path - > get_text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( d - > change_dir ( install_path - > get_text ( ) . strip_edges ( ) )  = =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												valid_install_path  =  install_path - > get_text ( ) . strip_edges ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( valid_install_path  = =  " " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-03 21:35:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												set_message ( TTR ( " The path specified doesn't exist. " ) ,  MESSAGE_ERROR ,  INSTALL_PATH ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												memdelete ( d ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												get_ok ( ) - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mode  = =  MODE_IMPORT  | |  mode  = =  MODE_RENAME )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( valid_path  ! =  " "  & &  ! d - > file_exists ( " project.godot " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( valid_path . ends_with ( " .zip " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													FileAccess  * src_f  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													zlib_filefunc_def  io  =  zipio_create_io_from_file ( & src_f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													unzFile  pkg  =  unzOpen2 ( valid_path . utf8 ( ) . get_data ( ) ,  & io ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ! pkg )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-03 21:35:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														set_message ( TTR ( " Error opening package file (it's not in ZIP format). " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														memdelete ( d ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														get_ok ( ) - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														unzClose ( pkg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  ret  =  unzGoToFirstFile ( pkg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													while  ( ret  = =  UNZ_OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														unz_file_info  info ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														char  fname [ 16384 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ret  =  unzGetCurrentFileInfo ( pkg ,  & info ,  fname ,  16384 ,  NULL ,  0 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( String ( fname ) . ends_with ( " project.godot " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ret  =  unzGoToNextFile ( pkg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ret  = =  UNZ_END_OF_LIST_OF_FILE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-03 21:35:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														set_message ( TTR ( " Invalid  \" .zip \"  project file; it doesn't contain a  \" project.godot \"  file. " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														memdelete ( d ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														get_ok ( ) - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														unzClose ( pkg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													unzClose ( pkg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// check if the specified install folder is empty, even though this is not an error, it is good to check here
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													d - > list_dir_begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bool  is_empty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													String  n  =  d - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													while  ( n  ! =  String ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-03 21:35:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ! n . begins_with ( " . " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															// Allow `.`, `..` (reserved current/parent folder names)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															// and hidden files/folders to be present.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															// For instance, this lets users initialize a Git repository
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															// and still be able to create a project in the directory afterwards.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															is_empty  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														n  =  d - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													d - > list_dir_end ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ! is_empty )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														set_message ( TTR ( " Please choose an empty folder. " ) ,  MESSAGE_WARNING ,  INSTALL_PATH ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														memdelete ( d ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														get_ok ( ) - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-03 21:35:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													set_message ( TTR ( " Please choose a  \" project.godot \"  or  \" .zip \"  file. " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													memdelete ( d ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													install_path_container - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													get_ok ( ) - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													return  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( valid_path . ends_with ( " zip " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-03 21:35:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												set_message ( TTR ( " This directory already contains a Godot project. " ) ,  MESSAGE_ERROR ,  INSTALL_PATH ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												memdelete ( d ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												get_ok ( ) - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-14 21:40:05 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  " " ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-28 20:36:24 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// check if the specified folder is empty, even though this is not an error, it is good to check here
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											d - > list_dir_begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  is_empty  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  n  =  d - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											while  ( n  ! =  String ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-03 21:35:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ! n . begins_with ( " . " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Allow `.`, `..` (reserved current/parent folder names)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// and hidden files/folders to be present.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// For instance, this lets users initialize a Git repository
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// and still be able to create a project in the directory afterwards.
 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													is_empty  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												n  =  d - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											d - > list_dir_end ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! is_empty )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-18 12:24:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												set_message ( TTR ( " Please choose an empty folder. " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												memdelete ( d ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-18 12:24:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												get_ok ( ) - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  " " ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										set_message ( " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										set_message ( " " ,  MESSAGE_SUCCESS ,  INSTALL_PATH ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										memdelete ( d ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_ok ( ) - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-14 21:40:05 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  valid_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  _path_text_changed ( const  String  & p_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  sp  =  _test_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( sp  ! =  " " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-14 23:53:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// If the project name is empty or default, infer the project name from the selected folder name
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( project_name - > get_text ( )  = =  " "  | |  project_name - > get_text ( )  = =  TTR ( " New Game Project " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												sp  =  sp . replace ( " \\ " ,  " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  lidx  =  sp . find_last ( " / " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( lidx  ! =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-14 23:53:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													sp  =  sp . substr ( lidx  +  1 ,  sp . length ( ) ) . capitalize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( sp  = =  " "  & &  mode  = =  MODE_IMPORT ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													sp  =  TTR ( " Imported Project " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												project_name - > set_text ( sp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 23:59:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												_text_changed ( sp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( created_folder_path  ! =  " "  & &  created_folder_path  ! =  p_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_remove_created_folder ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  _file_selected ( const  String  & p_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  p  =  p_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mode  = =  MODE_IMPORT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-01 17:44:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( p . ends_with ( " project.godot " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												p  =  p . get_base_dir ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												install_path_container - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												get_ok ( ) - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( p . ends_with ( " .zip " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												install_path - > set_text ( p . get_base_dir ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												install_path_container - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												get_ok ( ) - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-03 21:35:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												set_message ( TTR ( " Please choose a  \" project.godot \"  or  \" .zip \"  file. " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												get_ok ( ) - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  sp  =  p . simplify_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										project_path - > set_text ( sp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 23:59:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_path_text_changed ( sp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p . ends_with ( " .zip " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											install_path - > call_deferred ( " grab_focus " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											get_ok ( ) - > call_deferred ( " grab_focus " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  _path_selected ( const  String  & p_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-10 05:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  sp  =  p_path . simplify_path ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										project_path - > set_text ( sp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 23:59:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_path_text_changed ( sp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-06 12:41:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										get_ok ( ) - > call_deferred ( " grab_focus " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  _install_path_selected ( const  String  & p_path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-10 05:13:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  sp  =  p_path . simplify_path ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										install_path - > set_text ( sp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_path_text_changed ( sp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_ok ( ) - > call_deferred ( " grab_focus " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									void  _browse_path ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fdialog - > set_current_dir ( project_path - > get_text ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mode  = =  MODE_IMPORT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											fdialog - > set_mode ( FileDialog : : MODE_OPEN_FILE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											fdialog - > clear_filters ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-16 13:18:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											fdialog - > add_filter ( vformat ( " project.godot ; %s %s " ,  VERSION_NAME ,  TTR ( " Project " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 11:47:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											fdialog - > add_filter ( " *.zip ;  "  +  TTR ( " ZIP File " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											fdialog - > set_mode ( FileDialog : : MODE_OPEN_DIR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fdialog - > popup_centered_ratio ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  _browse_install_path ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fdialog_install - > set_current_dir ( install_path - > get_text ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fdialog_install - > set_mode ( FileDialog : : MODE_OPEN_DIR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fdialog_install - > popup_centered_ratio ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  _create_folder ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-01 21:07:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( project_name - > get_text ( )  = =  " "  | |  created_folder_path  ! =  " "  | |  project_name - > get_text ( ) . ends_with ( " . " )  | |  project_name - > get_text ( ) . ends_with ( "   " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											set_message ( TTR ( " Invalid Project Name. " ) ,  MESSAGE_WARNING ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-01 21:07:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										DirAccess  * d  =  DirAccess : : create ( DirAccess : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( d - > change_dir ( project_path - > get_text ( ) )  = =  OK )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! d - > dir_exists ( project_name - > get_text ( ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( d - > make_dir ( project_name - > get_text ( ) )  = =  OK )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													d - > change_dir ( project_name - > get_text ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 23:59:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													String  dir_str  =  d - > get_current_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													project_path - > set_text ( dir_str ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_path_text_changed ( dir_str ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													created_folder_path  =  d - > get_current_dir ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													create_dir - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													dialog_error - > set_text ( TTR ( " Couldn't create folder. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													dialog_error - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												dialog_error - > set_text ( TTR ( " There is already a folder in this path with the specified name. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												dialog_error - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										memdelete ( d ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  _text_changed ( const  String  & p_text )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( mode  ! =  MODE_NEW ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_test_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( p_text  = =  " " ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-28 15:57:33 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											set_message ( TTR ( " It would be a good idea to name your project. " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  ok_pressed ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  dir  =  project_path - > get_text ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mode  = =  MODE_RENAME )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-12 21:10:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											String  dir2  =  _test_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( dir2  = =  " " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												set_message ( TTR ( " Invalid project path (changed anything?). " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ProjectSettings  * current  =  memnew ( ProjectSettings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-12 21:10:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  err  =  current - > setup ( dir2 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-19 14:53:59 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( err  ! =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												set_message ( vformat ( TTR ( " Couldn't load project.godot in project path (error %d). It may be missing or corrupted. " ) ,  err ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ProjectSettings : : CustomMap  edited_settings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												edited_settings [ " application/config/name " ]  =  project_name - > get_text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-12 21:10:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( current - > save_custom ( dir2 . plus_file ( " project.godot " ) ,  edited_settings ,  Vector < String > ( ) ,  true )  ! =  OK )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													set_message ( TTR ( " Couldn't edit project.godot in project path. " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( " projects_updated " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( mode  = =  MODE_IMPORT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( project_path - > get_text ( ) . ends_with ( " .zip " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													mode  =  MODE_INSTALL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ok_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( mode  = =  MODE_NEW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-26 15:28:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ProjectSettings : : CustomMap  initial_settings ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( rasterizer_button_group - > get_pressed_button ( ) - > get_meta ( " driver_name " )  = =  " GLES3 " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														initial_settings [ " rendering/quality/driver/driver_name " ]  =  " GLES3 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														initial_settings [ " rendering/quality/driver/driver_name " ]  =  " GLES2 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														initial_settings [ " rendering/vram_compression/import_etc2 " ]  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														initial_settings [ " rendering/vram_compression/import_etc " ]  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													initial_settings [ " application/config/name " ]  =  project_name - > get_text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													initial_settings [ " application/config/icon " ]  =  " res://icon.png " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													initial_settings [ " rendering/environment/default_environment " ]  =  " res://default_env.tres " ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-28 21:46:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ProjectSettings : : get_singleton ( ) - > save_custom ( dir . plus_file ( " project.godot " ) ,  initial_settings ,  Vector < String > ( ) ,  false )  ! =  OK )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														set_message ( TTR ( " Couldn't create project.godot in project path. " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-28 21:46:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ResourceSaver : : save ( dir . plus_file ( " icon.png " ) ,  get_icon ( " DefaultProjectIcon " ,  " EditorIcons " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														FileAccess  * f  =  FileAccess : : open ( dir . plus_file ( " default_env.tres " ) ,  FileAccess : : WRITE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ! f )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															set_message ( TTR ( " Couldn't create project.godot in project path. " ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															f - > store_line ( " [gd_resource type= \" Environment \"  load_steps=2 format=2] " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															f - > store_line ( " [sub_resource type= \" ProceduralSky \"  id=1] " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															f - > store_line ( " [resource] " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															f - > store_line ( " background_mode = 2 " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															f - > store_line ( " background_sky = SubResource( 1 ) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															memdelete ( f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-28 21:46:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  if  ( mode  = =  MODE_INSTALL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( project_path - > get_text ( ) . ends_with ( " .zip " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														dir  =  install_path - > get_text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														zip_path  =  project_path - > get_text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													FileAccess  * src_f  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													zlib_filefunc_def  io  =  zipio_create_io_from_file ( & src_f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													unzFile  pkg  =  unzOpen2 ( zip_path . utf8 ( ) . get_data ( ) ,  & io ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ! pkg )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 19:32:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														dialog_error - > set_text ( TTR ( " Error opening package file, not in ZIP format. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														dialog_error - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													int  ret  =  unzGoToFirstFile ( pkg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Vector < String >  failed_files ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													int  idx  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													while  ( ret  = =  UNZ_OK )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														//get filename
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														unz_file_info  info ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														char  fname [ 16384 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ret  =  unzGetCurrentFileInfo ( pkg ,  & info ,  fname ,  16384 ,  NULL ,  0 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														String  path  =  fname ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														int  depth  =  1 ;  //stuff from github comes with tag
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														bool  skip  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														while  ( depth  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															int  pp  =  path . find ( " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( pp  = =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																skip  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															path  =  path . substr ( pp  +  1 ,  path . length ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															depth - - ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( skip  | |  path  = =  String ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															//
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  if  ( path . ends_with ( " / " ) )  {  // a dir
 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															path  =  path . substr ( 0 ,  path . length ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															DirAccess  * da  =  DirAccess : : create ( DirAccess : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															da - > make_dir ( dir . plus_file ( path ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															memdelete ( da ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															Vector < uint8_t >  data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															data . resize ( info . uncompressed_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															//read
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															unzOpenCurrentFile ( pkg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-25 00:07:54 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															unzReadCurrentFile ( pkg ,  data . ptrw ( ) ,  data . size ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															unzCloseCurrentFile ( pkg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															FileAccess  * f  =  FileAccess : : open ( dir . plus_file ( path ) ,  FileAccess : : WRITE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															if  ( f )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																f - > store_buffer ( data . ptr ( ) ,  data . size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																memdelete ( f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																failed_files . push_back ( path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														idx + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ret  =  unzGoToNextFile ( pkg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													unzClose ( pkg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( failed_files . size ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														String  msg  =  TTR ( " The following files failed extraction from package: " )  +  " \n \n " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														for  ( int  i  =  0 ;  i  <  failed_files . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															if  ( i  >  15 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																msg  + =  " \n And  "  +  itos ( failed_files . size ( )  -  i )  +  "  more files. " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															msg  + =  failed_files [ i ]  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														dialog_error - > set_text ( msg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														dialog_error - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  if  ( ! project_path - > get_text ( ) . ends_with ( " .zip " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														dialog_error - > set_text ( TTR ( " Package installed successfully! " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														dialog_error - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											dir  =  dir . replace ( " \\ " ,  " / " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( dir . ends_with ( " / " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												dir  =  dir . substr ( 0 ,  dir . length ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											String  proj  =  get_project_key_from_path ( dir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorSettings : : get_singleton ( ) - > set ( " projects/ "  +  proj ,  dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorSettings : : get_singleton ( ) - > save ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											emit_signal ( " project_created " ,  dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  _remove_created_folder ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( created_folder_path  ! =  " " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DirAccess  * d  =  DirAccess : : create ( DirAccess : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											d - > remove ( created_folder_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											memdelete ( d ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											create_dir - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											created_folder_path  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  cancel_pressed ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_remove_created_folder ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										project_path - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 23:59:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_path_text_changed ( " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										project_name - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 23:59:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_text_changed ( " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( status_rect - > get_texture ( )  = =  get_icon ( " StatusError " ,  " EditorIcons " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											msg - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( install_status_rect - > get_texture ( )  = =  get_icon ( " StatusError " ,  " EditorIcons " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											msg - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  _notification ( int  p_what )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( p_what  = =  MainLoop : : NOTIFICATION_WM_QUIT_REQUEST ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_remove_created_folder ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								protected :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  void  _bind_methods ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ClassDB : : bind_method ( " _browse_path " ,  & ProjectDialog : : _browse_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ClassDB : : bind_method ( " _create_folder " ,  & ProjectDialog : : _create_folder ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ClassDB : : bind_method ( " _text_changed " ,  & ProjectDialog : : _text_changed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ClassDB : : bind_method ( " _path_text_changed " ,  & ProjectDialog : : _path_text_changed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ClassDB : : bind_method ( " _path_selected " ,  & ProjectDialog : : _path_selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ClassDB : : bind_method ( " _file_selected " ,  & ProjectDialog : : _file_selected ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ClassDB : : bind_method ( " _install_path_selected " ,  & ProjectDialog : : _install_path_selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ClassDB : : bind_method ( " _browse_install_path " ,  & ProjectDialog : : _browse_install_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ADD_SIGNAL ( MethodInfo ( " project_created " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ADD_SIGNAL ( MethodInfo ( " projects_updated " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_zip_path ( const  String  & p_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										zip_path  =  p_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_zip_title ( const  String  & p_title )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										zip_title  =  p_title ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_mode ( Mode  p_mode )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										mode  =  p_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  set_project_path ( const  String  & p_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										project_path - > set_text ( p_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  show_dialog ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mode  = =  MODE_RENAME )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											project_path - > set_editable ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											browse - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											install_browse - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											set_title ( TTR ( " Rename Project " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											get_ok ( ) - > set_text ( TTR ( " Rename " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											name_container - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-28 20:36:24 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											status_rect - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											msg - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											install_path_container - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											install_status_rect - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											rasterizer_container - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-28 20:36:24 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											get_ok ( ) - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ProjectSettings  * current  =  memnew ( ProjectSettings ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-02-19 14:53:59 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  err  =  current - > setup ( project_path - > get_text ( ) ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( err  ! =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												set_message ( vformat ( TTR ( " Couldn't load project.godot in project path (error %d). It may be missing or corrupted. " ) ,  err ) ,  MESSAGE_ERROR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-28 20:36:24 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												status_rect - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												msg - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												get_ok ( ) - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-05 15:34:34 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  if  ( current - > has_setting ( " application/config/name " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 23:59:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												String  proj  =  current - > get ( " application/config/name " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												project_name - > set_text ( proj ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												_text_changed ( proj ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-06 19:54:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-12-06 11:24:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											project_name - > call_deferred ( " grab_focus " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											create_dir - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											fav_dir  =  EditorSettings : : get_singleton ( ) - > get ( " filesystem/directories/default_project_path " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( fav_dir  ! =  " " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												project_path - > set_text ( fav_dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												fdialog - > set_current_dir ( fav_dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												DirAccess  * d  =  DirAccess : : create ( DirAccess : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												project_path - > set_text ( d - > get_current_dir ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												fdialog - > set_current_dir ( d - > get_current_dir ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												memdelete ( d ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 23:59:11 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											String  proj  =  TTR ( " New Game Project " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											project_name - > set_text ( proj ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_text_changed ( proj ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											project_path - > set_editable ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											browse - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											browse - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											install_browse - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											install_browse - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											create_dir - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											status_rect - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											install_status_rect - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											msg - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( mode  = =  MODE_IMPORT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												set_title ( TTR ( " Import Existing Project " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-23 09:06:03 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												get_ok ( ) - > set_text ( TTR ( " Import & Edit " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												name_container - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												install_path_container - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												rasterizer_container - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												project_path - > grab_focus ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( mode  = =  MODE_NEW )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												set_title ( TTR ( " Create New Project " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-23 09:06:03 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												get_ok ( ) - > set_text ( TTR ( " Create & Edit " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												name_container - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												install_path_container - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												rasterizer_container - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-26 15:56:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												project_name - > call_deferred ( " grab_focus " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												project_name - > call_deferred ( " select_all " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( mode  = =  MODE_INSTALL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												set_title ( TTR ( " Install Project: " )  +  "   "  +  zip_title ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-23 09:06:03 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												get_ok ( ) - > set_text ( TTR ( " Install & Edit " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-05 15:11:46 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												project_name - > set_text ( zip_title ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-18 03:02:00 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												name_container - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												install_path_container - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												rasterizer_container - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												project_path - > grab_focus ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_test_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-12 18:28:38 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Reset the dialog to its initial size. Otherwise, the dialog window would be too large
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// when opening a small dialog after closing a large dialog.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_size ( get_minimum_size ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										popup_centered_minsize ( Size2 ( 500 ,  0 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ProjectDialog ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										VBoxContainer  * vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										add_child ( vb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name_container  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										vb - > add_child ( name_container ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Label  * l  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										l - > set_text ( TTR ( " Project Name: " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name_container - > add_child ( l ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										HBoxContainer  * pnhb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										name_container - > add_child ( pnhb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										project_name  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										project_name - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										pnhb - > add_child ( project_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										create_dir  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										pnhb - > add_child ( create_dir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 01:54:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										create_dir - > set_text ( TTR ( " Create Folder " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										create_dir - > connect ( " pressed " ,  this ,  " _create_folder " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										path_container  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										vb - > add_child ( path_container ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										l  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										l - > set_text ( TTR ( " Project Path: " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										path_container - > add_child ( l ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										HBoxContainer  * pphb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										path_container - > add_child ( pphb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										project_path  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										project_path - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										pphb - > add_child ( project_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										install_path_container  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										vb - > add_child ( install_path_container ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										l  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										l - > set_text ( TTR ( " Project Installation Path: " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										install_path_container - > add_child ( l ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										HBoxContainer  * iphb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										install_path_container - > add_child ( iphb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										install_path  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										install_path - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										iphb - > add_child ( install_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-28 20:36:24 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// status icon
 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-17 14:45:09 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										status_rect  =  memnew ( TextureRect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										status_rect - > set_stretch_mode ( TextureRect : : STRETCH_KEEP_CENTERED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										pphb - > add_child ( status_rect ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										browse  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										browse - > set_text ( TTR ( " Browse " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										browse - > connect ( " pressed " ,  this ,  " _browse_path " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										pphb - > add_child ( browse ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// install status icon
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										install_status_rect  =  memnew ( TextureRect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										install_status_rect - > set_stretch_mode ( TextureRect : : STRETCH_KEEP_CENTERED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										iphb - > add_child ( install_status_rect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										install_browse  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										install_browse - > set_text ( TTR ( " Browse " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										install_browse - > connect ( " pressed " ,  this ,  " _browse_install_path " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										iphb - > add_child ( install_browse ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										msg  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										msg - > set_align ( Label : : ALIGN_CENTER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										vb - > add_child ( msg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// rasterizer selection
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rasterizer_container  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										vb - > add_child ( rasterizer_container ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										l  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										l - > set_text ( TTR ( " Renderer: " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rasterizer_container - > add_child ( l ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Container  * rshb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rasterizer_container - > add_child ( rshb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rasterizer_button_group . instance ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-02 17:29:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Enable GLES3 by default as it's the default value for the project setting.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# ifndef SERVER_ENABLED 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  gles3_viable  =  RasterizerGLES3 : : is_viable ( )  = =  OK ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# else 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Whatever, project manager isn't even used in headless builds.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  gles3_viable  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Container  * rvb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rvb - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rshb - > add_child ( rvb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Button  * rs_button  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rs_button - > set_button_group ( rasterizer_button_group ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rs_button - > set_text ( TTR ( " OpenGL ES 3.0 " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rs_button - > set_meta ( " driver_name " ,  " GLES3 " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rvb - > add_child ( rs_button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-11 17:35:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( gles3_viable )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											rs_button - > set_pressed ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// If GLES3 can't be used, don't let users shoot themselves in the foot.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											rs_button - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											l  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											l - > set_text ( TTR ( " Not supported by your GPU drivers. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											rvb - > add_child ( l ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-02 17:29:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										l  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										l - > set_text ( TTR ( " Higher visual quality \n All features available \n Incompatible with older hardware \n Not recommended for web games " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rvb - > add_child ( l ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rshb - > add_child ( memnew ( VSeparator ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rvb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rvb - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rshb - > add_child ( rvb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rs_button  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rs_button - > set_button_group ( rasterizer_button_group ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rs_button - > set_text ( TTR ( " OpenGL ES 2.0 " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rs_button - > set_meta ( " driver_name " ,  " GLES2 " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-02 17:29:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										rs_button - > set_pressed ( ! gles3_viable ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-22 00:59:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										rvb - > add_child ( rs_button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										l  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										l - > set_text ( TTR ( " Lower visual quality \n Some features not available \n Works on most hardware \n Recommended for web games " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rvb - > add_child ( l ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										l  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										l - > set_text ( TTR ( " Renderer can be changed later, but scenes may need to be adjusted. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										l - > set_align ( Label : : ALIGN_CENTER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rasterizer_container - > add_child ( l ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fdialog  =  memnew ( FileDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										fdialog - > set_access ( FileDialog : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fdialog_install  =  memnew ( FileDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fdialog_install - > set_access ( FileDialog : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										add_child ( fdialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										add_child ( fdialog_install ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										project_name - > connect ( " text_changed " ,  this ,  " _text_changed " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										project_path - > connect ( " text_changed " ,  this ,  " _path_text_changed " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										install_path - > connect ( " text_changed " ,  this ,  " _path_text_changed " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fdialog - > connect ( " dir_selected " ,  this ,  " _path_selected " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fdialog - > connect ( " file_selected " ,  this ,  " _file_selected " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 00:17:52 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fdialog_install - > connect ( " dir_selected " ,  this ,  " _install_path_selected " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fdialog_install - > connect ( " file_selected " ,  this ,  " _install_path_selected " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										set_hide_on_ok ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										mode  =  MODE_NEW ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										dialog_error  =  memnew ( AcceptDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										add_child ( dialog_error ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								class  ProjectListItemControl  :  public  HBoxContainer  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									GDCLASS ( ProjectListItemControl ,  HBoxContainer ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TextureButton  * favorite_button ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TextureRect  * icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  icon_needs_reload ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 02:31:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  hover ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ProjectListItemControl ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										favorite_button  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										icon  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										icon_needs_reload  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 02:31:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										hover  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-29 20:21:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_focus_mode ( FocusMode : : FOCUS_ALL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  set_is_favorite ( bool  fav )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										favorite_button - > set_modulate ( fav  ?  Color ( 1 ,  1 ,  1 ,  1 )  :  Color ( 1 ,  1 ,  1 ,  0.2 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 02:31:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  _notification ( int  p_what )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch  ( p_what )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  NOTIFICATION_MOUSE_ENTER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												hover  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  NOTIFICATION_MOUSE_EXIT :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												hover  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  NOTIFICATION_DRAW :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( hover )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													draw_style_box ( get_stylebox ( " hover " ,  " Tree " ) ,  Rect2 ( Point2 ( ) ,  get_size ( )  -  Size2 ( 10 ,  0 )  *  EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class  ProjectList  :  public  ScrollContainer  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									GDCLASS ( ProjectList ,  ScrollContainer ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  const  char  * SIGNAL_SELECTION_CHANGED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  const  char  * SIGNAL_PROJECT_ASK_OPEN ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:57:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									enum  MenuOptions  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										GLOBAL_NEW_WINDOW , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										GLOBAL_OPEN_PROJECT 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Can often be passed by copy
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									struct  Item  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  project_key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  project_name ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-17 18:20:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  description ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  main_scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uint64_t  last_modified ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  favorite ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  grayed ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  missing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  version ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ProjectListItemControl  * control ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Item ( )  { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Item ( const  String  & p_project , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  String  & p_name , 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-17 18:20:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												const  String  & p_description , 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												const  String  & p_path , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  String  & p_icon , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  String  & p_main_scene , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uint64_t  p_last_modified , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												bool  p_favorite , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												bool  p_grayed , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												bool  p_missing , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  p_version )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											project_key  =  p_project ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											project_name  =  p_name ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-17 18:20:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											description  =  p_description ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											path  =  p_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											icon  =  p_icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											main_scene  =  p_main_scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											last_modified  =  p_last_modified ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											favorite  =  p_favorite ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											grayed  =  p_grayed ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											missing  =  p_missing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											version  =  p_version ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											control  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_FORCE_INLINE_  bool  operator = = ( const  Item  & l )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  project_key  = =  l . project_key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ProjectList ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									~ ProjectList ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-24 13:25:21 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  update_dock_menu ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  load_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  set_search_term ( String  p_search_term ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  set_order_option ( ProjectListFilter : : FilterOption  p_option ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  sort_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  get_project_count ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  select_project ( int  p_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  erase_selected_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector < Item >  get_selected_projects ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Set < String >  & get_selected_project_keys ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  ensure_project_visible ( int  p_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  get_single_selected_index ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  is_any_project_missing ( )  const ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  erase_missing_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  refresh_project ( const  String  & dir_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								private :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  void  _bind_methods ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  _notification ( int  p_what ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  _panel_draw ( Node  * p_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  _panel_input ( const  Ref < InputEvent >  & p_ev ,  Node  * p_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  _favorite_pressed ( Node  * p_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  _show_project ( const  String  & p_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  select_range ( int  p_begin ,  int  p_end ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  toggle_select ( int  p_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  create_project_item_control ( int  p_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  remove_project ( int  p_index ,  bool  p_update_settings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  update_icons_async ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									void  load_project_icon ( int  p_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  void  load_project_data ( const  String  & p_property_key ,  Item  & p_item ,  bool  p_favorite ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  _search_term ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ProjectListFilter : : FilterOption  _order_option ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Set < String >  _selected_project_keys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  _last_clicked ;  // Project key
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VBoxContainer  * _scroll_children ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  _icon_load_index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector < Item >  _projects ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								struct  ProjectListComparator  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ProjectListFilter : : FilterOption  order_option ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// operator<
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_FORCE_INLINE_  bool  operator ( ) ( const  ProjectList : : Item  & a ,  const  ProjectList : : Item  & b )  const  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( a . favorite  & &  ! b . favorite )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( b . favorite  & &  ! a . favorite )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch  ( order_option )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-18 01:37:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  ProjectListFilter : : FILTER_PATH : 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  a . project_key  <  b . project_key ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-18 01:37:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  ProjectListFilter : : FILTER_MODIFIED : 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  a . last_modified  >  b . last_modified ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-18 01:37:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											default : 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  a . project_name  <  b . project_name ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-18 01:37:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-01 19:30:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ProjectList : : ProjectList ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_order_option  =  ProjectListFilter : : FILTER_MODIFIED ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-14 16:31:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_scroll_children  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_scroll_children - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( _scroll_children ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 15:31:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_icon_load_index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-11-26 15:31:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ProjectList : : ~ ProjectList ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : update_icons_async ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_icon_load_index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_process ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-06-09 22:33:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : _notification ( int  p_what )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_what  = =  NOTIFICATION_PROCESS )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Load icons as a coroutine to speed up launch when you have hundreds of projects
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( _icon_load_index  <  _projects . size ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Item  & item  =  _projects . write [ _icon_load_index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( item . control - > icon_needs_reload )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												load_project_icon ( _icon_load_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_icon_load_index + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											set_process ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-14 16:31:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : load_project_icon ( int  p_index )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Item  & item  =  _projects . write [ p_index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < Texture >  default_icon  =  get_icon ( " DefaultProjectIcon " ,  " EditorIcons " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < Texture >  icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( item . icon  ! =  " " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Ref < Image >  img ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										img . instance ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Error  err  =  img - > load ( item . icon . replace_first ( " res:// " ,  item . path  +  " / " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( err  = =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 22:08:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											img - > resize ( default_icon - > get_width ( ) ,  default_icon - > get_height ( ) ,  Image : : INTERPOLATE_LANCZOS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Ref < ImageTexture >  it  =  memnew ( ImageTexture ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											it - > create_from_image ( img ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											icon  =  it ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( icon . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										icon  =  default_icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-09 22:33:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									item . control - > icon - > set_texture ( icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									item . control - > icon_needs_reload  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-09 22:33:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : load_project_data ( const  String  & p_property_key ,  Item  & p_item ,  bool  p_favorite )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  path  =  EditorSettings : : get_singleton ( ) - > get ( p_property_key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  conf  =  path . plus_file ( " project.godot " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  grayed  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  missing  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < ConfigFile >  cf  =  memnew ( ConfigFile ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Error  cf_err  =  cf - > load ( conf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  config_version  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  project_name  =  TTR ( " Unnamed Project " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( cf_err  = =  OK )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  cf_project_name  =  static_cast < String > ( cf - > get_value ( " application " ,  " config/name " ,  " " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( cf_project_name  ! =  " " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											project_name  =  cf_project_name . xml_unescape ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										config_version  =  ( int ) cf - > get_value ( " " ,  " config_version " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( config_version  >  ProjectSettings : : CONFIG_VERSION )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Comes from an incompatible (more recent) Godot version, grey it out
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										grayed  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-17 18:20:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  description  =  cf - > get_value ( " application " ,  " config/description " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  icon  =  cf - > get_value ( " application " ,  " config/icon " ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  main_scene  =  cf - > get_value ( " application " ,  " run/main_scene " ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uint64_t  last_modified  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( FileAccess : : exists ( conf ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										last_modified  =  FileAccess : : get_modified_time ( conf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  fscache  =  path . plus_file ( " .fscache " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( FileAccess : : exists ( fscache ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uint64_t  cache_modified  =  FileAccess : : get_modified_time ( fscache ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( cache_modified  >  last_modified ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												last_modified  =  cache_modified ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										grayed  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										missing  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										print_line ( " Project is missing:  "  +  conf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  project_key  =  p_property_key . get_slice ( " / " ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-17 18:20:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									p_item  =  Item ( project_key ,  project_name ,  description ,  path ,  icon ,  main_scene ,  last_modified ,  p_favorite ,  grayed ,  missing ,  config_version ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : load_projects ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// This is a full, hard reload of the list. Don't call this unless really required, it's expensive.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// If you have 150 projects, it may read through 150 files on your disk at once + load 150 icons.
 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-05 16:06:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Clear whole list
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Item  & project  =  _projects . write [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CRASH_COND ( project . control  = =  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										memdelete ( project . control ) ;  // Why not queue_free()?
 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-31 01:04:16 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_projects . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_last_clicked  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_selected_project_keys . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-05 16:06:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Load data
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// TODO Would be nice to change how projects and favourites are stored... it complicates things a bit.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Use a dictionary associating project path to metadata (like is_favorite).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									List < PropertyInfo >  properties ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									EditorSettings : : get_singleton ( ) - > get_property_list ( & properties ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Set < String >  favorites ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Find favourites...
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( List < PropertyInfo > : : Element  * E  =  properties . front ( ) ;  E ;  E  =  E - > next ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  property_key  =  E - > get ( ) . name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( property_key . begins_with ( " favorite_projects/ " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											favorites . insert ( property_key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( List < PropertyInfo > : : Element  * E  =  properties . front ( ) ;  E ;  E  =  E - > next ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// This is actually something like "projects/C:::Documents::Godot::Projects::MyGame"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  property_key  =  E - > get ( ) . name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! property_key . begins_with ( " projects/ " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  project_key  =  property_key . get_slice ( " / " ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  favorite  =  favorites . has ( " favorite_projects/ "  +  project_key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Item  item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										load_project_data ( property_key ,  item ,  favorite ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_projects . push_back ( item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Create controls
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										create_project_item_control ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sort_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_v_scroll ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_icons_async ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-24 13:25:21 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_dock_menu ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ProjectList : : update_dock_menu ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									OS : : get_singleton ( ) - > global_menu_clear ( " _dock " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  favs_added  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  total_added  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! _projects [ i ] . grayed  & &  ! _projects [ i ] . missing )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( _projects [ i ] . favorite )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												favs_added + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( favs_added  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													OS : : get_singleton ( ) - > global_menu_add_separator ( " _dock " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												favs_added  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											OS : : get_singleton ( ) - > global_menu_add_item ( " _dock " ,  _projects [ i ] . project_name  +  "  (  "  +  _projects [ i ] . path  +  "  ) " ,  GLOBAL_OPEN_PROJECT ,  Variant ( _projects [ i ] . path . plus_file ( " project.godot " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											total_added + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( total_added  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										OS : : get_singleton ( ) - > global_menu_add_separator ( " _dock " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									OS : : get_singleton ( ) - > global_menu_add_item ( " _dock " ,  TTR ( " New Window " ) ,  GLOBAL_NEW_WINDOW ,  Variant ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 03:33:59 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : create_project_item_control ( int  p_index )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Will be added last in the list, so make sure indexes match
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND ( p_index  ! =  _scroll_children - > get_child_count ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-20 12:38:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Item  & item  =  _projects . write [ p_index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND ( item . control  ! =  NULL ) ;  // Already created
 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Texture >  favorite_icon  =  get_icon ( " Favorites " ,  " EditorIcons " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Color  font_color  =  get_color ( " font_color " ,  " Tree " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ProjectListItemControl  * hb  =  memnew ( ProjectListItemControl ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > connect ( " draw " ,  this ,  " _panel_draw " ,  varray ( hb ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > connect ( " gui_input " ,  this ,  " _panel_input " ,  varray ( hb ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > add_constant_override ( " separation " ,  10  *  EDSCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-17 18:20:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hb - > set_tooltip ( item . description ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VBoxContainer  * favorite_box  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									favorite_box - > set_name ( " FavoriteBox " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TextureButton  * favorite  =  memnew ( TextureButton ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									favorite - > set_name ( " FavoriteButton " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									favorite - > set_normal_texture ( favorite_icon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 02:31:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// This makes the project's "hover" style display correctly when hovering the favorite icon
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									favorite - > set_mouse_filter ( MOUSE_FILTER_PASS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									favorite - > connect ( " pressed " ,  this ,  " _favorite_pressed " ,  varray ( hb ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									favorite_box - > add_child ( favorite ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									favorite_box - > set_alignment ( BoxContainer : : ALIGN_CENTER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > add_child ( favorite_box ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > favorite_button  =  favorite ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > set_is_favorite ( item . favorite ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TextureRect  * tf  =  memnew ( TextureRect ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-21 22:56:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// The project icon may not be loaded by the time the control is displayed,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// so use a loading placeholder.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tf - > set_texture ( get_icon ( " ProjectIconLoading " ,  " EditorIcons " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-06 10:56:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									tf - > set_v_size_flags ( SIZE_SHRINK_CENTER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 22:35:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( item . missing )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										tf - > set_modulate ( Color ( 1 ,  1 ,  1 ,  0.5 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hb - > add_child ( tf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > icon  =  tf ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-01 21:47:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VBoxContainer  * vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( item . grayed ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 22:35:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										vb - > set_modulate ( Color ( 1 ,  1 ,  1 ,  0.5 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									vb - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > add_child ( vb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Control  * ec  =  memnew ( Control ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ec - > set_custom_minimum_size ( Size2 ( 0 ,  1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ec - > set_mouse_filter ( MOUSE_FILTER_PASS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vb - > add_child ( ec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 22:35:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Label  * title  =  memnew ( Label ( ! item . missing  ?  item . project_name  :  TTR ( " Missing Project " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									title - > add_font_override ( " font " ,  get_font ( " title " ,  " EditorFonts " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									title - > add_color_override ( " font_color " ,  font_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									title - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vb - > add_child ( title ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									HBoxContainer  * path_hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									path_hb - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vb - > add_child ( path_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Button  * show  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 22:35:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Display a folder icon if the project directory can be opened, or a "broken file" icon if it can't
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									show - > set_icon ( get_icon ( ! item . missing  ?  " Load "  :  " FileBroken " ,  " EditorIcons " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									show - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 22:35:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! item . grayed )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Don't make the icon less prominent if the parent is already grayed out
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										show - > set_modulate ( Color ( 1 ,  1 ,  1 ,  0.5 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									path_hb - > add_child ( show ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 22:35:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! item . missing )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										show - > connect ( " pressed " ,  this ,  " _show_project " ,  varray ( item . path ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										show - > set_tooltip ( TTR ( " Show in File Manager " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										show - > set_tooltip ( TTR ( " Error: Project is missing on the filesystem. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Label  * fpath  =  memnew ( Label ( item . path ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									path_hb - > add_child ( fpath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fpath - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fpath - > set_modulate ( Color ( 1 ,  1 ,  1 ,  0.5 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fpath - > add_color_override ( " font_color " ,  font_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fpath - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_scroll_children - > add_child ( hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									item . control  =  hb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-05-01 21:47:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : set_search_term ( String  p_search_term )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_search_term  =  p_search_term ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-05-01 21:47:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : set_order_option ( ProjectListFilter : : FilterOption  p_option )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( _order_option  ! =  p_option )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_order_option  =  p_option ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 13:09:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorSettings : : get_singleton ( ) - > set ( " project_manager/sorting_order " ,  ( int ) _order_option ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorSettings : : get_singleton ( ) - > save ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-05-01 21:47:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : sort_projects ( )  {  
						 
					
						
							
								
									
										
										
										
											2014-05-01 21:47:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SortArray < Item ,  ProjectListComparator >  sorter ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sorter . compare . order_option  =  _order_option ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sorter . sort ( _projects . ptrw ( ) ,  _projects . size ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-01 21:47:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Item  & item  =  _projects . write [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-01 21:47:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bool  visible  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( _search_term  ! =  " " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  search_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( _search_term . find ( " / " )  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Search path will match the whole path
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												search_path  =  item . path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Search path will only match the last path component to make searching more strict
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												search_path  =  item . path . get_file ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-01 21:47:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// When searching, display projects whose name or path contain the search term
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											visible  =  item . project_name . findn ( _search_term )  ! =  - 1  | |  search_path . findn ( _search_term )  ! =  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-01 21:47:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										item . control - > set_visible ( visible ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Item  & item  =  _projects . write [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-30 17:04:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										item . control - > get_parent ( ) - > move_child ( item . control ,  i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Rewind the coroutine because order of projects changed
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_icons_async ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-24 13:25:21 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_dock_menu ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								const  Set < String >  & ProjectList : : get_selected_project_keys ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Faster if that's all you need
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  _selected_project_keys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Vector < ProjectList : : Item >  ProjectList : : get_selected_projects ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector < Item >  items ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( _selected_project_keys . size ( )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  items ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									items . resize ( _selected_project_keys . size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  j  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  Item  & item  =  _projects [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( _selected_project_keys . has ( item . project_key ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											items . write [ j + + ]  =  item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND_V ( j  ! =  items . size ( ) ,  items ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  items ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : ensure_project_visible ( int  p_index )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Item  & item  =  _projects [ p_index ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  item_top  =  item . control - > get_position ( ) . y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  item_bottom  =  item . control - > get_position ( ) . y  +  item . control - > get_size ( ) . y ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( item_top  <  get_v_scroll ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_v_scroll ( item_top ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-10 18:23:11 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  if  ( item_bottom  >  get_v_scroll ( )  +  get_size ( ) . y )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_v_scroll ( item_bottom  -  get_size ( ) . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  ProjectList : : get_single_selected_index ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( _selected_project_keys . size ( )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Default selection
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( _selected_project_keys . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Only one selected
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										key  =  _selected_project_keys . front ( ) - > get ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Multiple selected, consider the last clicked one as "main"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										key  =  _last_clicked ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( _projects [ i ] . project_key  = =  key )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : remove_project ( int  p_index ,  bool  p_update_settings )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Item  item  =  _projects [ p_index ] ;  // Take a copy
 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-05 16:06:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_selected_project_keys . erase ( item . project_key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-02 11:28:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( _last_clicked  = =  item . project_key )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_last_clicked  =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									memdelete ( item . control ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_projects . remove ( p_index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_update_settings )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorSettings : : get_singleton ( ) - > erase ( " projects/ "  +  item . project_key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorSettings : : get_singleton ( ) - > erase ( " favorite_projects/ "  +  item . project_key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Not actually saving the file, in case you are doing more changes to settings
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-24 13:25:21 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_dock_menu ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  ProjectList : : is_any_project_missing ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( _projects [ i ] . missing )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : erase_missing_projects ( )  {  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( _projects . empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  deleted_count  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  remaining_count  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  Item  & item  =  _projects [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( item . missing )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											remove_project ( i ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											- - i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											+ + deleted_count ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											+ + remaining_count ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									print_line ( " Removed  "  +  itos ( deleted_count )  +  "  projects from the list, remaining  "  +  itos ( remaining_count )  +  "  projects " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorSettings : : get_singleton ( ) - > save ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  ProjectList : : refresh_project ( const  String  & dir_path )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Reads editor settings and reloads information about a specific project.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// If it wasn't loaded and should be in the list, it is added (i.e new project).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// If it isn't in the list anymore, it is removed.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// If it is in the list but doesn't exist anymore, it is marked as missing.
 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  project_key  =  get_project_key_from_path ( dir_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Read project manager settings
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  is_favourite  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  should_be_in_list  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  property_key  =  " projects/ "  +  project_key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										List < PropertyInfo >  properties ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorSettings : : get_singleton ( ) - > get_property_list ( & properties ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  favorite_property_key  =  " favorite_projects/ "  +  project_key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  found  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( List < PropertyInfo > : : Element  * E  =  properties . front ( ) ;  E ;  E  =  E - > next ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  prop  =  E - > get ( ) . name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! found  & &  prop  = =  property_key )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												found  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( ! is_favourite  & &  prop  = =  favorite_property_key )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												is_favourite  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										should_be_in_list  =  found ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  was_selected  =  _selected_project_keys . has ( project_key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Remove item in any case
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  Item  & existing_item  =  _projects [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( existing_item . path  = =  dir_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											remove_project ( i ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-05 16:06:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  index  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( should_be_in_list )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Recreate it with updated info
 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Item  item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										load_project_data ( property_key ,  item ,  is_favourite ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_projects . push_back ( item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										create_project_item_control ( _projects . size ( )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										sort_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( _projects [ i ] . project_key  = =  project_key )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( was_selected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													select_project ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ensure_project_visible ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												load_project_icon ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-24 13:25:21 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												index  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  ProjectList : : get_project_count ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  _projects . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : select_project ( int  p_index )  {  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector < Item >  previous_selected_items  =  get_selected_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_selected_project_keys . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  previous_selected_items . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										previous_selected_items [ i ] . control - > update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									toggle_select ( p_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								inline  void  sort ( int  & a ,  int  & b )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( a  >  b )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  temp  =  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										a  =  b ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										b  =  temp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : select_range ( int  p_begin ,  int  p_end )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sort ( p_begin ,  p_end ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									select_project ( p_begin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  p_begin  +  1 ;  i  < =  p_end ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										toggle_select ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : toggle_select ( int  p_index )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Item  & item  =  _projects . write [ p_index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( _selected_project_keys . has ( item . project_key ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_selected_project_keys . erase ( item . project_key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_selected_project_keys . insert ( item . project_key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									item . control - > update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-08-05 16:06:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : erase_selected_projects ( )  {  
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( _selected_project_keys . size ( )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Item  & item  =  _projects . write [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( _selected_project_keys . has ( item . project_key )  & &  item . control - > is_visible ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorSettings : : get_singleton ( ) - > erase ( " projects/ "  +  item . project_key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorSettings : : get_singleton ( ) - > erase ( " favorite_projects/ "  +  item . project_key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											memdelete ( item . control ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_projects . remove ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											- - i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									EditorSettings : : get_singleton ( ) - > save ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_selected_project_keys . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_last_clicked  =  " " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-24 13:25:21 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_dock_menu ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Draws selected project highlight
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ProjectList : : _panel_draw ( Node  * p_hb )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Control  * hb  =  Object : : cast_to < Control > ( p_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > draw_line ( Point2 ( 0 ,  hb - > get_size ( ) . y  +  1 ) ,  Point2 ( hb - > get_size ( ) . x  -  10 ,  hb - > get_size ( ) . y  +  1 ) ,  get_color ( " guide_color " ,  " Tree " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  key  =  _projects [ p_hb - > get_index ( ) ] . project_key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( _selected_project_keys . has ( key ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										hb - > draw_style_box ( get_stylebox ( " selected " ,  " Tree " ) ,  Rect2 ( Point2 ( ) ,  hb - > get_size ( )  -  Size2 ( 10 ,  0 )  *  EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Input for each item in the list
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ProjectList : : _panel_input ( const  Ref < InputEvent >  & p_ev ,  Node  * p_hb )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < InputEventMouseButton >  mb  =  p_ev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  clicked_index  =  p_hb - > get_index ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Item  & clicked_project  =  _projects [ clicked_index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  mb - > is_pressed ( )  & &  mb - > get_button_index ( )  = =  BUTTON_LEFT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( mb - > get_shift ( )  & &  _selected_project_keys . size ( )  >  0  & &  _last_clicked  ! =  " "  & &  clicked_project . project_key  ! =  _last_clicked )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  anchor_index  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  Item  & p  =  _projects [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( p . project_key  = =  _last_clicked )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													anchor_index  =  p . control - > get_index ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											CRASH_COND ( anchor_index  = =  - 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											select_range ( anchor_index ,  clicked_index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( mb - > get_control ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											toggle_select ( clicked_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_last_clicked  =  clicked_project . project_key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											select_project ( clicked_index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_signal ( SIGNAL_SELECTION_CHANGED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-23 17:25:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! mb - > get_control ( )  & &  mb - > is_doubleclick ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( SIGNAL_PROJECT_ASK_OPEN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-23 21:37:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : _favorite_pressed ( Node  * p_hb )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ProjectListItemControl  * control  =  Object : : cast_to < ProjectListItemControl > ( p_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  index  =  control - > get_index ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Item  item  =  _projects . write [ index ] ;  // Take copy
 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-20 16:38:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									item . favorite  =  ! item . favorite ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-20 16:38:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( item . favorite )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorSettings : : get_singleton ( ) - > set ( " favorite_projects/ "  +  item . project_key ,  item . path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-20 16:38:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorSettings : : get_singleton ( ) - > erase ( " favorite_projects/ "  +  item . project_key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-20 16:38:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									EditorSettings : : get_singleton ( ) - > save ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_projects . write [ index ]  =  item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									control - > set_is_favorite ( item . favorite ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sort_projects ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( item . favorite )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  _projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( _projects [ i ] . project_key  = =  item . project_key )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ensure_project_visible ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-24 13:25:21 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_dock_menu ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : _show_project ( const  String  & p_path )  {  
						 
					
						
							
								
									
										
										
										
											2016-07-29 03:33:59 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									OS : : get_singleton ( ) - > shell_open ( String ( " file:// " )  +  p_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								const  char  * ProjectList : : SIGNAL_SELECTION_CHANGED  =  " selection_changed " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const  char  * ProjectList : : SIGNAL_PROJECT_ASK_OPEN  =  " project_ask_open " ;  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectList : : _bind_methods ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _panel_draw " ,  & ProjectList : : _panel_draw ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _panel_input " ,  & ProjectList : : _panel_input ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _favorite_pressed " ,  & ProjectList : : _favorite_pressed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _show_project " ,  & ProjectList : : _show_project ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-01 19:30:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( SIGNAL_SELECTION_CHANGED ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( SIGNAL_PROJECT_ASK_OPEN ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Engine : : get_singleton ( ) - > set_editor_hint ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-01 12:10:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_RESIZED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( open_templates - > is_visible ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												open_templates - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_READY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( _project_list - > get_project_count ( )  = =  0  & &  StreamPeerSSL : : is_available ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												open_templates - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-23 02:50:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( _project_list - > get_project_count ( )  > =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Focus on the search box immediately to allow the user
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// to search without having to reach for their mouse
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												project_filter - > search_box - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_VISIBILITY_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-18 01:37:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											set_process_unhandled_input ( is_visible_in_tree ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_WM_QUIT_REQUEST :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-18 01:37:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_dim_window ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-06-18 01:37:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _dim_window ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-06-18 01:37:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// This method must be called before calling `get_tree()->quit()`.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Otherwise, its effect won't be visible
 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-18 01:37:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Dim the project manager window while it's quitting to make it clearer that it's busy.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// No transition is applied, as the effect needs to be visible immediately
 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-29 15:51:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  c  =  0.5f ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Color  dim_color  =  Color ( c ,  c ,  c ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									gui_base - > set_modulate ( dim_color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-05-01 19:30:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _update_project_buttons ( )  {  
						 
					
						
							
								
									
										
										
										
											2017-09-11 02:01:20 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector < ProjectList : : Item >  selected_projects  =  _project_list - > get_selected_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  empty_selection  =  selected_projects . empty ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-20 16:38:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 22:35:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  is_missing_project_selected  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  selected_projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( selected_projects [ i ] . missing )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											is_missing_project_selected  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase_btn - > set_disabled ( empty_selection ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 22:35:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									open_btn - > set_disabled ( empty_selection  | |  is_missing_project_selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_btn - > set_disabled ( empty_selection  | |  is_missing_project_selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									run_btn - > set_disabled ( empty_selection  | |  is_missing_project_selected ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-20 16:38:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-23 03:38:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase_missing_btn - > set_disabled ( ! _project_list - > is_any_project_missing ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-05-01 19:30:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _unhandled_input ( const  Ref < InputEvent >  & p_ev )  {  
						 
					
						
							
								
									
										
										
										
											2014-05-01 19:30:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < InputEventKey >  k  =  p_ev ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-01 19:30:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( k . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! k - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Pressing Command + Q quits the Project Manager
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// This is handled by the platform implementation on macOS,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// so only define the shortcut on other platforms
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# ifndef OSX_ENABLED 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( k - > get_scancode_with_modifiers ( )  = =  ( KEY_MASK_CMD  |  KEY_Q ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_dim_window ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											get_tree ( ) - > quit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( tabs - > get_current_tab ( )  ! =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  scancode_handled  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch  ( k - > get_scancode ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  KEY_ENTER :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												_open_selected_projects_ask ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  KEY_DELETE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												_erase_project ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  KEY_HOME :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( _project_list - > get_project_count ( )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_project_list - > select_project ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_update_project_buttons ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  KEY_END :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-18 01:37:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( _project_list - > get_project_count ( )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_project_list - > select_project ( _project_list - > get_project_count ( )  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_update_project_buttons ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  KEY_UP :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( k - > get_shift ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  index  =  _project_list - > get_single_selected_index ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-27 10:15:37 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( index  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													_project_list - > select_project ( index  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_project_list - > ensure_project_visible ( index  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_update_project_buttons ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  KEY_DOWN :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( k - > get_shift ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  index  =  _project_list - > get_single_selected_index ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( index  +  1  <  _project_list - > get_project_count ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_project_list - > select_project ( index  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_project_list - > ensure_project_visible ( index  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_update_project_buttons ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  KEY_F :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( k - > get_command ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													this - > project_filter - > search_box - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													scancode_handled  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												scancode_handled  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( scancode_handled )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											accept_event ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _load_recent_projects ( )  {  
						 
					
						
							
								
									
										
										
										
											2014-05-20 16:38:18 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_project_list - > set_order_option ( project_order_filter - > get_filter_option ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > set_search_term ( project_filter - > get_search_term ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > load_projects ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-05 16:06:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 03:33:59 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_update_project_buttons ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-19 23:14:02 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									tabs - > set_current_tab ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _on_projects_updated ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector < ProjectList : : Item >  selected_projects  =  _project_list - > get_selected_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  selected_projects . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										index  =  _project_list - > refresh_project ( selected_projects [ i ] . path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( index  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_project_list - > ensure_project_visible ( index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-24 13:25:21 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > update_dock_menu ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _on_project_created ( const  String  & dir )  {  
						 
					
						
							
								
									
										
										
										
											2019-02-19 00:03:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_filter - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  i  =  _project_list - > refresh_project ( dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > select_project ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > ensure_project_visible ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_open_selected_projects_ask ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-24 13:25:21 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > update_dock_menu ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-08 03:39:05 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _confirm_update_settings ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_open_selected_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:57:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _global_menu_action ( const  Variant  & p_id ,  const  Variant  & p_meta )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  id  =  ( int ) p_id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( id  = =  ProjectList : : GLOBAL_NEW_WINDOW )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										List < String >  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-13 08:58:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										args . push_back ( " -p " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:57:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  exec  =  OS : : get_singleton ( ) - > get_executable_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										OS : : ProcessID  pid  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										OS : : get_singleton ( ) - > execute ( exec ,  args ,  false ,  & pid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( id  = =  ProjectList : : GLOBAL_OPEN_PROJECT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  conf  =  ( String ) p_meta ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( conf  ! =  String ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											List < String >  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											args . push_back ( conf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  exec  =  OS : : get_singleton ( ) - > get_executable_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											OS : : ProcessID  pid  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											OS : : get_singleton ( ) - > execute ( exec ,  args ,  false ,  & pid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _open_selected_projects ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Set < String >  & selected_list  =  _project_list - > get_selected_project_keys ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  Set < String > : : Element  * E  =  selected_list . front ( ) ;  E ;  E  =  E - > next ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  String  & selected  =  E - > get ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  path  =  EditorSettings : : get_singleton ( ) - > get ( " projects/ "  +  selected ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  conf  =  path . plus_file ( " project.godot " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-11 02:01:20 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! FileAccess : : exists ( conf ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											dialog_error - > set_text ( vformat ( TTR ( " Can't open project at '%s'. " ) ,  path ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-11 02:01:20 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											dialog_error - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 09:35:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										print_line ( " Editing project:  "  +  path  +  "  ( "  +  selected  +  " ) " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										List < String >  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-06-21 11:09:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										args . push_back ( " --path " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										args . push_back ( path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-06-21 11:09:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										args . push_back ( " --editor " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-09 09:32:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( OS : : get_singleton ( ) - > is_stdout_debug_enabled ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											args . push_back ( " --debug " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( OS : : get_singleton ( ) - > is_stdout_verbose ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											args . push_back ( " --verbose " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 22:01:49 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( OS : : get_singleton ( ) - > is_disable_crash_handler ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											args . push_back ( " --disable-crash-handler " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  exec  =  OS : : get_singleton ( ) - > get_executable_path ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										OS : : ProcessID  pid  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Error  err  =  OS : : get_singleton ( ) - > execute ( exec ,  args ,  false ,  & pid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ERR_FAIL_COND ( err ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-09 22:33:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_dim_window ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-05 21:20:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									get_tree ( ) - > quit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _open_selected_projects_ask ( )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Set < String >  & selected_list  =  _project_list - > get_selected_project_keys ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( selected_list . size ( )  <  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( selected_list . size ( )  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-05 16:06:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										multi_open_ask - > set_text ( TTR ( " Are you sure to open more than one project? " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-21 21:30:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										multi_open_ask - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ProjectList : : Item  project  =  _project_list - > get_selected_projects ( ) [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 22:35:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( project . missing )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Update the project settings or don't open
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  conf  =  project . path . plus_file ( " project.godot " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  config_version  =  project . version ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-02 06:34:50 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Check if the config_version property was empty or 0
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( config_version  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 01:54:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ask_update_settings - > set_text ( vformat ( TTR ( " The following project settings file does not specify the version of Godot through which it was created. \n \n %s \n \n If you proceed with opening it, it will be converted to Godot's current configuration file format. \n Warning: You won't be able to open the project with previous versions of the engine anymore. " ) ,  conf ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-02 06:34:50 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ask_update_settings - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Check if we need to convert project settings from an earlier engine version
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( config_version  <  ProjectSettings : : CONFIG_VERSION )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 01:54:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ask_update_settings - > set_text ( vformat ( TTR ( " The following project settings file was generated by an older engine version, and needs to be converted for this version: \n \n %s \n \n Do you want to convert it? \n Warning: You won't be able to open the project with previous versions of the engine anymore. " ) ,  conf ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ask_update_settings - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Check if the file was generated by a newer, incompatible engine version
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( config_version  >  ProjectSettings : : CONFIG_VERSION )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										dialog_error - > set_text ( vformat ( TTR ( " Can't open project at '%s'. " )  +  " \n "  +  TTR ( " The project settings were created by a newer engine version, whose settings are not compatible with this version. " ) ,  project . path ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										dialog_error - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Open if the project is up-to-date
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_open_selected_projects ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _run_project_confirm ( )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector < ProjectList : : Item >  selected_list  =  _project_list - > get_selected_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  selected_list . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										const  String  & selected_main  =  selected_list [ i ] . main_scene ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-07 21:41:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( selected_main  = =  " " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 01:54:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											run_error_diag - > set_text ( TTR ( " Can't run project: no main scene defined. \n Please edit the project and set the main scene in the Project Settings under the  \" Application \"  category. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-07 21:41:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											run_error_diag - > popup_centered ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-18 21:24:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-07 21:41:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										const  String  & selected  =  selected_list [ i ] . project_key ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  path  =  EditorSettings : : get_singleton ( ) - > get ( " projects/ "  +  selected ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-07 21:41:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! DirAccess : : exists ( path  +  " /.import " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											run_error_diag - > set_text ( TTR ( " Can't run project: Assets need to be imported. \n Please edit the project to trigger the initial import. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											run_error_diag - > popup_centered ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-18 21:24:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-07 21:41:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 09:35:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										print_line ( " Running project:  "  +  path  +  "  ( "  +  selected  +  " ) " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										List < String >  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-06-21 11:09:30 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										args . push_back ( " --path " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										args . push_back ( path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 22:01:49 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( OS : : get_singleton ( ) - > is_disable_crash_handler ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											args . push_back ( " --disable-crash-handler " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  exec  =  OS : : get_singleton ( ) - > get_executable_path ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										OS : : ProcessID  pid  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Error  err  =  OS : : get_singleton ( ) - > execute ( exec ,  args ,  false ,  & pid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ERR_FAIL_COND ( err ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// When you press the "Run" button
  
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _run_project ( )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Set < String >  & selected_list  =  _project_list - > get_selected_project_keys ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( selected_list . size ( )  <  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( selected_list . size ( )  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 01:54:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										multi_run_ask - > set_text ( vformat ( TTR ( " Are you sure to run %d projects at once? " ) ,  selected_list . size ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-21 21:30:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										multi_run_ask - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_run_project_confirm ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-26 16:33:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _scan_dir ( const  String  & path ,  List < String >  * r_projects )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DirAccess  * da  =  DirAccess : : create ( DirAccess : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									da - > change_dir ( path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									da - > list_dir_begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  n  =  da - > get_next ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( n  ! =  String ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  ( da - > current_is_dir ( )  & &  ! n . begins_with ( " . " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-26 16:33:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_scan_dir ( da - > get_current_dir ( ) . plus_file ( n ) ,  r_projects ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-01 17:44:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( n  = =  " project.godot " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											r_projects - > push_back ( da - > get_current_dir ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										n  =  da - > get_next ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									da - > list_dir_end ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-26 16:33:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									memdelete ( da ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _scan_begin ( const  String  & p_base )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 09:35:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									print_line ( " Scanning projects at:  "  +  p_base ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									List < String >  projects ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-26 16:33:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_scan_dir ( p_base ,  & projects ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-24 09:35:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									print_line ( " Found  "  +  itos ( projects . size ( ) )  +  "  projects. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( List < String > : : Element  * E  =  projects . front ( ) ;  E ;  E  =  E - > next ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  proj  =  get_project_key_from_path ( E - > get ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorSettings : : get_singleton ( ) - > set ( " projects/ "  +  proj ,  E - > get ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									EditorSettings : : get_singleton ( ) - > save ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_load_recent_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ProjectManager : : _scan_projects ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scan_dir - > popup_centered_ratio ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _new_project ( )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									npdialog - > set_mode ( ProjectDialog : : MODE_NEW ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									npdialog - > show_dialog ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _import_project ( )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									npdialog - > set_mode ( ProjectDialog : : MODE_IMPORT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									npdialog - > show_dialog ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _rename_project ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Set < String >  & selected_list  =  _project_list - > get_selected_project_keys ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( selected_list . size ( )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( Set < String > : : Element  * E  =  selected_list . front ( ) ;  E ;  E  =  E - > next ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  String  & selected  =  E - > get ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  path  =  EditorSettings : : get_singleton ( ) - > get ( " projects/ "  +  selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										npdialog - > set_project_path ( path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										npdialog - > set_mode ( ProjectDialog : : MODE_RENAME ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										npdialog - > show_dialog ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _erase_project_confirm ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_project_list - > erase_selected_projects ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 18:30:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_update_project_buttons ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _erase_missing_projects_confirm ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_project_list - > erase_missing_projects ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-14 18:30:42 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_update_project_buttons ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _erase_project ( )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Set < String >  & selected_list  =  _project_list - > get_selected_project_keys ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( selected_list . size ( )  = =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 01:54:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  confirm_message ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( selected_list . size ( )  > =  2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										confirm_message  =  vformat ( TTR ( " Remove %d projects from the list? \n The project folders' contents won't be modified. " ) ,  selected_list . size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										confirm_message  =  TTR ( " Remove this project from the list? \n The project folder's contents won't be modified. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									erase_ask - > set_text ( confirm_message ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-21 21:30:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase_ask - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _erase_missing_projects ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-21 22:35:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase_missing_ask - > set_text ( TTR ( " Remove all missing projects from the list? \n The project folders' contents won't be modified. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase_missing_ask - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 17:02:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _language_selected ( int  p_id )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  lang  =  language_btn - > get_item_metadata ( p_id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									EditorSettings : : get_singleton ( ) - > set ( " interface/editor/editor_language " ,  lang ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									language_btn - > set_text ( lang ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									language_btn - > set_icon ( get_icon ( " Environment " ,  " EditorIcons " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 01:54:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									language_restart_ask - > set_text ( TTR ( " Language changed. \n The interface will update after restarting the editor or project manager. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 17:02:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									language_restart_ask - > popup_centered ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ProjectManager : : _restart_confirm ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									List < String >  args  =  OS : : get_singleton ( ) - > get_cmdline_args ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  exec  =  OS : : get_singleton ( ) - > get_executable_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									OS : : ProcessID  pid  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Error  err  =  OS : : get_singleton ( ) - > execute ( exec ,  args ,  false ,  & pid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND ( err ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-09 22:33:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_dim_window ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 17:02:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									get_tree ( ) - > quit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _exit_dialog ( )  {  
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-09 22:33:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_dim_window ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-05 21:20:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									get_tree ( ) - > quit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _install_project ( const  String  & p_zip_path ,  const  String  & p_title )  {  
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									npdialog - > set_mode ( ProjectDialog : : MODE_INSTALL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-11 21:34:02 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									npdialog - > set_zip_path ( p_zip_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									npdialog - > set_zip_title ( p_title ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									npdialog - > show_dialog ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-11 00:52:51 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _files_dropped ( PoolStringArray  p_files ,  int  p_screen )  {  
						 
					
						
							
								
									
										
										
										
											2016-08-01 01:59:31 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Set < String >  folders_set ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DirAccess  * da  =  DirAccess : : create ( DirAccess : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 17:06:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  p_files . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-01 01:59:31 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										String  file  =  p_files [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										folders_set . insert ( da - > dir_exists ( file )  ?  file  :  file . get_base_dir ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									memdelete ( da ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( folders_set . size ( )  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-11 00:52:51 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PoolStringArray  folders ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( Set < String > : : Element  * E  =  folders_set . front ( ) ;  E ;  E  =  E - > next ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-01 01:59:31 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											folders . append ( E - > get ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  confirm  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( folders . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-01 01:59:31 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											DirAccess  * dir  =  DirAccess : : create ( DirAccess : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( dir - > change_dir ( folders [ 0 ] )  = =  OK )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-01 01:59:31 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												dir - > list_dir_begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												String  file  =  dir - > get_next ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												while  ( confirm  & &  file  ! =  String ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-01 17:44:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ! dir - > current_is_dir ( )  & &  file . ends_with ( " project.godot " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-01 01:59:31 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														confirm  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													file  =  dir - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												dir - > list_dir_end ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											memdelete ( dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( confirm )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											multi_scan_ask - > get_ok ( ) - > disconnect ( " pressed " ,  this ,  " _scan_multiple_folders " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											multi_scan_ask - > get_ok ( ) - > connect ( " pressed " ,  this ,  " _scan_multiple_folders " ,  varray ( folders ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 01:54:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											multi_scan_ask - > set_text ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													vformat ( TTR ( " Are you sure to scan %s folders for existing Godot projects? \n This could take a while. " ) ,  folders . size ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-01 01:59:31 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											multi_scan_ask - > popup_centered_minsize ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_scan_multiple_folders ( folders ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 17:06:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-01 01:59:31 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _scan_multiple_folders ( PoolStringArray  p_files )  {  
						 
					
						
							
								
									
										
										
										
											2016-08-01 01:59:31 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  p_files . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_scan_begin ( p_files . get ( i ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-31 01:10:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 17:06:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _on_order_option_changed ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > set_order_option ( project_order_filter - > get_filter_option ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > sort_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ProjectManager : : _on_filter_option_changed ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > set_search_term ( project_filter - > get_search_term ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > sort_projects ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  ProjectManager : : _bind_methods ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _open_selected_projects_ask " ,  & ProjectManager : : _open_selected_projects_ask ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _open_selected_projects " ,  & ProjectManager : : _open_selected_projects ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:57:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _global_menu_action " ) ,  & ProjectManager : : _global_menu_action ,  DEFVAL ( Variant ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _run_project " ,  & ProjectManager : : _run_project ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _run_project_confirm " ,  & ProjectManager : : _run_project_confirm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _scan_projects " ,  & ProjectManager : : _scan_projects ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _scan_begin " ,  & ProjectManager : : _scan_begin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _import_project " ,  & ProjectManager : : _import_project ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _new_project " ,  & ProjectManager : : _new_project ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _rename_project " ,  & ProjectManager : : _rename_project ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _erase_project " ,  & ProjectManager : : _erase_project ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _erase_missing_projects " ,  & ProjectManager : : _erase_missing_projects ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _erase_project_confirm " ,  & ProjectManager : : _erase_project_confirm ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _erase_missing_projects_confirm " ,  & ProjectManager : : _erase_missing_projects_confirm ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 17:02:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _language_selected " ,  & ProjectManager : : _language_selected ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _restart_confirm " ,  & ProjectManager : : _restart_confirm ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _exit_dialog " ,  & ProjectManager : : _exit_dialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _on_order_option_changed " ,  & ProjectManager : : _on_order_option_changed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _on_filter_option_changed " ,  & ProjectManager : : _on_filter_option_changed ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _on_projects_updated " ,  & ProjectManager : : _on_projects_updated ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _on_project_created " ,  & ProjectManager : : _on_project_created ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _unhandled_input " ,  & ProjectManager : : _unhandled_input ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _install_project " ,  & ProjectManager : : _install_project ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _files_dropped " ,  & ProjectManager : : _files_dropped ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 15:31:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _open_asset_library " ,  & ProjectManager : : _open_asset_library ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _confirm_update_settings " ,  & ProjectManager : : _confirm_update_settings ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _update_project_buttons " ,  & ProjectManager : : _update_project_buttons ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _scan_multiple_folders " ,  " files " ) ,  & ProjectManager : : _scan_multiple_folders ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 15:31:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectManager : : _open_asset_library ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									asset_library - > disable_community_support ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tabs - > set_current_tab ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								ProjectManager : : ProjectManager ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// load settings
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! EditorSettings : : get_singleton ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorSettings : : create ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-03 19:13:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorSettings : : get_singleton ( ) - > set_optimize_save ( false ) ;  //just write settings as they came
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-06-05 18:43:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-22 20:20:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  display_scale  =  EditorSettings : : get_singleton ( ) - > get ( " interface/editor/display_scale " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  custom_display_scale  =  EditorSettings : : get_singleton ( ) - > get ( " interface/editor/custom_display_scale " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch  ( display_scale )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  0 :  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-17 11:17:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												// Try applying a suitable display scale automatically.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-07 21:37:05 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# ifdef OSX_ENABLED 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor_set_scale ( OS : : get_singleton ( ) - > get_screen_max_scale ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# else 
  
						 
					
						
							
								
									
										
										
										
											2018-03-22 20:20:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												const  int  screen  =  OS : : get_singleton ( ) - > get_current_screen ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-17 11:17:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												float  scale ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( OS : : get_singleton ( ) - > get_screen_dpi ( screen )  > =  192  & &  OS : : get_singleton ( ) - > get_screen_size ( screen ) . y  > =  1400 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// hiDPI display.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													scale  =  2.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if  ( OS : : get_singleton ( ) - > get_screen_size ( screen ) . y  < =  800 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Small loDPI display. Use a smaller display scale so that editor elements fit more easily.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Icons won't look great, but this is better than having editor elements overflow from its window.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													scale  =  0.75 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													scale  =  1.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor_set_scale ( scale ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-07 21:37:05 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2018-03-22 20:20:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-17 11:17:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  1 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor_set_scale ( 0.75 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  2 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor_set_scale ( 1.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  3 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor_set_scale ( 1.25 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  4 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor_set_scale ( 1.5 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  5 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor_set_scale ( 1.75 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  6 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor_set_scale ( 2.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											default : 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-22 20:20:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												editor_set_scale ( custom_display_scale ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-17 11:17:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-05 18:43:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-09 11:08:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-17 21:56:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Define a minimum window size to prevent UI elements from overlapping or being cut off
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										OS : : get_singleton ( ) - > set_min_window_size ( Size2 ( 750 ,  420 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-02 11:50:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// TODO: Resize windows on hiDPI displays on Windows and Linux and remove the line below
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-09 11:08:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										OS : : get_singleton ( ) - > set_window_size ( OS : : get_singleton ( ) - > get_window_size ( )  *  MAX ( 1 ,  EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-05 18:43:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-23 10:32:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									FileDialog : : set_default_show_hidden_files ( EditorSettings : : get_singleton ( ) - > get ( " filesystem/file_dialog/show_hidden_files " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-22 00:12:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_anchors_and_margins_preset ( Control : : PRESET_WIDE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-19 19:41:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_theme ( create_custom_theme ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-09 12:35:20 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									gui_base  =  memnew ( Control ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 13:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									add_child ( gui_base ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-22 00:12:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									gui_base - > set_anchors_and_margins_preset ( Control : : PRESET_WIDE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-09 12:35:20 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Panel  * panel  =  memnew ( Panel ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 13:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									gui_base - > add_child ( panel ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-22 00:12:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									panel - > set_anchors_and_margins_preset ( Control : : PRESET_WIDE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 19:35:31 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									panel - > add_style_override ( " panel " ,  gui_base - > get_stylebox ( " Background " ,  " EditorStyles " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VBoxContainer  * vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									panel - > add_child ( vb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 19:35:31 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									vb - > set_anchors_and_margins_preset ( Control : : PRESET_WIDE ,  Control : : PRESET_MODE_MINSIZE ,  8  *  EDSCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-06-08 09:25:47 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  cp ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 03:11:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cp  + =  0xA9 ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-08 13:56:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// TRANSLATORS: This refers to the application where users manage their Godot projects.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-01 11:16:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									OS : : get_singleton ( ) - > set_window_title ( VERSION_NAME  +  String ( "  -  " )  +  TTR ( " Project Manager " )  +  "  -  "  +  cp  +  "  2007-2020 Juan Linietsky, Ariel Manzur & Godot Contributors " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-08 09:25:47 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 17:02:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Control  * center_box  =  memnew ( Control ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									center_box - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vb - > add_child ( center_box ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									tabs  =  memnew ( TabContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 17:02:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									center_box - > add_child ( tabs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tabs - > set_anchors_and_margins_preset ( Control : : PRESET_WIDE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									tabs - > set_tab_align ( TabContainer : : ALIGN_LEFT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									HBoxContainer  * tree_hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-08 09:25:47 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									projects_hb  =  tree_hb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									projects_hb - > set_name ( TTR ( " Projects " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-08 09:25:47 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tabs - > add_child ( tree_hb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VBoxContainer  * search_tree_vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tree_hb - > add_child ( search_tree_vb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									search_tree_vb - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									HBoxContainer  * sort_filters  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Label  * sort_label  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sort_label - > set_text ( TTR ( " Sort: " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sort_filters - > add_child ( sort_label ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 21:12:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector < String >  sort_filter_titles ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-04 15:09:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sort_filter_titles . push_back ( TTR ( " Name " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sort_filter_titles . push_back ( TTR ( " Path " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sort_filter_titles . push_back ( TTR ( " Last Modified " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_order_filter  =  memnew ( ProjectListFilter ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_order_filter - > add_filter_option ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 21:12:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_order_filter - > _setup_filters ( sort_filter_titles ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_order_filter - > set_filter_size ( 150 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sort_filters - > add_child ( project_order_filter ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_order_filter - > connect ( " filter_changed " ,  this ,  " _on_order_option_changed " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_order_filter - > set_custom_minimum_size ( Size2 ( 180 ,  10 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 21:12:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  projects_sorting_order  =  ( int ) EditorSettings : : get_singleton ( ) - > get ( " project_manager/sorting_order " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									project_order_filter - > set_filter_option ( ( ProjectListFilter : : FilterOption ) projects_sorting_order ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sort_filters - > add_spacer ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_filter  =  memnew ( ProjectListFilter ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_filter - > add_search_box ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_filter - > connect ( " filter_changed " ,  this ,  " _on_filter_option_changed " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-09 11:08:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									project_filter - > set_custom_minimum_size ( Size2 ( 280 ,  10 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									sort_filters - > add_child ( project_filter ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									search_tree_vb - > add_child ( sort_filters ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PanelContainer  * pc  =  memnew ( PanelContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									pc - > add_style_override ( " panel " ,  gui_base - > get_stylebox ( " bg " ,  " Tree " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									search_tree_vb - > add_child ( pc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									pc - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_project_list  =  memnew ( ProjectList ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > connect ( ProjectList : : SIGNAL_SELECTION_CHANGED ,  this ,  " _update_project_buttons " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > connect ( ProjectList : : SIGNAL_PROJECT_ASK_OPEN ,  this ,  " _open_selected_projects_ask " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									pc - > add_child ( _project_list ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_project_list - > set_enable_h_scroll ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VBoxContainer  * tree_vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-23 03:38:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									tree_vb - > set_custom_minimum_size ( Size2 ( 120 ,  120 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-04 18:15:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									tree_hb - > add_child ( tree_vb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * open  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									open - > set_text ( TTR ( " Edit " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									tree_vb - > add_child ( open ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									open - > connect ( " pressed " ,  this ,  " _open_selected_projects_ask " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									open_btn  =  open ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * run  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									run - > set_text ( TTR ( " Run " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									tree_vb - > add_child ( run ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									run - > connect ( " pressed " ,  this ,  " _run_project " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									run_btn  =  run ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									tree_vb - > add_child ( memnew ( HSeparator ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * scan  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scan - > set_text ( TTR ( " Scan " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									tree_vb - > add_child ( scan ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scan - > connect ( " pressed " ,  this ,  " _scan_projects " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									tree_vb - > add_child ( memnew ( HSeparator ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scan_dir  =  memnew ( FileDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									scan_dir - > set_access ( FileDialog : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scan_dir - > set_mode ( FileDialog : : MODE_OPEN_DIR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-31 20:46:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scan_dir - > set_title ( TTR ( " Select a Folder to Scan " ) ) ;  // must be after mode or it's overridden
 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scan_dir - > set_current_dir ( EditorSettings : : get_singleton ( ) - > get ( " filesystem/directories/default_project_path " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 13:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									gui_base - > add_child ( scan_dir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scan_dir - > connect ( " dir_selected " ,  this ,  " _scan_begin " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * create  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									create - > set_text ( TTR ( " New Project " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									tree_vb - > add_child ( create ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									create - > connect ( " pressed " ,  this ,  " _new_project " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * import  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									import - > set_text ( TTR ( " Import " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									tree_vb - > add_child ( import ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									import - > connect ( " pressed " ,  this ,  " _import_project " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 21:04:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * rename  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename - > set_text ( TTR ( " Rename " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tree_vb - > add_child ( rename ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename - > connect ( " pressed " ,  this ,  " _rename_project " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_btn  =  rename ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * erase  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase - > set_text ( TTR ( " Remove " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									tree_vb - > add_child ( erase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase - > connect ( " pressed " ,  this ,  " _erase_project " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									erase_btn  =  erase ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * erase_missing  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									erase_missing - > set_text ( TTR ( " Remove Missing " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tree_vb - > add_child ( erase_missing ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									erase_missing - > connect ( " pressed " ,  this ,  " _erase_missing_projects " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									erase_missing_btn  =  erase_missing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									tree_vb - > add_spacer ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-06-09 22:47:43 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( StreamPeerSSL : : is_available ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										asset_library  =  memnew ( EditorAssetLibrary ( true ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-20 14:42:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										asset_library - > set_name ( TTR ( " Templates " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-09 22:47:43 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										tabs - > add_child ( asset_library ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										asset_library - > connect ( " install_asset " ,  this ,  " _install_project " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-09 22:47:43 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										WARN_PRINT ( " Asset Library not available, as it requires SSL to work. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 17:02:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									HBoxContainer  * settings_hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									settings_hb - > set_alignment ( BoxContainer : : ALIGN_END ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									settings_hb - > set_h_grow_direction ( Control : : GROW_DIRECTION_BEGIN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Label  * version_label  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  hash  =  String ( VERSION_HASH ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( hash . length ( )  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										hash  =  " . "  +  hash . left ( 9 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									version_label - > set_text ( " v "  VERSION_FULL_BUILD  " "  +  hash ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Fade out the version label to be less prominent, but still readable
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									version_label - > set_self_modulate ( Color ( 1 ,  1 ,  1 ,  0.6 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									version_label - > set_align ( Label : : ALIGN_CENTER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									settings_hb - > add_child ( version_label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 17:02:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									language_btn  =  memnew ( OptionButton ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 19:35:31 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									language_btn - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									language_btn - > set_focus_mode ( Control : : FOCUS_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 17:02:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector < String >  editor_languages ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									List < PropertyInfo >  editor_settings_properties ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									EditorSettings : : get_singleton ( ) - > get_property_list ( & editor_settings_properties ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( List < PropertyInfo > : : Element  * E  =  editor_settings_properties . front ( ) ;  E ;  E  =  E - > next ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										PropertyInfo  & pi  =  E - > get ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( pi . name  = =  " interface/editor/editor_language " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											editor_languages  =  pi . hint_string . split ( " , " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  current_lang  =  EditorSettings : : get_singleton ( ) - > get ( " interface/editor/editor_language " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  editor_languages . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  lang  =  editor_languages [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  lang_name  =  TranslationServer : : get_singleton ( ) - > get_locale_name ( lang ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										language_btn - > add_item ( lang_name  +  "  [ "  +  lang  +  " ] " ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										language_btn - > set_item_metadata ( i ,  lang ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( current_lang  = =  lang )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											language_btn - > select ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											language_btn - > set_text ( lang ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									language_btn - > set_icon ( get_icon ( " Environment " ,  " EditorIcons " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									settings_hb - > add_child ( language_btn ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									language_btn - > connect ( " item_selected " ,  this ,  " _language_selected " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									center_box - > add_child ( settings_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									settings_hb - > set_anchors_and_margins_preset ( Control : : PRESET_TOP_RIGHT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-12-26 21:39:46 -02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									//////////////////////////////////////////////////////////////
 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-25 17:02:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									language_restart_ask  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									language_restart_ask - > get_ok ( ) - > set_text ( TTR ( " Restart Now " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									language_restart_ask - > get_ok ( ) - > connect ( " pressed " ,  this ,  " _restart_confirm " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									language_restart_ask - > get_cancel ( ) - > set_text ( TTR ( " Continue " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									gui_base - > add_child ( language_restart_ask ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-11 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase_missing_ask  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									erase_missing_ask - > get_ok ( ) - > set_text ( TTR ( " Remove All " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									erase_missing_ask - > get_ok ( ) - > connect ( " pressed " ,  this ,  " _erase_missing_projects_confirm " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									gui_base - > add_child ( erase_missing_ask ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase_ask  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase_ask - > get_ok ( ) - > set_text ( TTR ( " Remove " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									erase_ask - > get_ok ( ) - > connect ( " pressed " ,  this ,  " _erase_project_confirm " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 13:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									gui_base - > add_child ( erase_ask ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									multi_open_ask  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									multi_open_ask - > get_ok ( ) - > set_text ( TTR ( " Edit " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									multi_open_ask - > get_ok ( ) - > connect ( " pressed " ,  this ,  " _open_selected_projects " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 13:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									gui_base - > add_child ( multi_open_ask ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									multi_run_ask  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-03 22:25:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									multi_run_ask - > get_ok ( ) - > set_text ( TTR ( " Run " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									multi_run_ask - > get_ok ( ) - > connect ( " pressed " ,  this ,  " _run_project_confirm " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 13:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									gui_base - > add_child ( multi_run_ask ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-05 16:06:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									multi_scan_ask  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-01 01:59:31 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									multi_scan_ask - > get_ok ( ) - > set_text ( TTR ( " Scan " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									gui_base - > add_child ( multi_scan_ask ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-11 09:45:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ask_update_settings  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ask_update_settings - > get_ok ( ) - > connect ( " pressed " ,  this ,  " _confirm_update_settings " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									gui_base - > add_child ( ask_update_settings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									OS : : get_singleton ( ) - > set_low_processor_usage_mode ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-30 20:08:17 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									npdialog  =  memnew ( ProjectDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 13:32:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									gui_base - > add_child ( npdialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 12:20:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									npdialog - > connect ( " projects_updated " ,  this ,  " _on_projects_updated " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									npdialog - > connect ( " project_created " ,  this ,  " _on_project_created " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:37:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									_load_recent_projects ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-01 02:06:29 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( EditorSettings : : get_singleton ( ) - > get ( " filesystem/directories/autoscan_project_path " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_scan_begin ( EditorSettings : : get_singleton ( ) - > get ( " filesystem/directories/autoscan_project_path " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-01 02:06:29 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 17:06:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SceneTree : : get_singleton ( ) - > connect ( " files_dropped " ,  this ,  " _files_dropped " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-06 15:57:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SceneTree : : get_singleton ( ) - > connect ( " global_menu_action " ,  this ,  " _global_menu_action " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-07 21:41:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									run_error_diag  =  memnew ( AcceptDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									gui_base - > add_child ( run_error_diag ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									run_error_diag - > set_title ( TTR ( " Can't run project " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-11 02:01:20 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dialog_error  =  memnew ( AcceptDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									gui_base - > add_child ( dialog_error ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 15:31:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									open_templates  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-25 01:54:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									open_templates - > set_text ( TTR ( " You currently don't have any projects. \n Would you like to explore official example projects in the Asset Library? " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 15:31:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									open_templates - > get_ok ( ) - > set_text ( TTR ( " Open Asset Library " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									open_templates - > connect ( " confirmed " ,  this ,  " _open_asset_library " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( open_templates ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-09 22:10:30 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ProjectManager : : ~ ProjectManager ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( EditorSettings : : get_singleton ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorSettings : : destroy ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectListFilter : : _setup_filters ( Vector < String >  options )  {  
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									filter_option - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  options . size ( ) ;  i + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-04 15:09:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										filter_option - > add_item ( options [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ProjectListFilter : : _search_text_changed ( const  String  & p_newtext )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									emit_signal ( " filter_changed " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								String  ProjectListFilter : : get_search_term ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  search_box - > get_text ( ) . strip_edges ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ProjectListFilter : : FilterOption  ProjectListFilter : : get_filter_option ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  _current_filter ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 21:12:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectListFilter : : set_filter_option ( FilterOption  option )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									filter_option - > select ( ( int ) option ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_filter_option_selected ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectListFilter : : _filter_option_selected ( int  p_idx )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									FilterOption  selected  =  ( FilterOption ) ( filter_option - > get_selected ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( _current_filter  ! =  selected )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_current_filter  =  selected ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										emit_signal ( " filter_changed " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-06-17 13:38:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectListFilter : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2017-11-26 15:31:08 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_what  = =  NOTIFICATION_ENTER_TREE  & &  has_search_box )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-11 12:04:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										search_box - > set_right_icon ( get_icon ( " Search " ,  " EditorIcons " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-26 13:45:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										search_box - > set_clear_button_enabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-17 13:38:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectListFilter : : _bind_methods ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-02-13 12:47:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _search_text_changed " ) ,  & ProjectListFilter : : _search_text_changed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _filter_option_selected " ) ,  & ProjectListFilter : : _filter_option_selected ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-05 16:44:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " filter_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectListFilter : : add_filter_option ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									filter_option  =  memnew ( OptionButton ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									filter_option - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									filter_option - > connect ( " item_selected " ,  this ,  " _filter_option_selected " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( filter_option ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ProjectListFilter : : add_search_box ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									search_box  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									search_box - > set_placeholder ( TTR ( " Search " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-25 21:59:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									search_box - > set_tooltip ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											TTR ( " The search box filters projects by name and last path component. \n To filter projects by name and full path, the query must contain at least one `/` character. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									search_box - > connect ( " text_changed " ,  this ,  " _search_text_changed " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									search_box - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( search_box ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-13 19:16:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									has_search_box  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ProjectListFilter : : set_filter_size ( int  h_size )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									filter_option - > set_custom_minimum_size ( Size2 ( h_size  *  EDSCALE ,  10  *  EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								ProjectListFilter : : ProjectListFilter ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_current_filter  =  FILTER_NAME ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-23 19:15:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									has_search_box  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 17:57:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-02-19 00:03:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ProjectListFilter : : clear ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( has_search_box )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										search_box - > clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}