2023-01-05 13:25:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*  editor_properties.cpp                                                 */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                         This file is part of:                          */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                             GODOT ENGINE                               */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                        https://godotengine.org                         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Permission is hereby granted, free of charge, to any person obtaining  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* a copy of this software and associated documentation files (the        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* "Software"), to deal in the Software without restriction, including    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* without limitation the rights to use, copy, modify, merge, publish,    */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* distribute, sublicense, and/or sell copies of the Software, and to     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* permit persons to whom the Software is furnished to do so, subject to  */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* the following conditions:                                              */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* The above copyright notice and this permission notice shall be         */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* included in all copies or substantial portions of the Software.        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*                                                                        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
									
										
										
										
											2018-05-16 14:19:33 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "editor_properties.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-12 02:46:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "core/config/project_settings.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-11-19 12:45:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/create_dialog.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-02-12 02:46:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/editor_node.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "editor/editor_properties_array_dict.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-05-16 17:30:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/editor_properties_vector.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-11-19 12:45:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/editor_resource_picker.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "editor/editor_settings.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/editor_string_names.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-04-07 18:59:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/gui/editor_file_dialog.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "editor/gui/editor_spin_slider.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "editor/gui/scene_tree_editor.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-11-19 12:45:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/inspector_dock.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "editor/plugins/script_editor_plugin.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-10-06 18:51:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/project_settings_editor.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-11-19 12:45:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/property_selector.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/scene_tree_dock.h" 
  
						 
					
						
							
								
									
										
										
										
											2024-01-15 13:14:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/themes/editor_scale.h" 
  
						 
					
						
							
								
									
										
										
										
											2021-09-17 16:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/2d/gpu_particles_2d.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "scene/3d/fog_volume.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "scene/3d/gpu_particles_3d.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-11-19 12:45:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/color_picker.h" 
  
						 
					
						
							
								
									
										
										
										
											2024-11-22 01:09:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/grid_container.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-03-03 22:51:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/main/window.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-09-03 14:22:16 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/resources/font.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-05-26 20:23:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/resources/mesh.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-12-04 00:52:45 +04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/resources/visual_shader_nodes.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-04-29 11:47:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								///////////////////// Nil /////////////////////////
  
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyNil : : update_property ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyNil : : EditorPropertyNil ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Label  * prop_label  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									prop_label - > set_text ( " <null> " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( prop_label ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								///////////////////// TEXT /////////////////////////
  
						 
					
						
							
								
									
										
										
										
											2018-07-23 20:42:31 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyText : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									text - > set_editable ( ! p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-16 09:43:34 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyText : : _text_submitted ( const  String  & p_string )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( updating )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-23 20:42:31 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-23 20:42:31 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( text - > has_focus ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_text_changed ( p_string ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyText : : _text_changed ( const  String  & p_string )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( updating )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-18 19:45:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Set tooltip so that the full text is displayed in a tooltip if hovered.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// This is useful when using a narrow inspector, as the text can be trimmed otherwise.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									text - > set_tooltip_text ( get_tooltip_string ( text - > get_text ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( string_name )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-30 11:34:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_changed ( get_edited_property ( ) ,  StringName ( p_string ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-30 11:34:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_changed ( get_edited_property ( ) ,  p_string ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyText : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  s  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									updating  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 11:31:44 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( text - > get_text ( )  ! =  s )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-14 15:37:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  caret  =  text - > get_caret_column ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 11:31:44 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										text - > set_text ( s ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-18 19:45:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										text - > set_tooltip_text ( get_tooltip_string ( s ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-14 15:37:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										text - > set_caret_column ( caret ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 11:31:44 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									text - > set_editable ( ! is_read_only ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									updating  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyText : : set_string_name ( bool  p_enabled )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									string_name  =  p_enabled ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:22:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_enabled )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Label  * prefix  =  memnew ( Label ( " & " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										prefix - > set_tooltip_text ( " StringName " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										prefix - > set_mouse_filter ( MOUSE_FILTER_STOP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										text - > get_parent ( ) - > add_child ( prefix ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										text - > get_parent ( ) - > move_child ( prefix ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 18:51:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyText : : set_secret ( bool  p_enabled )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									text - > set_secret ( p_enabled ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-17 03:50:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyText : : set_placeholder ( const  String  & p_string )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									text - > set_placeholder ( p_string ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								EditorPropertyText : : EditorPropertyText ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:22:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									HBoxContainer  * hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									text  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:22:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hb - > add_child ( text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_focusable ( text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 17:22:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									text - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									text - > connect ( SceneStringName ( text_changed ) ,  callable_mp ( this ,  & EditorPropertyText : : _text_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-02 16:15:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									text - > connect ( SceneStringName ( text_submitted ) ,  callable_mp ( this ,  & EditorPropertyText : : _text_submitted ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// MULTILINE TEXT /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyMultilineText : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									text - > set_editable ( ! p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									open_big_text - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyMultilineText : : _big_text_changed ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									text - > set_text ( big_text - > get_text ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-18 19:45:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Set tooltip so that the full text is displayed in a tooltip if hovered.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// This is useful when using a narrow inspector, as the text can be trimmed otherwise.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									text - > set_tooltip_text ( get_tooltip_string ( big_text - > get_text ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  big_text - > get_text ( ) ,  " " ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyMultilineText : : _text_changed ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-04-18 19:45:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									text - > set_tooltip_text ( get_tooltip_string ( text - > get_text ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  text - > get_text ( ) ,  " " ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyMultilineText : : _open_big_text ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! big_text_dialog )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										big_text  =  memnew ( TextEdit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-27 00:28:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( expression )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											big_text - > set_syntax_highlighter ( text - > get_syntax_highlighter ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											big_text - > add_theme_font_override ( SceneStringName ( font ) ,  get_theme_font ( SNAME ( " expression " ) ,  EditorStringName ( EditorFonts ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											big_text - > add_theme_font_size_override ( SceneStringName ( font_size ) ,  get_theme_font_size ( SNAME ( " expression_size " ) ,  EditorStringName ( EditorFonts ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-27 00:28:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										big_text - > connect ( SceneStringName ( text_changed ) ,  callable_mp ( this ,  & EditorPropertyMultilineText : : _big_text_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-09 11:52:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										big_text - > set_line_wrapping_mode ( TextEdit : : LineWrappingMode : : LINE_WRAPPING_BOUNDARY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										big_text_dialog  =  memnew ( AcceptDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										big_text_dialog - > add_child ( big_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 14:32:23 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										big_text_dialog - > set_title ( TTR ( " Edit Text: " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										add_child ( big_text_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-09 22:01:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									big_text_dialog - > popup_centered_clamped ( Size2 ( 1000 ,  900 )  *  EDSCALE ,  0.8 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-16 10:48:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									big_text - > set_text ( text - > get_text ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 14:32:23 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									big_text - > grab_focus ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyMultilineText : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  t  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 11:31:44 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( text - > get_text ( )  ! =  t )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										text - > set_text ( t ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-18 19:45:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										text - > set_tooltip_text ( get_tooltip_string ( t ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 11:31:44 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( big_text  & &  big_text - > is_visible_in_tree ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											big_text - > set_text ( t ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyMultilineText : : _notification ( int  p_what )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Ref < Texture2D >  df  =  get_editor_theme_icon ( SNAME ( " DistractionFree " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											open_big_text - > set_button_icon ( df ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-27 13:10:04 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-27 00:28:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Ref < Font >  font ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  font_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( expression )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												font  =  get_theme_font ( SNAME ( " expression " ) ,  EditorStringName ( EditorFonts ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												font_size  =  get_theme_font_size ( SNAME ( " expression_size " ) ,  EditorStringName ( EditorFonts ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-27 00:28:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												text - > add_theme_font_override ( SceneStringName ( font ) ,  font ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												text - > add_theme_font_size_override ( SceneStringName ( font_size ) ,  font_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-27 00:28:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( big_text )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													big_text - > add_theme_font_override ( SceneStringName ( font ) ,  font ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													big_text - > add_theme_font_size_override ( SceneStringName ( font_size ) ,  font_size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-27 00:28:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												font  =  get_theme_font ( SceneStringName ( font ) ,  SNAME ( " TextEdit " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												font_size  =  get_theme_font_size ( SceneStringName ( font_size ) ,  SNAME ( " TextEdit " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-27 00:28:32 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											text - > set_custom_minimum_size ( Vector2 ( 0 ,  font - > get_height ( font_size )  *  6 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-27 13:10:04 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EditorPropertyMultilineText : : EditorPropertyMultilineText ( bool  p_expression )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									HBoxContainer  * hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 18:55:51 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hb - > add_theme_constant_override ( " separation " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_child ( hb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_bottom_editor ( hb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									text  =  memnew ( TextEdit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									text - > connect ( SceneStringName ( text_changed ) ,  callable_mp ( this ,  & EditorPropertyMultilineText : : _text_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-09 11:52:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									text - > set_line_wrapping_mode ( TextEdit : : LineWrappingMode : : LINE_WRAPPING_BOUNDARY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_focusable ( text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > add_child ( text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									text - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 20:49:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									open_big_text  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									open_big_text - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									open_big_text - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyMultilineText : : _open_big_text ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									hb - > add_child ( open_big_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									big_text_dialog  =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									big_text  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-27 13:10:04 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_expression )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										expression  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Ref < EditorStandardSyntaxHighlighter >  highlighter ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										highlighter . instantiate ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										text - > set_syntax_highlighter ( highlighter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// TEXT ENUM /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTextEnum : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									option_button - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_button - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-15 13:25:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTextEnum : : _emit_changed_value ( const  String  & p_string )  {  
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( string_name )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_changed ( get_edited_property ( ) ,  StringName ( p_string ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_changed ( get_edited_property ( ) ,  p_string ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTextEnum : : _option_selected ( int  p_which )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_emit_changed_value ( option_button - > get_item_text ( p_which ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyTextEnum : : _edit_custom_value ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									default_layout - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_layout - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									custom_value_edit - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-15 13:25:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTextEnum : : _custom_value_submitted ( const  String  & p_value )  {  
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit_custom_layout - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									default_layout - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_emit_changed_value ( p_value . strip_edges ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyTextEnum : : _custom_value_accepted ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  new_value  =  custom_value_edit - > get_text ( ) . strip_edges ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_custom_value_submitted ( new_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-21 12:25:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTextEnum : : _custom_value_canceled ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									custom_value_edit - > set_text ( get_edited_property_value ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_layout - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									default_layout - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyTextEnum : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  current_value  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  default_option  =  options . find ( current_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// The list can change in the loose mode.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( loose_mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										custom_value_edit - > set_text ( current_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										option_button - > clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Manually entered value.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( default_option  <  0  & &  ! current_value . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											option_button - > add_item ( current_value ,  options . size ( )  +  1001 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											option_button - > select ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											option_button - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Add an explicit empty value for clearing the property.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										option_button - > add_item ( " " ,  options . size ( )  +  1000 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  options . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											option_button - > add_item ( options [ i ] ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( options [ i ]  = =  current_value )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												option_button - > select ( option_button - > get_item_count ( )  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										option_button - > select ( default_option ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-12 02:23:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( default_option  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											option_button - > set_text ( current_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTextEnum : : setup ( const  Vector < String >  & p_options ,  bool  p_string_name ,  bool  p_loose_mode )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									string_name  =  p_string_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									loose_mode  =  p_loose_mode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									options . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( loose_mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Add an explicit empty value for clearing the property in the loose mode.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										option_button - > add_item ( " " ,  options . size ( )  +  1000 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  p_options . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										options . append ( p_options [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										option_button - > add_item ( p_options [ i ] ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( loose_mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										edit_button - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTextEnum : : _notification ( int  p_what )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											edit_button - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Edit " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											accept_button - > set_button_icon ( get_editor_theme_icon ( SNAME ( " ImportCheck " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cancel_button - > set_button_icon ( get_editor_theme_icon ( SNAME ( " ImportFail " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EditorPropertyTextEnum : : EditorPropertyTextEnum ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-01-12 21:51:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									HBoxContainer  * hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									default_layout  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-12 21:51:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									default_layout - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > add_child ( default_layout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_layout  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-12 21:51:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit_custom_layout - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit_custom_layout - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-12 21:51:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hb - > add_child ( edit_custom_layout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									option_button  =  memnew ( OptionButton ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									option_button - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									option_button - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									option_button - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-23 18:29:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									option_button - > set_auto_translate_mode ( AUTO_TRANSLATE_MODE_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									default_layout - > add_child ( option_button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:21:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									option_button - > connect ( SceneStringName ( item_selected ) ,  callable_mp ( this ,  & EditorPropertyTextEnum : : _option_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_button  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_button - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_button - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									default_layout - > add_child ( edit_button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit_button - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyTextEnum : : _edit_custom_value ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									custom_value_edit  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									custom_value_edit - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_layout - > add_child ( custom_value_edit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-02 16:15:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									custom_value_edit - > connect ( SceneStringName ( text_submitted ) ,  callable_mp ( this ,  & EditorPropertyTextEnum : : _custom_value_submitted ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									accept_button  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									accept_button - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_layout - > add_child ( accept_button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									accept_button - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyTextEnum : : _custom_value_accepted ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cancel_button  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cancel_button - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_layout - > add_child ( cancel_button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cancel_button - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyTextEnum : : _custom_value_canceled ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( option_button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( edit_button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( custom_value_edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( accept_button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( cancel_button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 14:08:50 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								//////////////////// LOCALE ////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLocale : : _locale_selected ( const  String  & p_locale )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p_locale ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLocale : : _locale_pressed ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! dialog )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dialog  =  memnew ( EditorLocaleDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dialog - > connect ( " locale_selected " ,  callable_mp ( this ,  & EditorPropertyLocale : : _locale_selected ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_child ( dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  locale_code  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 14:08:50 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									dialog - > set_locale ( locale_code ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dialog - > popup_locale_dialog ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLocale : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  locale_code  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 14:08:50 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									locale - > set_text ( locale_code ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									locale - > set_tooltip_text ( locale_code ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 14:08:50 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLocale : : setup ( const  String  & p_hint_text )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLocale : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											locale_edit - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Translation " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 14:08:50 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLocale : : _locale_focus_exited ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_locale_selected ( locale - > get_text ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyLocale : : EditorPropertyLocale ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									HBoxContainer  * locale_hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( locale_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									locale  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									locale_hb - > add_child ( locale ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-02 16:15:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									locale - > connect ( SceneStringName ( text_submitted ) ,  callable_mp ( this ,  & EditorPropertyLocale : : _locale_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-13 16:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									locale - > connect ( SceneStringName ( focus_exited ) ,  callable_mp ( this ,  & EditorPropertyLocale : : _locale_focus_exited ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 14:08:50 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									locale - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									locale_edit  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									locale_edit - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									locale_hb - > add_child ( locale_edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( locale ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dialog  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									locale_edit - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyLocale : : _locale_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 14:08:50 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								///////////////////// PATH /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyPath : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									path - > set_editable ( ! p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									path_edit - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyPath : : _path_selected ( const  String  & p_path )  {  
						 
					
						
							
								
									
										
										
										
											2024-10-07 11:12:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  full_path  =  p_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-11-18 12:25:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! global )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  ResourceUID : : ID  id  =  ResourceLoader : : get_resource_uid ( full_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( id  ! =  ResourceUID : : INVALID_ID )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											full_path  =  ResourceUID : : get_singleton ( ) - > id_to_text ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 11:12:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  full_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 11:12:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								String  EditorPropertyPath : : _get_path_text ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  full_path  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( full_path . begins_with ( " uid:// " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-14 23:22:59 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										full_path  =  ResourceUID : : uid_to_path ( full_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 11:12:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  full_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyPath : : _path_pressed ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! dialog )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dialog  =  memnew ( EditorFileDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										dialog - > connect ( " file_selected " ,  callable_mp ( this ,  & EditorPropertyPath : : _path_selected ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dialog - > connect ( " dir_selected " ,  callable_mp ( this ,  & EditorPropertyPath : : _path_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										add_child ( dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 11:12:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  full_path  =  _get_path_text ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dialog - > clear_filters ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( global )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dialog - > set_access ( EditorFileDialog : : ACCESS_FILESYSTEM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dialog - > set_access ( EditorFileDialog : : ACCESS_RESOURCES ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( folder )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-06 14:00:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										dialog - > set_file_mode ( EditorFileDialog : : FILE_MODE_OPEN_DIR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										dialog - > set_current_dir ( full_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-06 14:00:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										dialog - > set_file_mode ( save_mode  ?  EditorFileDialog : : FILE_MODE_SAVE_FILE  :  EditorFileDialog : : FILE_MODE_OPEN_FILE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  extensions . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  e  =  extensions [ i ] . strip_edges ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! e . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												dialog - > add_filter ( extensions [ i ] . strip_edges ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dialog - > set_current_path ( full_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-11 18:45:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									dialog - > popup_file_dialog ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyPath : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2024-10-07 11:12:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  full_path  =  _get_path_text ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									path - > set_text ( full_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									path - > set_tooltip_text ( full_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyPath : : setup ( const  Vector < String >  & p_extensions ,  bool  p_folder ,  bool  p_global )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									extensions  =  p_extensions ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									folder  =  p_folder ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									global  =  p_global ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-12 16:04:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyPath : : set_save_mode ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									save_mode  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 11:44:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyPath : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-25 13:10:29 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( folder )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												path_edit - > set_button_icon ( get_editor_theme_icon ( SNAME ( " FolderBrowse " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-25 13:10:29 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												path_edit - > set_button_icon ( get_editor_theme_icon ( SNAME ( " FileBrowse " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-25 13:10:29 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 11:44:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyPath : : _path_focus_exited ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_path_selected ( path - > get_text ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 02:59:19 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyPath : : _drop_data_fw ( const  Point2  & p_point ,  const  Variant  & p_data ,  Control  * p_from )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Dictionary  drag_data  =  p_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! drag_data . has ( " type " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( String ( drag_data [ " type " ] )  ! =  " files " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Vector < String >  filesPaths  =  drag_data [ " files " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( filesPaths . size ( )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 11:12:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_path_selected ( filesPaths [ 0 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-16 02:59:19 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  EditorPropertyPath : : _can_drop_data_fw ( const  Point2  & p_point ,  const  Variant  & p_data ,  Control  * p_from )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Dictionary  drag_data  =  p_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! drag_data . has ( " type " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( String ( drag_data [ " type " ] )  ! =  " files " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Vector < String >  filesPaths  =  drag_data [ " files " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( filesPaths . size ( )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  String  & extension  :  extensions )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( filesPaths [ 0 ] . ends_with ( extension . substr ( 1 ,  extension . size ( )  -  1 ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								EditorPropertyPath : : EditorPropertyPath ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-08-23 11:44:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									HBoxContainer  * path_hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( path_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									path  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-14 03:37:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SET_DRAG_FORWARDING_CDU ( path ,  EditorPropertyPath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-19 13:27:18 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									path - > set_structured_text_bidi_override ( TextServer : : STRUCTURED_TEXT_FILE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 11:44:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									path_hb - > add_child ( path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-02 16:15:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									path - > connect ( SceneStringName ( text_submitted ) ,  callable_mp ( this ,  & EditorPropertyPath : : _path_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-13 16:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									path - > connect ( SceneStringName ( focus_exited ) ,  callable_mp ( this ,  & EditorPropertyPath : : _path_focus_exited ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-23 11:44:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									path - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									path_edit  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									path_edit - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									path_hb - > add_child ( path_edit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_focusable ( path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									dialog  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									path_edit - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyPath : : _path_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 21:58:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								///////////////////// CLASS NAME /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyClassName : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									property - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 21:58:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyClassName : : setup ( const  String  & p_base_type ,  const  String  & p_selected_type )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									base_type  =  p_base_type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dialog - > set_base_type ( base_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									selected_type  =  p_selected_type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									property - > set_text ( selected_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyClassName : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  s  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 21:58:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									property - > set_text ( s ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									selected_type  =  s ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyClassName : : _property_selected ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-07-06 23:07:21 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									dialog - > popup_create ( true ,  true ,  get_edited_property_value ( ) ,  get_edited_property ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 21:58:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyClassName : : _dialog_created ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									selected_type  =  dialog - > get_selected_type ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  selected_type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 21:58:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyClassName : : EditorPropertyClassName ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									property  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									property - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( property ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( property ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									property - > set_text ( selected_type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									property - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyClassName : : _property_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 21:58:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									dialog  =  memnew ( CreateDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dialog - > set_base_type ( base_type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									dialog - > connect ( " create " ,  callable_mp ( this ,  & EditorPropertyClassName : : _dialog_created ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 21:58:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									add_child ( dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								///////////////////// CHECK /////////////////////////
  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyCheck : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									checkbox - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyCheck : : _checkbox_pressed ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  checkbox - > is_pressed ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyCheck : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  c  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									checkbox - > set_pressed ( c ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									checkbox - > set_disabled ( is_read_only ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyCheck : : EditorPropertyCheck ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									checkbox  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									checkbox - > set_text ( TTR ( " On " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( checkbox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( checkbox ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									checkbox - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyCheck : : _checkbox_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// ENUM /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyEnum : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									options - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyEnum : : _option_selected ( int  p_which )  {  
						 
					
						
							
								
									
										
										
										
											2019-02-21 13:07:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int64_t  val  =  options - > get_item_metadata ( p_which ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  val ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyEnum : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Variant  current  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-13 13:04:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( current . get_type ( )  = =  Variant : : NIL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										options - > select ( - 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-12 02:23:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										options - > set_text ( " <null> " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-13 13:04:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-12 15:18:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-13 13:04:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int64_t  which  =  current ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-12 15:18:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  options - > get_item_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 13:07:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( which  = =  ( int64_t ) options - > get_item_metadata ( i ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-12 15:18:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											options - > select ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-12 02:23:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									options - > select ( - 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									options - > set_text ( itos ( which ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyEnum : : setup ( const  Vector < String >  & p_options )  {  
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									options - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-31 15:28:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									HashMap < int64_t ,  Vector < String > >  items ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 13:07:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int64_t  current_val  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-31 15:28:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( const  String  & option  :  p_options )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Vector < String >  text_split  =  option . split ( " : " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( text_split . size ( )  ! =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-13 05:31:51 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											current_val  =  text_split [ 1 ] . to_int ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-31 15:28:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										items [ current_val ] . push_back ( text_split [ 0 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-09 16:10:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										current_val  + =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-31 15:28:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  KeyValue < int64_t ,  Vector < String > >  & K  :  items )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										options - > add_item ( String ( " ,  " ) . join ( K . value ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										options - > set_item_metadata ( - 1 ,  K . key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-14 18:15:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyEnum : : set_option_button_clip ( bool  p_enable )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									options - > set_clip_text ( p_enable ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								EditorPropertyEnum : : EditorPropertyEnum ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									options  =  memnew ( OptionButton ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									options - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									options - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-23 18:29:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									options - > set_auto_translate_mode ( AUTO_TRANSLATE_MODE_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_child ( options ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( options ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:21:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									options - > connect ( SceneStringName ( item_selected ) ,  callable_mp ( this ,  & EditorPropertyEnum : : _option_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// FLAGS /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyFlags : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( CheckBox  * check  :  flags )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										check - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-06 18:04:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyFlags : : _flag_toggled ( int  p_index )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uint32_t  value  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-06 18:04:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( flags [ p_index ] - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										value  | =  flag_values [ p_index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										value  & =  ~ flag_values [ p_index ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyFlags : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uint32_t  value  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  flags . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-06 18:04:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										flags [ i ] - > set_pressed ( ( value  &  flag_values [ i ] )  = =  flag_values [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyFlags : : setup ( const  Vector < String >  & p_options )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND ( flags . size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  first  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-06 18:04:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uint32_t  current_val ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  p_options . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 09:26:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// An empty option is not considered a "flag".
 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										String  option  =  p_options [ i ] . strip_edges ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 09:26:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( option . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  int  flag_index  =  flags . size ( ) ;  // Index of the next element (added by the code below).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Value for a flag can be explicitly overridden.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-14 14:25:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Vector < String >  text_split  =  option . split ( " : " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 09:26:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( text_split . size ( )  ! =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											current_val  =  text_split [ 1 ] . to_int ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											current_val  =  1  < <  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										flag_values . push_back ( current_val ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Create a CheckBox for the current flag.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CheckBox  * cb  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-14 14:25:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										cb - > set_text ( text_split [ 0 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 09:26:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										cb - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										cb - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyFlags : : _flag_toggled ) . bind ( flag_index ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-31 09:26:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										add_focusable ( cb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										vbox - > add_child ( cb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										flags . push_back ( cb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Can't use `i == 0` because we want to find the first none-empty option.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( first )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											set_label_reference ( cb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											first  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyFlags : : EditorPropertyFlags ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vbox  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( vbox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// LAYERS /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyLayersGrid : : _rename_pressed ( int  p_menu )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Show rename popup for active layer.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-07 15:14:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( renamed_layer_index  = =  INT32_MAX )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  name  =  names [ renamed_layer_index ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_dialog - > set_title ( vformat ( TTR ( " Renaming layer %d: " ) ,  renamed_layer_index  +  1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_dialog_text - > set_text ( name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_dialog_text - > select ( 0 ,  name . length ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_dialog - > popup_centered ( Size2 ( 300 ,  80 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_dialog_text - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLayersGrid : : _rename_operation_confirm ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  new_name  =  rename_dialog_text - > get_text ( ) . strip_edges ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( new_name . length ( )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " No name provided. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-12-05 17:56:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  if  ( new_name . contains_char ( ' / ' )  | |  new_name . contains_char ( ' \\ ' )  | |  new_name . contains_char ( ' : ' ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Name contains invalid characters. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									names . set ( renamed_layer_index ,  new_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tooltips . set ( renamed_layer_index ,  new_name  +  " \n "  +  vformat ( TTR ( " Bit %d, value %d " ) ,  renamed_layer_index ,  1  < <  renamed_layer_index ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " rename_confirmed " ) ,  renamed_layer_index ,  new_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EditorPropertyLayersGrid : : EditorPropertyLayersGrid ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_dialog  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VBoxContainer  * rename_dialog_vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_dialog - > add_child ( rename_dialog_vb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_dialog_text  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_dialog_vb - > add_margin_child ( TTR ( " Name: " ) ,  rename_dialog_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-07 19:31:19 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									rename_dialog - > set_ok_button_text ( TTR ( " Rename " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									add_child ( rename_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rename_dialog - > register_text_enter ( rename_dialog_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:28:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									rename_dialog - > connect ( SceneStringName ( confirmed ) ,  callable_mp ( this ,  & EditorPropertyLayersGrid : : _rename_operation_confirm ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									layer_rename  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									layer_rename - > add_item ( TTR ( " Rename layer " ) ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( layer_rename ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:13:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									layer_rename - > connect ( SceneStringName ( id_pressed ) ,  callable_mp ( this ,  & EditorPropertyLayersGrid : : _rename_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Size2  EditorPropertyLayersGrid : : get_grid_size ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Font >  font  =  get_theme_font ( SceneStringName ( font ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  get_theme_font_size ( SceneStringName ( font_size ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  Vector2 ( 0 ,  font - > get_height ( font_size )  *  3 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyLayersGrid : : set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									read_only  =  p_read_only ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Size2  EditorPropertyLayersGrid : : get_minimum_size ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Size2  min_size  =  get_grid_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Add extra rows when expanded.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( expanded )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  int  bsize  =  ( min_size . height  *  80  /  100 )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  expansion_rows ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											min_size . y  + =  2  *  ( bsize  +  1 )  +  3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  min_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								String  EditorPropertyLayersGrid : : get_tooltip ( const  Point2  & p_pos )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  flag_rects . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( i  <  tooltips . size ( )  & &  flag_rects [ i ] . has_point ( p_pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  tooltips [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  String ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyLayersGrid : : _update_hovered ( const  Vector2  & p_position )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  expand_was_hovered  =  expand_hovered ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									expand_hovered  =  expand_rect . has_point ( p_position ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( expand_hovered  ! =  expand_was_hovered )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! expand_hovered )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  flag_rects . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( flag_rects [ i ] . has_point ( p_position ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Used to highlight the hovered flag in the layers grid.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												hovered_index  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Remove highlight when no square is hovered.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-07 15:14:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( hovered_index  ! =  INT32_MAX )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										hovered_index  =  INT32_MAX ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLayersGrid : : _on_hover_exit ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( expand_hovered )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										expand_hovered  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-07 15:14:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( hovered_index  ! =  INT32_MAX )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										hovered_index  =  INT32_MAX ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-07 15:14:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyLayersGrid : : _update_flag ( bool  p_replace )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( hovered_index  ! =  INT32_MAX )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Toggle the flag.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// We base our choice on the hovered flag, so that it always matches the hovered flag.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-07 15:14:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p_replace )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Replace all flags with the hovered flag ("solo mode"),
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// instead of toggling the hovered flags while preserving other flags' state.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( value  = =  uint32_t ( 1  < <  hovered_index ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// If the flag is already enabled, enable all other items and disable the current flag.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// This allows for quicker toggling.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												value  =  INT32_MAX  -  ( 1  < <  hovered_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												value  =  1  < <  hovered_index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-07 15:14:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( value  &  ( 1  < <  hovered_index ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												value  & =  ~ ( 1  < <  hovered_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												value  | =  ( 1  < <  hovered_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_signal ( SNAME ( " flag_changed " ) ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( expand_hovered )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										expanded  =  ! expanded ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										update_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLayersGrid : : gui_input ( const  Ref < InputEvent >  & p_ev )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( read_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Ref < InputEventMouseMotion >  mm  =  p_ev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( mm . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_update_hovered ( mm - > get_position ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Ref < InputEventMouseButton >  mb  =  p_ev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : LEFT  & &  mb - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_update_hovered ( mb - > get_position ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-07 15:14:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_update_flag ( mb - > is_command_or_control_pressed ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-24 11:51:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : RIGHT  & &  mb - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-07 15:14:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( hovered_index  ! =  INT32_MAX )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											renamed_layer_index  =  hovered_index ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_rename - > set_position ( get_screen_position ( )  +  mb - > get_position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_rename - > reset_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_rename - > popup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyLayersGrid : : _notification ( int  p_what )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_DRAW :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Size2  grid_size  =  get_grid_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											grid_size . x  =  get_size ( ) . x ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-24 11:51:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											flag_rects . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  prev_expansion_rows  =  expansion_rows ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											expansion_rows  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-24 11:51:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											const  int  bsize  =  ( grid_size . height  *  80  /  100 )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  int  h  =  bsize  *  2  +  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-15 13:14:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  color  =  get_theme_color ( read_only  ?  SNAME ( " highlight_disabled_color " )  :  SNAME ( " highlight_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  text_color  =  get_theme_color ( read_only  ?  SNAME ( " font_disabled_color " )  :  SceneStringName ( font_color ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											text_color . a  * =  0.5 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-15 13:14:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  text_color_on  =  get_theme_color ( read_only  ?  SNAME ( " font_disabled_color " )  :  SNAME ( " font_hover_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											text_color_on . a  * =  0.7 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											const  int  vofs  =  ( grid_size . height  -  h )  /  2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-07 15:14:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uint32_t  layer_index  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Point2  arrow_pos ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Point2  block_ofs ( 4 ,  vofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											while  ( true )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Point2  ofs  =  block_ofs ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  2 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( int  j  =  0 ;  j  <  layer_group_size ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														const  bool  on  =  value  &  ( 1  < <  layer_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Rect2  rect2  =  Rect2 ( ofs ,  Size2 ( bsize ,  bsize ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														color . a  =  on  ?  0.6  :  0.2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( layer_index  = =  hovered_index )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															// Add visual feedback when hovering a flag.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															color . a  + =  0.15 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														draw_rect ( rect2 ,  color ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														flag_rects . push_back ( rect2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														Ref < Font >  font  =  get_theme_font ( SceneStringName ( font ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														int  font_size  =  get_theme_font_size ( SceneStringName ( font_size ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														Vector2  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														offset . y  =  rect2 . size . y  *  0.75 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														draw_string ( font ,  rect2 . position  +  offset ,  itos ( layer_index  +  1 ) ,  HORIZONTAL_ALIGNMENT_CENTER ,  rect2 . size . x ,  font_size ,  on  ?  text_color_on  :  text_color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ofs . x  + =  bsize  +  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														+ + layer_index ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-05 14:09:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-24 11:51:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ofs . x  =  block_ofs . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ofs . y  + =  bsize  +  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( layer_index  > =  layer_count )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ! flag_rects . is_empty ( )  & &  ( expansion_rows  = =  0 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														const  Rect2  & last_rect  =  flag_rects [ flag_rects . size ( )  -  1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														arrow_pos  =  last_rect . get_end ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-24 11:51:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												int  block_size_x  =  layer_group_size  *  ( bsize  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												block_ofs . x  + =  block_size_x  +  3 ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-24 11:51:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( block_ofs . x  +  block_size_x  +  12  >  grid_size . width )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Keep last valid cell position for the expansion icon.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ! flag_rects . is_empty ( )  & &  ( expansion_rows  = =  0 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														const  Rect2  & last_rect  =  flag_rects [ flag_rects . size ( )  -  1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														arrow_pos  =  last_rect . get_end ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													+ + expansion_rows ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( expanded )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Expand grid to next line.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														block_ofs . x  =  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														block_ofs . y  + =  2  *  ( bsize  +  1 )  +  3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Skip remaining blocks.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ( expansion_rows  ! =  prev_expansion_rows )  & &  expanded )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												update_minimum_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ( expansion_rows  = =  0 )  & &  ( layer_index  = =  layer_count ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Whole grid was drawn, no need for expansion icon.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Ref < Texture2D >  arrow  =  get_theme_icon ( SNAME ( " arrow " ) ,  SNAME ( " Tree " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_FAIL_COND ( arrow . is_null ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  arrow_color  =  get_theme_color ( SNAME ( " highlight_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											arrow_color . a  =  expand_hovered  ?  1.0  :  0.6 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											arrow_pos . x  + =  2.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											arrow_pos . y  - =  arrow - > get_height ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Rect2  arrow_draw_rect ( arrow_pos ,  arrow - > get_size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											expand_rect  =  arrow_draw_rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( expanded )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												arrow_draw_rect . size . y  * =  - 1.0 ;  // Flip arrow vertically when expanded.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											RID  ci  =  get_canvas_item ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											arrow - > draw_rect ( ci ,  arrow_draw_rect ,  false ,  arrow_color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_MOUSE_EXIT :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-05 16:29:03 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_on_hover_exit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyLayersGrid : : set_flag ( uint32_t  p_flag )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									value  =  p_flag ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLayersGrid : : _bind_methods ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " flag_changed " ,  PropertyInfo ( Variant : : INT ,  " flag " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " rename_confirmed " ,  PropertyInfo ( Variant : : INT ,  " layer_id " ) ,  PropertyInfo ( Variant : : STRING ,  " new_name " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-16 12:07:19 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyLayers : : _notification ( int  p_what )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-16 12:07:19 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											button - > set_texture_normal ( get_editor_theme_icon ( SNAME ( " GuiTabMenuHl " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											button - > set_texture_pressed ( get_editor_theme_icon ( SNAME ( " GuiTabMenuHl " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											button - > set_texture_disabled ( get_editor_theme_icon ( SNAME ( " GuiTabMenu " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-16 12:07:19 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyLayers : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									button - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									grid - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLayers : : _grid_changed ( uint32_t  p_grid )  {  
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p_grid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLayers : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uint32_t  value  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									grid - > set_flag ( value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLayers : : setup ( LayerType  p_layer_type )  {  
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									layer_type  =  p_layer_type ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  layer_group_size  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  layer_count  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									switch  ( p_layer_type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  LAYER_RENDER_2D :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											basename  =  " layer_names/2d_render " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											layer_group_size  =  5 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_count  =  20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  LAYER_PHYSICS_2D :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											basename  =  " layer_names/2d_physics " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											layer_group_size  =  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_count  =  32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  LAYER_NAVIGATION_2D :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-08 20:56:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											basename  =  " layer_names/2d_navigation " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											layer_group_size  =  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_count  =  32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  LAYER_RENDER_3D :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											basename  =  " layer_names/3d_render " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											layer_group_size  =  5 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_count  =  20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  LAYER_PHYSICS_3D :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											basename  =  " layer_names/3d_physics " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											layer_group_size  =  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_count  =  32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  LAYER_NAVIGATION_3D :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-08 20:56:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											basename  =  " layer_names/3d_navigation " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											layer_group_size  =  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_count  =  32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-10 07:14:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  LAYER_AVOIDANCE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											basename  =  " layer_names/avoidance " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_group_size  =  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											layer_count  =  32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector < String >  names ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-28 10:27:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector < String >  tooltips ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  layer_count ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										String  name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-11 16:01:38 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ProjectSettings : : get_singleton ( ) - > has_setting ( basename  +  vformat ( " /layer_%d " ,  i  +  1 ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 16:43:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											name  =  GLOBAL_GET ( basename  +  vformat ( " /layer_%d " ,  i  +  1 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( name . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-11 16:01:38 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											name  =  vformat ( TTR ( " Layer %d " ) ,  i  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										names . push_back ( name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-28 10:27:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										tooltips . push_back ( name  +  " \n "  +  vformat ( TTR ( " Bit %d, value %d " ) ,  i ,  1  < <  i ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									grid - > names  =  names ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-28 10:27:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									grid - > tooltips  =  tooltips ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									grid - > layer_group_size  =  layer_group_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									grid - > layer_count  =  layer_count ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyLayers : : set_layer_name ( int  p_index ,  const  String  & p_name )  {  
						 
					
						
							
								
									
										
										
										
											2022-10-06 18:51:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  String  property_name  =  basename  +  vformat ( " /layer_%d " ,  p_index  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ProjectSettings : : get_singleton ( ) - > has_setting ( property_name ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ProjectSettings : : get_singleton ( ) - > set ( property_name ,  p_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ProjectSettings : : get_singleton ( ) - > save ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-06 18:51:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								String  EditorPropertyLayers : : get_layer_name ( int  p_index )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  String  property_name  =  basename  +  vformat ( " /layer_%d " ,  p_index  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ProjectSettings : : get_singleton ( ) - > has_setting ( property_name ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 16:43:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  GLOBAL_GET ( property_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-06 18:51:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  String ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLayers : : _button_pressed ( )  {  
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  layer_count  =  grid - > layer_count ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									layers - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  layer_count ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-06 18:51:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										const  String  name  =  get_layer_name ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( name . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-06 18:51:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										layers - > add_check_item ( name ,  i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										int  idx  =  layers - > get_item_index ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										layers - > set_item_checked ( idx ,  grid - > value  &  ( 1  < <  i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-06 18:51:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( layers - > get_item_count ( )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										layers - > add_item ( TTR ( " No Named Layers " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										layers - > set_item_disabled ( 0 ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									layers - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									layers - > add_icon_item ( get_editor_theme_icon ( " Edit " ) ,  TTR ( " Edit Layer Names " ) ,  grid - > layer_count ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-06 18:51:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-12 09:37:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Rect2  gp  =  button - > get_screen_rect ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-06 00:57:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									layers - > reset_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-12 09:37:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector2  popup_pos  =  gp . position  -  Vector2 ( layers - > get_contents_minimum_size ( ) . x ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									layers - > set_position ( popup_pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									layers - > popup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyLayers : : _menu_pressed ( int  p_menu )  {  
						 
					
						
							
								
									
										
										
										
											2020-06-07 15:14:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( uint32_t ( p_menu )  = =  grid - > layer_count )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-10 18:10:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ProjectSettingsEditor : : get_singleton ( ) - > popup_project_settings ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-06 18:51:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ProjectSettingsEditor : : get_singleton ( ) - > set_general_page ( basename ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-06 18:51:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( grid - > value  &  ( 1  < <  p_menu ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											grid - > value  & =  ~ ( 1  < <  p_menu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											grid - > value  | =  ( 1  < <  p_menu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										grid - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										layers - > set_item_checked ( layers - > get_item_index ( p_menu ) ,  grid - > value  &  ( 1  < <  p_menu ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_grid_changed ( grid - > value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyLayers : : _refresh_names ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									setup ( layer_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								EditorPropertyLayers : : EditorPropertyLayers ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									HBoxContainer  * hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hb - > set_clip_contents ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_child ( hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									grid  =  memnew ( EditorPropertyLayersGrid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									grid - > connect ( " flag_changed " ,  callable_mp ( this ,  & EditorPropertyLayers : : _grid_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-20 21:30:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									grid - > connect ( " rename_confirmed " ,  callable_mp ( this ,  & EditorPropertyLayers : : set_layer_name ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									grid - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hb - > add_child ( grid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-16 12:07:19 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									button  =  memnew ( TextureButton ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									button - > set_stretch_mode ( TextureButton : : STRETCH_KEEP_CENTERED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-21 02:18:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									button - > set_toggle_mode ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									button - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyLayers : : _button_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									hb - > add_child ( button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_bottom_editor ( hb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-29 15:26:07 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									layers  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( layers ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 18:43:32 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									layers - > set_hide_on_checkable_item_selection ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:13:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									layers - > connect ( SceneStringName ( id_pressed ) ,  callable_mp ( this ,  & EditorPropertyLayers : : _menu_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:56:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									layers - > connect ( " popup_hide " ,  callable_mp ( ( BaseButton  * ) button ,  & BaseButton : : set_pressed ) . bind ( false ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-09 17:52:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ProjectSettings : : get_singleton ( ) - > connect ( " settings_changed " ,  callable_mp ( this ,  & EditorPropertyLayers : : _refresh_names ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-01-13 15:43:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								///////////////////// INT /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyInteger : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-01-15 20:37:08 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyInteger : : _value_changed ( int64_t  val )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  val ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyInteger : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int64_t  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_value_no_signal ( val ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-15 20:37:08 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# ifdef DEBUG_ENABLED 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// If spin (currently EditorSplinSlider : Range) is changed so that it can use int64_t, then the below warning wouldn't be a problem.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( val  ! =  ( int64_t ) ( double ) ( val ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										WARN_PRINT ( " Cannot reliably represent ' "  +  itos ( val )  +  " ' in the inspector, value is too large. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyInteger : : setup ( int64_t  p_min ,  int64_t  p_max ,  int64_t  p_step ,  bool  p_hide_slider ,  bool  p_allow_greater ,  bool  p_allow_lesser ,  const  String  & p_suffix )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									spin - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-03 11:57:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_step ( p_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_hide_slider ( p_hide_slider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-16 09:13:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_allow_greater ( p_allow_greater ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_allow_lesser ( p_allow_lesser ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-20 00:24:41 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyInteger : : EditorPropertyInteger ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-05 19:20:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_editing_integer ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_child ( spin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( spin ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyInteger : : _value_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// OBJECT ID /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyObjectID : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyObjectID : : _edit_pressed ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " object_id_selected " ) ,  get_edited_property ( ) ,  get_edited_property_value ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyObjectID : : update_property ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  type  =  base_type ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( type . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										type  =  " Object " ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ObjectID  id  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-12 14:24:06 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( id . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-30 02:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										edit - > set_text ( type  +  "  ID:  "  +  uitos ( id ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-29 17:58:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										edit - > set_tooltip_text ( type  +  "  ID:  "  +  uitos ( id ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										edit - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										edit - > set_button_icon ( EditorNode : : get_singleton ( ) - > get_class_icon ( type ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-25 00:15:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										edit - > set_text ( TTR ( " <empty> " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-29 17:58:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										edit - > set_tooltip_text ( " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										edit - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										edit - > set_button_icon ( Ref < Texture2D > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyObjectID : : setup ( const  String  & p_base_type )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									base_type  =  p_base_type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyObjectID : : EditorPropertyObjectID ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( edit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-29 17:58:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > set_text_overrun_behavior ( TextServer : : OVERRUN_TRIM_ELLIPSIS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyObjectID : : _edit_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-30 02:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								///////////////////// SIGNAL /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertySignal : : _edit_pressed ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Signal  signal  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-30 02:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " object_id_selected " ) ,  get_edited_property ( ) ,  signal . get_object_id ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertySignal : : update_property ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  type  =  base_type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Signal  signal  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-30 02:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > set_text ( " Signal:  "  +  signal . get_name ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Signals " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-30 02:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertySignal : : EditorPropertySignal ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( edit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertySignal : : _edit_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-30 02:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// CALLABLE /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyCallable : : update_property ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  type  =  base_type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Callable  callable  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-30 02:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > set_text ( " Callable " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Callable " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-30 02:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyCallable : : EditorPropertyCallable ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								///////////////////// FLOAT /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyFloat : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyFloat : : _value_changed ( double  val )  {  
						 
					
						
							
								
									
										
										
										
											2023-09-23 16:27:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( radians_as_degrees )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 17:45:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										val  =  Math : : deg_to_rad ( val ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  val ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyFloat : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									double  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 16:27:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( radians_as_degrees )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 17:45:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										val  =  Math : : rad_to_deg ( val ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_value_no_signal ( val ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 16:27:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyFloat : : setup ( double  p_min ,  double  p_max ,  double  p_step ,  bool  p_hide_slider ,  bool  p_exp_range ,  bool  p_greater ,  bool  p_lesser ,  const  String  & p_suffix ,  bool  p_radians_as_degrees )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									radians_as_degrees  =  p_radians_as_degrees ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									spin - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-03 11:57:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_step ( p_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_hide_slider ( p_hide_slider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									spin - > set_exp_ratio ( p_exp_range ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-16 09:13:41 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_allow_greater ( p_greater ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_allow_lesser ( p_lesser ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyFloat : : EditorPropertyFloat ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_child ( spin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( spin ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyFloat : : _value_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// EASING /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyEasing : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyEasing : : _drag_easing ( const  Ref < InputEvent >  & p_ev )  {  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( is_read_only ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Ref < InputEventMouseButton >  mb  =  p_ev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( mb . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mb - > is_double_click ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : LEFT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_setup_spin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mb - > is_pressed ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : RIGHT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-31 17:43:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											preset - > set_position ( easing_draw - > get_screen_position ( )  +  mb - > get_position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											preset - > reset_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											preset - > popup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Ensure the easing doesn't appear as being dragged
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											dragging  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											easing_draw - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mb - > get_button_index ( )  = =  MouseButton : : LEFT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											dragging  =  mb - > is_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Update to display the correct dragging color
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											easing_draw - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Ref < InputEventMouseMotion >  mm  =  p_ev ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-08 00:55:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( dragging  & &  mm . is_valid ( )  & &  ( mm - > get_button_mask ( ) . has_flag ( MouseButtonMask : : LEFT ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										float  rel  =  mm - > get_relative ( ) . x ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( rel  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( flip )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											rel  =  - rel ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										bool  sg  =  val  <  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										val  =  Math : : absf ( val ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										val  =  Math : : log ( val )  /  Math : : log ( ( float ) 2.0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 14:48:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Logarithmic space.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										val  + =  rel  *  0.05 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										val  =  Math : : pow ( 2.0f ,  val ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( sg )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											val  =  - val ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 14:48:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// 0 is a singularity, but both positive and negative values
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// are otherwise allowed. Enforce 0+ as workaround.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( Math : : is_zero_approx ( val ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											val  =  0.00001 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Limit to a reasonable value to prevent the curve going into infinity,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// which can cause crashes and other issues.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										val  =  CLAMP ( val ,  - 1'000'000 ,  1'000'000 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_changed ( get_edited_property ( ) ,  val ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										easing_draw - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyEasing : : _draw_easing ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RID  ci  =  easing_draw - > get_canvas_item ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Size2  s  =  easing_draw - > get_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-25 17:12:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  int  point_count  =  48 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  float  exp  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Ref < Font >  f  =  get_theme_font ( SceneStringName ( font ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  get_theme_font_size ( SceneStringName ( font_size ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Color  font_color  =  get_theme_color ( is_read_only ( )  ?  SNAME ( " font_uneditable_color " )  :  SceneStringName ( font_color ) ,  SNAME ( " LineEdit " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Color  line_color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( dragging )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										line_color  =  get_theme_color ( SNAME ( " accent_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										line_color  =  get_theme_color ( is_read_only ( )  ?  SNAME ( " font_uneditable_color " )  :  SceneStringName ( font_color ) ,  SNAME ( " LineEdit " ) )  *  Color ( 1 ,  1 ,  1 ,  0.9 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-25 17:12:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector < Point2 >  points ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  < =  point_count ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  ifl  =  i  /  float ( point_count ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										const  float  h  =  1.0  -  Math : : ease ( ifl ,  exp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( flip )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ifl  =  1.0  -  ifl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-25 17:12:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										points . push_back ( Point2 ( ifl  *  s . width ,  h  *  s . height ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-25 17:12:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									easing_draw - > draw_polyline ( points ,  line_color ,  1.0 ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 14:48:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Draw more decimals for small numbers since higher precision is usually required for fine adjustments.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  decimals ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( Math : : abs ( exp )  <  0.1  -  CMP_EPSILON )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										decimals  =  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( Math : : abs ( exp )  <  1  -  CMP_EPSILON )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										decimals  =  3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( Math : : abs ( exp )  <  10  -  CMP_EPSILON )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										decimals  =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										decimals  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									f - > draw_string ( ci ,  Point2 ( 10 ,  10  +  f - > get_ascent ( font_size ) ) ,  TS - > format_number ( rtos ( exp ) . pad_decimals ( decimals ) ) ,  HORIZONTAL_ALIGNMENT_LEFT ,  - 1 ,  font_size ,  font_color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyEasing : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									easing_draw - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyEasing : : _set_preset ( int  p_preset )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  const  float  preset_value [ EASING_MAX ]  =  {  0.0 ,  1.0 ,  2.0 ,  0.5 ,  - 2.0 ,  - 0.5  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  preset_value [ p_preset ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									easing_draw - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyEasing : : _setup_spin ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > setup_and_show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > get_line_edit ( ) - > set_text ( TS - > format_number ( rtos ( get_edited_property_value ( ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyEasing : : _spin_value_changed ( double  p_value )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// 0 is a singularity, but both positive and negative values
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// are otherwise allowed. Enforce 0+ as workaround.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( Math : : is_zero_approx ( p_value ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										p_value  =  0.00001 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 14:48:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Limit to a reasonable value to prevent the curve going into infinity,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// which can cause crashes and other issues.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p_value  =  CLAMP ( p_value ,  - 1'000'000 ,  1'000'000 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-07 18:17:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( positive_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Force a positive or zero value if a negative value was manually entered by double-clicking.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										p_value  =  MAX ( 0.0 ,  p_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_spin_focus_exited ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyEasing : : _spin_focus_exited ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-06 16:04:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Ensure the easing doesn't appear as being dragged
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dragging  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									easing_draw - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-07 18:17:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyEasing : : setup ( bool  p_positive_only ,  bool  p_flip )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									flip  =  p_flip ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-07 18:17:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									positive_only  =  p_positive_only ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyEasing : : _notification ( int  p_what )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											preset - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											preset - > add_icon_item ( get_editor_theme_icon ( SNAME ( " CurveLinear " ) ) ,  " Linear " ,  EASING_LINEAR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											preset - > add_icon_item ( get_editor_theme_icon ( SNAME ( " CurveIn " ) ) ,  " Ease In " ,  EASING_IN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											preset - > add_icon_item ( get_editor_theme_icon ( SNAME ( " CurveOut " ) ) ,  " Ease Out " ,  EASING_OUT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											preset - > add_icon_item ( get_editor_theme_icon ( SNAME ( " CurveConstant " ) ) ,  " Zero " ,  EASING_ZERO ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-07 18:17:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! positive_only )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												preset - > add_icon_item ( get_editor_theme_icon ( SNAME ( " CurveInOut " ) ) ,  " Ease In-Out " ,  EASING_IN_OUT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												preset - > add_icon_item ( get_editor_theme_icon ( SNAME ( " CurveOutIn " ) ) ,  " Ease Out-In " ,  EASING_OUT_IN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											easing_draw - > set_custom_minimum_size ( Size2 ( 0 ,  get_theme_font ( SceneStringName ( font ) ,  SNAME ( " Label " ) ) - > get_height ( get_theme_font_size ( SceneStringName ( font_size ) ,  SNAME ( " Label " ) ) )  *  2 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyEasing : : EditorPropertyEasing ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									easing_draw  =  memnew ( Control ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-13 16:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									easing_draw - > connect ( SceneStringName ( draw ) ,  callable_mp ( this ,  & EditorPropertyEasing : : _draw_easing ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									easing_draw - > connect ( SceneStringName ( gui_input ) ,  callable_mp ( this ,  & EditorPropertyEasing : : _drag_easing ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									easing_draw - > set_default_cursor_shape ( Control : : CURSOR_MOVE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									add_child ( easing_draw ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									preset  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( preset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:13:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									preset - > connect ( SceneStringName ( id_pressed ) ,  callable_mp ( this ,  & EditorPropertyEasing : : _set_preset ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_min ( - 100 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_max ( 100 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_step ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_hide_slider ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyEasing : : _spin_value_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-13 16:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > get_line_edit ( ) - > connect ( SceneStringName ( focus_exited ) ,  callable_mp ( this ,  & EditorPropertyEasing : : _spin_focus_exited ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 12:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( spin ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// RECT2 /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyRect2 : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-02 19:16:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyRect2 : : _value_changed ( double  val ,  const  String  & p_name )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Rect2  r2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r2 . position . x  =  spin [ 0 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 19:16:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									r2 . position . y  =  spin [ 1 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r2 . size . x  =  spin [ 2 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									r2 . size . y  =  spin [ 3 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  r2 ,  p_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyRect2 : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Rect2  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 0 ] - > set_value_no_signal ( val . position . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 1 ] - > set_value_no_signal ( val . position . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 2 ] - > set_value_no_signal ( val . size . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 3 ] - > set_value_no_signal ( val . size . y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyRect2 : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Color  * colors  =  _get_property_colors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 18:19:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												spin [ i ] - > add_theme_color_override ( " label_color " ,  colors [ i  %  2 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyRect2 : : setup ( double  p_min ,  double  p_max ,  double  p_step ,  bool  p_hide_slider ,  const  String  & p_suffix )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_step ( p_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_hide_slider ( p_hide_slider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 16:09:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EditorPropertyRect2 : : EditorPropertyRect2 ( bool  p_force_wide )  {  
						 
					
						
							
								
									
										
										
										
											2020-10-21 01:34:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  horizontal  =  p_force_wide  | |  bool ( EDITOR_GET ( " interface/inspector/horizontal_vector_types_editing " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 20:51:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  grid  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-23 00:20:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BoxContainer  * bc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_force_wide )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_child ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( horizontal )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 20:51:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bc  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-23 00:20:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										add_child ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_bottom_editor ( bc ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 20:51:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc - > add_child ( memnew ( HBoxContainer ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc - > add_child ( memnew ( HBoxContainer ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										grid  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-23 00:20:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_child ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									static  const  char  * desc [ 4 ]  =  {  " x " ,  " y " ,  " w " ,  " h "  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ]  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_label ( desc [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 20:51:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( grid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bc - > get_child ( i  /  2 ) - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bc - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										add_focusable ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyRect2 : : _value_changed ) . bind ( desc [ i ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-23 00:20:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( horizontal )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											spin [ i ] - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! horizontal )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_label_reference ( spin [ 0 ] ) ;  //show text and buttons around this
 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-09-23 00:20:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-26 14:17:11 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								///////////////////// RECT2i /////////////////////////
  
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyRect2i : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyRect2i : : _value_changed ( double  val ,  const  String  & p_name )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Rect2i  r2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r2 . position . x  =  spin [ 0 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r2 . position . y  =  spin [ 1 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r2 . size . x  =  spin [ 2 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r2 . size . y  =  spin [ 3 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  r2 ,  p_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyRect2i : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Rect2i  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 0 ] - > set_value_no_signal ( val . position . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 1 ] - > set_value_no_signal ( val . position . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 2 ] - > set_value_no_signal ( val . size . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 3 ] - > set_value_no_signal ( val . size . y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyRect2i : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Color  * colors  =  _get_property_colors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 18:19:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												spin [ i ] - > add_theme_color_override ( " label_color " ,  colors [ i  %  2 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyRect2i : : setup ( int  p_min ,  int  p_max ,  const  String  & p_suffix )  {  
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_step ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-06 00:09:37 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_editing_integer ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyRect2i : : EditorPropertyRect2i ( bool  p_force_wide )  {  
						 
					
						
							
								
									
										
										
										
											2020-10-21 01:34:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  horizontal  =  p_force_wide  | |  bool ( EDITOR_GET ( " interface/inspector/horizontal_vector_types_editing " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 20:51:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  grid  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BoxContainer  * bc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_force_wide )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_child ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( horizontal )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 20:51:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bc  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										add_child ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_bottom_editor ( bc ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 20:51:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc - > add_child ( memnew ( HBoxContainer ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc - > add_child ( memnew ( HBoxContainer ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										grid  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_child ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  const  char  * desc [ 4 ]  =  {  " x " ,  " y " ,  " w " ,  " h "  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ]  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_label ( desc [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 20:51:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( grid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bc - > get_child ( i  /  2 ) - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bc - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										add_focusable ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyRect2i : : _value_changed ) . bind ( desc [ i ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( horizontal )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											spin [ i ] - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! horizontal )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_label_reference ( spin [ 0 ] ) ;  //show text and buttons around this
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								///////////////////// PLANE /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyPlane : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-02 19:16:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyPlane : : _value_changed ( double  val ,  const  String  & p_name )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Plane  p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . normal . x  =  spin [ 0 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . normal . y  =  spin [ 1 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . normal . z  =  spin [ 2 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-10 16:47:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									p . d  =  spin [ 3 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p ,  p_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyPlane : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Plane  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 0 ] - > set_value_no_signal ( val . normal . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 1 ] - > set_value_no_signal ( val . normal . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 2 ] - > set_value_no_signal ( val . normal . z ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 3 ] - > set_value_no_signal ( val . d ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyPlane : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Color  * colors  =  _get_property_colors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 18:19:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												spin [ i ] - > add_theme_color_override ( " label_color " ,  colors [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyPlane : : setup ( double  p_min ,  double  p_max ,  double  p_step ,  bool  p_hide_slider ,  const  String  & p_suffix )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_step ( p_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_hide_slider ( p_hide_slider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 16:09:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 18:09:19 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 3 ] - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EditorPropertyPlane : : EditorPropertyPlane ( bool  p_force_wide )  {  
						 
					
						
							
								
									
										
										
										
											2020-10-21 01:34:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  horizontal  =  p_force_wide  | |  bool ( EDITOR_GET ( " interface/inspector/horizontal_vector_types_editing " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BoxContainer  * bc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_force_wide )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_child ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( horizontal )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bc  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_child ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_bottom_editor ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_child ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									static  const  char  * desc [ 4 ]  =  {  " x " ,  " y " ,  " z " ,  " d "  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ]  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_label ( desc [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bc - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										add_focusable ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyPlane : : _value_changed ) . bind ( desc [ i ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( horizontal )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											spin [ i ] - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! horizontal )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_label_reference ( spin [ 0 ] ) ;  //show text and buttons around this
 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 07:02:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								///////////////////// QUATERNION /////////////////////////
  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyQuaternion : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  3 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ] - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyQuaternion : : _edit_custom_value ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( edit_button - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										edit_custom_bc - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  3 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											euler [ i ] - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										edit_custom_bc - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											spin [ i ] - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyQuaternion : : _custom_value_changed ( double  val )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_euler . x  =  euler [ 0 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_euler . y  =  euler [ 1 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_euler . z  =  euler [ 2 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector3  v ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 17:45:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									v . x  =  Math : : deg_to_rad ( edit_euler . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									v . y  =  Math : : deg_to_rad ( edit_euler . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									v . z  =  Math : : deg_to_rad ( edit_euler . z ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-01 08:11:09 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Quaternion  temp_q  =  Quaternion : : from_euler ( v ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 0 ] - > set_value_no_signal ( temp_q . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 1 ] - > set_value_no_signal ( temp_q . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 2 ] - > set_value_no_signal ( temp_q . z ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 3 ] - > set_value_no_signal ( temp_q . w ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-07 22:16:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_value_changed ( - 1 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 07:02:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyQuaternion : : _value_changed ( double  val ,  const  String  & p_name )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Quaternion  p ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									p . x  =  spin [ 0 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . y  =  spin [ 1 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . z  =  spin [ 2 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . w  =  spin [ 3 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p ,  p_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  EditorPropertyQuaternion : : is_grabbing_euler ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  is_grabbing  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  3 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										is_grabbing  | =  euler [ i ] - > is_grabbing ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  is_grabbing ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 07:02:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyQuaternion : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Quaternion  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 0 ] - > set_value_no_signal ( val . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 1 ] - > set_value_no_signal ( val . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 2 ] - > set_value_no_signal ( val . z ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 3 ] - > set_value_no_signal ( val . w ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! is_grabbing_euler ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-01 21:54:19 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Vector3  v  =  val . normalized ( ) . get_euler ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 17:45:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										edit_euler . x  =  Math : : rad_to_deg ( v . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										edit_euler . y  =  Math : : rad_to_deg ( v . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										edit_euler . z  =  Math : : rad_to_deg ( v . z ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										euler [ 0 ] - > set_value_no_signal ( edit_euler . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ 1 ] - > set_value_no_signal ( edit_euler . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ 2 ] - > set_value_no_signal ( edit_euler . z ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyQuaternion : : _warning_pressed ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									warning_dialog - > popup_centered ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 07:02:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyQuaternion : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Color  * colors  =  _get_property_colors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 18:19:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												spin [ i ] - > add_theme_color_override ( " label_color " ,  colors [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  3 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												euler [ i ] - > add_theme_color_override ( " label_color " ,  colors [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											edit_button - > set_button_icon ( get_editor_theme_icon ( SNAME ( " Edit " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											euler_label - > add_theme_color_override ( SceneStringName ( font_color ) ,  get_theme_color ( SNAME ( " property_color " ) ,  SNAME ( " EditorProperty " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											warning - > set_button_icon ( get_editor_theme_icon ( SNAME ( " NodeWarning " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 15:57:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											warning - > add_theme_color_override ( SceneStringName ( font_color ) ,  get_theme_color ( SNAME ( " warning_color " ) ,  EditorStringName ( Editor ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyQuaternion : : setup ( double  p_min ,  double  p_max ,  double  p_step ,  bool  p_hide_slider ,  const  String  & p_suffix ,  bool  p_hide_editor )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_step ( p_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_hide_slider ( p_hide_slider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 16:09:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 18:09:19 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Quaternion is inherently unitless, however someone may want to use it as
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// a generic way to store 4 values, so we'll still respect the suffix.
 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  3 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ] - > set_min ( - 360 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ] - > set_max ( 360 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ] - > set_step ( 0.1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ] - > set_hide_slider ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ] - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ] - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ] - > set_suffix ( U " \u00B0 " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_hide_editor )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										edit_button - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 07:02:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EditorPropertyQuaternion : : EditorPropertyQuaternion ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-09-23 00:20:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  horizontal  =  EDITOR_GET ( " interface/inspector/horizontal_vector_types_editing " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VBoxContainer  * bc  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_bc  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BoxContainer  * edit_custom_layout ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( horizontal )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										default_layout  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										edit_custom_layout  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										set_bottom_editor ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										default_layout  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										edit_custom_layout  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit_custom_bc - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( bc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_bc - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									default_layout - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_layout - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bc - > add_child ( default_layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bc - > add_child ( edit_custom_bc ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									static  const  char  * desc [ 4 ]  =  {  " x " ,  " y " ,  " z " ,  " w "  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  4 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ]  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_label ( desc [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										default_layout - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										add_focusable ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyQuaternion : : _value_changed ) . bind ( desc [ i ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( horizontal )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											spin [ i ] - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									warning  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									warning - > set_text ( TTR ( " Temporary Euler may be changed implicitly! " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									warning - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									warning - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyQuaternion : : _warning_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									warning_dialog  =  memnew ( AcceptDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( warning_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									warning_dialog - > set_text ( TTR ( " Temporary Euler will not be stored in the object with the original value. Instead, it will be stored as Quaternion with irreversible conversion. \n This is due to the fact that the result of Euler->Quaternion can be determined uniquely, but the result of Quaternion->Euler can be multi-existent. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									euler_label  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-23 22:39:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									euler_label - > set_text ( TTR ( " Temporary Euler " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_bc - > add_child ( warning ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_bc - > add_child ( edit_custom_layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_custom_layout - > add_child ( euler_label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  3 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ]  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ] - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										euler [ i ] - > set_label ( desc [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										edit_custom_layout - > add_child ( euler [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_focusable ( euler [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										euler [ i ] - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyQuaternion : : _custom_value_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( horizontal )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											euler [ i ] - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_button  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_button - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit_button - > set_toggle_mode ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									default_layout - > add_child ( edit_button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit_button - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyQuaternion : : _edit_custom_value ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_focusable ( edit_button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-07 12:19:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! horizontal )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										set_label_reference ( spin [ 0 ] ) ;  //show text and buttons around this
 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// AABB /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyAABB : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  6 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-02 19:16:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyAABB : : _value_changed ( double  val ,  const  String  & p_name )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									AABB  p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . position . x  =  spin [ 0 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . position . y  =  spin [ 1 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . position . z  =  spin [ 2 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . size . x  =  spin [ 3 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . size . y  =  spin [ 4 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . size . z  =  spin [ 5 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p ,  p_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyAABB : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AABB  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 0 ] - > set_value_no_signal ( val . position . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 1 ] - > set_value_no_signal ( val . position . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 2 ] - > set_value_no_signal ( val . position . z ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 3 ] - > set_value_no_signal ( val . size . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 4 ] - > set_value_no_signal ( val . size . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 5 ] - > set_value_no_signal ( val . size . z ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyAABB : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Color  * colors  =  _get_property_colors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  6 ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 18:19:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												spin [ i ] - > add_theme_color_override ( " label_color " ,  colors [ i  %  3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyAABB : : setup ( double  p_min ,  double  p_max ,  double  p_step ,  bool  p_hide_slider ,  const  String  & p_suffix )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  6 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_step ( p_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_hide_slider ( p_hide_slider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 16:09:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyAABB : : EditorPropertyAABB ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									GridContainer  * g  =  memnew ( GridContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									g - > set_columns ( 3 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( g ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  const  char  * desc [ 6 ]  =  {  " x " ,  " y " ,  " z " ,  " w " ,  " h " ,  " d "  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  6 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ]  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_label ( desc [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										g - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_focusable ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyAABB : : _value_changed ) . bind ( desc [ i ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_bottom_editor ( g ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// TRANSFORM2D /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTransform2D : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  6 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-02 19:16:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTransform2D : : _value_changed ( double  val ,  const  String  & p_name )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Transform2D  p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p [ 0 ] [ 0 ]  =  spin [ 0 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									p [ 1 ] [ 0 ]  =  spin [ 1 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p [ 2 ] [ 0 ]  =  spin [ 2 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p [ 0 ] [ 1 ]  =  spin [ 3 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p [ 1 ] [ 1 ]  =  spin [ 4 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									p [ 2 ] [ 1 ]  =  spin [ 5 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p ,  p_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyTransform2D : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Transform2D  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 0 ] - > set_value_no_signal ( val [ 0 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 1 ] - > set_value_no_signal ( val [ 1 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 2 ] - > set_value_no_signal ( val [ 2 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 3 ] - > set_value_no_signal ( val [ 0 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 4 ] - > set_value_no_signal ( val [ 1 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 5 ] - > set_value_no_signal ( val [ 2 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTransform2D : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Color  * colors  =  _get_property_colors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  6 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// For Transform2D, use the 4th color (cyan) for the origin vector.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( i  %  3  = =  2 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 18:19:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													spin [ i ] - > add_theme_color_override ( " label_color " ,  colors [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 18:19:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													spin [ i ] - > add_theme_color_override ( " label_color " ,  colors [ i  %  3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTransform2D : : setup ( double  p_min ,  double  p_max ,  double  p_step ,  bool  p_hide_slider ,  const  String  & p_suffix )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  6 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_step ( p_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_hide_slider ( p_hide_slider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 16:09:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 18:09:19 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( i  %  3  = =  2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											spin [ i ] - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EditorPropertyTransform2D : : EditorPropertyTransform2D ( bool  p_include_origin )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									GridContainer  * g  =  memnew ( GridContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									g - > set_columns ( p_include_origin  ?  3  :  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_child ( g ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									static  const  char  * desc [ 6 ]  =  {  " xx " ,  " xy " ,  " xo " ,  " yx " ,  " yy " ,  " yo "  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  6 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ]  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_label ( desc [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p_include_origin  | |  i  %  3  ! =  2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											g - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_focusable ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyTransform2D : : _value_changed ) . bind ( desc [ i ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_bottom_editor ( g ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////// BASIS /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyBasis : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  9 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-02 19:16:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyBasis : : _value_changed ( double  val ,  const  String  & p_name )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Basis  p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p [ 0 ] [ 0 ]  =  spin [ 0 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									p [ 0 ] [ 1 ]  =  spin [ 1 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p [ 0 ] [ 2 ]  =  spin [ 2 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p [ 1 ] [ 0 ]  =  spin [ 3 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									p [ 1 ] [ 1 ]  =  spin [ 4 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									p [ 1 ] [ 2 ]  =  spin [ 5 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p [ 2 ] [ 0 ]  =  spin [ 6 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p [ 2 ] [ 1 ]  =  spin [ 7 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									p [ 2 ] [ 2 ]  =  spin [ 8 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p ,  p_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyBasis : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Basis  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 0 ] - > set_value_no_signal ( val [ 0 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 1 ] - > set_value_no_signal ( val [ 0 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 2 ] - > set_value_no_signal ( val [ 0 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 3 ] - > set_value_no_signal ( val [ 1 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 4 ] - > set_value_no_signal ( val [ 1 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 5 ] - > set_value_no_signal ( val [ 1 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 6 ] - > set_value_no_signal ( val [ 2 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 7 ] - > set_value_no_signal ( val [ 2 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 8 ] - > set_value_no_signal ( val [ 2 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyBasis : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Color  * colors  =  _get_property_colors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  9 ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 18:19:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												spin [ i ] - > add_theme_color_override ( " label_color " ,  colors [ i  %  3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyBasis : : setup ( double  p_min ,  double  p_max ,  double  p_step ,  bool  p_hide_slider ,  const  String  & p_suffix )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  9 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_step ( p_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_hide_slider ( p_hide_slider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 16:09:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 18:09:19 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Basis is inherently unitless, however someone may want to use it as
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// a generic way to store 9 values, so we'll still respect the suffix.
 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyBasis : : EditorPropertyBasis ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									GridContainer  * g  =  memnew ( GridContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									g - > set_columns ( 3 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( g ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									static  const  char  * desc [ 9 ]  =  {  " xx " ,  " xy " ,  " xz " ,  " yx " ,  " yy " ,  " yz " ,  " zx " ,  " zy " ,  " zz "  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  9 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ]  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_label ( desc [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										g - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_focusable ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyBasis : : _value_changed ) . bind ( desc [ i ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_bottom_editor ( g ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-24 03:21:23 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								///////////////////// TRANSFORM3D /////////////////////////
  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTransform3D : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  12 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 21:58:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTransform3D : : _value_changed ( double  val ,  const  String  & p_name )  {  
						 
					
						
							
								
									
										
										
										
											2020-10-17 01:08:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Transform3D  p ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									p . basis [ 0 ] [ 0 ]  =  spin [ 0 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									p . basis [ 0 ] [ 1 ]  =  spin [ 1 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . basis [ 0 ] [ 2 ]  =  spin [ 2 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . origin [ 0 ]  =  spin [ 3 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . basis [ 1 ] [ 0 ]  =  spin [ 4 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . basis [ 1 ] [ 1 ]  =  spin [ 5 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . basis [ 1 ] [ 2 ]  =  spin [ 6 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . origin [ 1 ]  =  spin [ 7 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . basis [ 2 ] [ 0 ]  =  spin [ 8 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . basis [ 2 ] [ 1 ]  =  spin [ 9 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . basis [ 2 ] [ 2 ]  =  spin [ 10 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									p . origin [ 2 ]  =  spin [ 11 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-18 13:01:24 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p ,  p_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 21:58:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTransform3D : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_using_transform ( get_edited_property_value ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-26 14:17:11 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 21:58:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTransform3D : : update_using_transform ( Transform3D  p_transform )  {  
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 0 ] - > set_value_no_signal ( p_transform . basis [ 0 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 1 ] - > set_value_no_signal ( p_transform . basis [ 0 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 2 ] - > set_value_no_signal ( p_transform . basis [ 0 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 3 ] - > set_value_no_signal ( p_transform . origin [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 4 ] - > set_value_no_signal ( p_transform . basis [ 1 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 5 ] - > set_value_no_signal ( p_transform . basis [ 1 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 6 ] - > set_value_no_signal ( p_transform . basis [ 1 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 7 ] - > set_value_no_signal ( p_transform . origin [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 8 ] - > set_value_no_signal ( p_transform . basis [ 2 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 9 ] - > set_value_no_signal ( p_transform . basis [ 2 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 10 ] - > set_value_no_signal ( p_transform . basis [ 2 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 11 ] - > set_value_no_signal ( p_transform . origin [ 2 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 21:58:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTransform3D : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Color  * colors  =  _get_property_colors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  12 ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-03 18:19:00 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												spin [ i ] - > add_theme_color_override ( " label_color " ,  colors [ i  %  4 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 22:27:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyTransform3D : : setup ( double  p_min ,  double  p_max ,  double  p_step ,  bool  p_hide_slider ,  const  String  & p_suffix )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  12 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_step ( p_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_hide_slider ( p_hide_slider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-29 16:09:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 18:09:19 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( i  %  4  = =  3 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											spin [ i ] - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 21:58:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EditorPropertyTransform3D : : EditorPropertyTransform3D ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									GridContainer  * g  =  memnew ( GridContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									g - > set_columns ( 4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_child ( g ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 01:42:56 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									static  const  char  * desc [ 12 ]  =  {  " xx " ,  " xy " ,  " xz " ,  " xo " ,  " yx " ,  " yy " ,  " yz " ,  " yo " ,  " zx " ,  " zy " ,  " zz " ,  " zo "  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  12 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ]  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_label ( desc [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										g - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_focusable ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyTransform3D : : _value_changed ) . bind ( desc [ i ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_bottom_editor ( g ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								///////////////////// PROJECTION /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyProjection : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  12 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_read_only ( p_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyProjection : : _value_changed ( double  val ,  const  String  & p_name )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Projection  p ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-04 11:44:48 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									p . columns [ 0 ] [ 0 ]  =  spin [ 0 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 0 ] [ 1 ]  =  spin [ 1 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 0 ] [ 2 ]  =  spin [ 2 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 0 ] [ 3 ]  =  spin [ 3 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 1 ] [ 0 ]  =  spin [ 4 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 1 ] [ 1 ]  =  spin [ 5 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 1 ] [ 2 ]  =  spin [ 6 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 1 ] [ 3 ]  =  spin [ 7 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 2 ] [ 0 ]  =  spin [ 8 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 2 ] [ 1 ]  =  spin [ 9 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 2 ] [ 2 ]  =  spin [ 10 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 2 ] [ 3 ]  =  spin [ 11 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 3 ] [ 0 ]  =  spin [ 12 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 3 ] [ 1 ]  =  spin [ 13 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 3 ] [ 2 ]  =  spin [ 14 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p . columns [ 3 ] [ 3 ]  =  spin [ 15 ] - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p ,  p_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyProjection : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_using_transform ( get_edited_property_value ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyProjection : : update_using_transform ( Projection  p_transform )  {  
						 
					
						
							
								
									
										
										
										
											2023-12-17 11:27:12 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									spin [ 0 ] - > set_value_no_signal ( p_transform . columns [ 0 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 1 ] - > set_value_no_signal ( p_transform . columns [ 0 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 2 ] - > set_value_no_signal ( p_transform . columns [ 0 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 3 ] - > set_value_no_signal ( p_transform . columns [ 0 ] [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 4 ] - > set_value_no_signal ( p_transform . columns [ 1 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 5 ] - > set_value_no_signal ( p_transform . columns [ 1 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 6 ] - > set_value_no_signal ( p_transform . columns [ 1 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 7 ] - > set_value_no_signal ( p_transform . columns [ 1 ] [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 8 ] - > set_value_no_signal ( p_transform . columns [ 2 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 9 ] - > set_value_no_signal ( p_transform . columns [ 2 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 10 ] - > set_value_no_signal ( p_transform . columns [ 2 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 11 ] - > set_value_no_signal ( p_transform . columns [ 2 ] [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 12 ] - > set_value_no_signal ( p_transform . columns [ 3 ] [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 13 ] - > set_value_no_signal ( p_transform . columns [ 3 ] [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 14 ] - > set_value_no_signal ( p_transform . columns [ 3 ] [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spin [ 15 ] - > set_value_no_signal ( p_transform . columns [ 3 ] [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyProjection : : _notification ( int  p_what )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Color  * colors  =  _get_property_colors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  16 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												spin [ i ] - > add_theme_color_override ( " label_color " ,  colors [ i  %  4 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyProjection : : setup ( double  p_min ,  double  p_max ,  double  p_step ,  bool  p_hide_slider ,  const  String  & p_suffix )  {  
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  16 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_min ( p_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_max ( p_max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_step ( p_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_hide_slider ( p_hide_slider ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( i  %  4  = =  3 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											spin [ i ] - > set_suffix ( p_suffix ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyProjection : : EditorPropertyProjection ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									GridContainer  * g  =  memnew ( GridContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									g - > set_columns ( 4 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( g ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  const  char  * desc [ 16 ]  =  {  " xx " ,  " xy " ,  " xz " ,  " xw " ,  " yx " ,  " yy " ,  " yz " ,  " yw " ,  " zx " ,  " zy " ,  " zz " ,  " zw " ,  " wx " ,  " wy " ,  " wz " ,  " ww "  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  16 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ]  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_label ( desc [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										g - > add_child ( spin [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spin [ i ] - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_focusable ( spin [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 11:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										spin [ i ] - > connect ( SceneStringName ( value_changed ) ,  callable_mp ( this ,  & EditorPropertyProjection : : _value_changed ) . bind ( desc [ i ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_bottom_editor ( g ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								////////////// COLOR PICKER //////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyColor : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									picker - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyColor : : _color_changed ( const  Color  & p_color )  {  
						 
					
						
							
								
									
										
										
										
											2024-02-22 18:01:28 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! live_changes_enabled )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-03 18:46:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Cancel the color change if the current color is identical to the new one.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 18:01:28 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ( ( Color ) get_edited_property_value ( ) ) . is_equal_approx ( p_color ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-03 18:46:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 18:01:28 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Preview color change, bypassing undo/redo.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									get_edited_object ( ) - > set ( get_edited_property ( ) ,  p_color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-18 11:10:23 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2025-01-15 03:54:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyColor : : _picker_created ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									picker - > get_popup ( ) - > connect ( " about_to_popup " ,  callable_mp ( this ,  & EditorPropertyColor : : _popup_opening ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									picker - > connect ( " popup_closed " ,  callable_mp ( this ,  & EditorPropertyColor : : _popup_closed ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyColor : : _popup_opening ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									EditorNode : : get_singleton ( ) - > setup_color_picker ( picker - > get_picker ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									last_color  =  picker - > get_pick_color ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									was_checked  =  ! is_checkable ( )  | |  is_checked ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-01-09 14:17:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyColor : : _popup_closed ( )  {  
						 
					
						
							
								
									
										
										
										
											2024-05-21 12:05:15 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									get_edited_object ( ) - > set ( get_edited_property ( ) ,  was_checked  ?  Variant ( last_color )  :  Variant ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 18:01:28 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! picker - > get_pick_color ( ) . is_equal_approx ( last_color ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-09 14:17:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_changed ( get_edited_property ( ) ,  picker - > get_pick_color ( ) ,  " " ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-17 22:44:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyColor : : _notification ( int  p_what )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-17 22:44:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											picker - > set_custom_minimum_size ( Size2 ( 0 ,  get_theme_constant ( SNAME ( " color_picker_button_height " ) ,  EditorStringName ( Editor ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-17 22:44:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyColor : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									picker - > set_pick_color ( get_edited_property_value ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-22 23:22:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Color  color  =  picker - > get_pick_color ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Add a tooltip to display each channel's values without having to click the ColorPickerButton
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( picker - > is_editing_alpha ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										picker - > set_tooltip_text ( vformat ( 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-22 23:22:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												" R: %s \n G: %s \n B: %s \n A: %s " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												rtos ( color . r ) . pad_decimals ( 2 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												rtos ( color . g ) . pad_decimals ( 2 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												rtos ( color . b ) . pad_decimals ( 2 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												rtos ( color . a ) . pad_decimals ( 2 ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										picker - > set_tooltip_text ( vformat ( 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-22 23:22:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												" R: %s \n G: %s \n B: %s " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												rtos ( color . r ) . pad_decimals ( 2 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												rtos ( color . g ) . pad_decimals ( 2 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												rtos ( color . b ) . pad_decimals ( 2 ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyColor : : setup ( bool  p_show_alpha )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									picker - > set_edit_alpha ( p_show_alpha ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-22 18:01:28 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyColor : : set_live_changes_enabled ( bool  p_enabled )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									live_changes_enabled  =  p_enabled ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								EditorPropertyColor : : EditorPropertyColor ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									picker  =  memnew ( ColorPickerButton ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( picker ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									picker - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									picker - > connect ( " color_changed " ,  callable_mp ( this ,  & EditorPropertyColor : : _color_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-01-15 03:54:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									picker - > connect ( " picker_created " ,  callable_mp ( this ,  & EditorPropertyColor : : _picker_created ) ,  CONNECT_ONE_SHOT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								////////////// NODE PATH //////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									assign - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									menu - > set_disabled ( p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-07 10:57:21 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-19 00:42:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Variant  EditorPropertyNodePath : : _get_cache_value ( const  StringName  & p_prop ,  bool  & r_valid )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_prop  = =  get_edited_property ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										r_valid  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 14:03:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  const_cast < EditorPropertyNodePath  * > ( this ) - > get_edited_object ( ) - > get ( get_edited_property ( ) ,  & r_valid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-19 00:42:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  Variant ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-03-30 16:22:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : _node_selected ( const  NodePath  & p_path ,  bool  p_absolute )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-22 14:48:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									NodePath  path  =  p_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 14:03:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Node  * base_node  =  get_base_node ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-21 09:22:47 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-04 18:03:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! base_node  & &  Object : : cast_to < RefCounted > ( get_edited_object ( ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-21 09:22:47 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Node  * to_node  =  get_node ( p_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ERR_FAIL_NULL ( to_node ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-21 09:22:47 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										path  =  get_tree ( ) - > get_edited_scene_root ( ) - > get_path_to ( to_node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-03-30 16:22:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_absolute  & &  base_node )  {  // for AnimationTrackKeyEdit
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-22 14:48:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										path  =  base_node - > get_path ( ) . rel_path_to ( p_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 14:03:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( editing_node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! base_node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											emit_changed ( get_edited_property ( ) ,  get_tree ( ) - > get_edited_scene_root ( ) - > get_node ( path ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											emit_changed ( get_edited_property ( ) ,  base_node - > get_node ( path ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-19 00:42:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										emit_changed ( get_edited_property ( ) ,  path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : _node_assign ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! scene_tree )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										scene_tree  =  memnew ( SceneTreeDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-27 20:50:25 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										scene_tree - > get_scene_tree ( ) - > set_show_enabled_subscene ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-17 23:40:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										scene_tree - > set_valid_types ( valid_types ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										add_child ( scene_tree ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-30 16:22:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										scene_tree - > connect ( " selected " ,  callable_mp ( this ,  & EditorPropertyNodePath : : _node_selected ) . bind ( true ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-26 16:44:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Variant  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * n  =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( val . get_type ( )  = =  Variant : : Type : : NODE_PATH )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-09 12:37:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Node  * base_node  =  get_base_node ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										n  =  base_node  = =  nullptr  ?  nullptr  :  base_node - > get_node_or_null ( val ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-26 16:44:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										n  =  Object : : cast_to < Node > ( val ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scene_tree - > popup_scenetree_dialog ( n ,  get_base_node ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : _update_menu ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  NodePath  & np  =  _get_node_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									menu - > get_popup ( ) - > set_item_disabled ( ACTION_CLEAR ,  np . is_empty ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									menu - > get_popup ( ) - > set_item_disabled ( ACTION_COPY ,  np . is_empty ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * edited_node  =  Object : : cast_to < Node > ( get_edited_object ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									menu - > get_popup ( ) - > set_item_disabled ( ACTION_SELECT ,  ! edited_node  | |  ! edited_node - > has_node ( np ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : _menu_option ( int  p_idx )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_idx )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  ACTION_CLEAR :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-09-05 21:00:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( editing_node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												emit_changed ( get_edited_property ( ) ,  Variant ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												emit_changed ( get_edited_property ( ) ,  NodePath ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  ACTION_COPY :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											DisplayServer : : get_singleton ( ) - > clipboard_set ( _get_node_path ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  ACTION_EDIT :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											assign - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											menu - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  NodePath  & np  =  _get_node_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											edit - > set_text ( np ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											edit - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											callable_mp ( ( Control  * ) edit ,  & Control : : grab_focus ) . call_deferred ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  ACTION_SELECT :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Node  * edited_node  =  get_base_node ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_FAIL_NULL ( edited_node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  NodePath  & np  =  _get_node_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Node  * target_node  =  edited_node - > get_node_or_null ( np ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_FAIL_NULL ( target_node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											SceneTreeDock : : get_singleton ( ) - > set_selected ( target_node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : _accept_text ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_text_submitted ( edit - > get_text ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : _text_submitted ( const  String  & p_text )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NodePath  np  =  p_text ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-03-30 16:22:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_node_selected ( np ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									assign - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									menu - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								const  NodePath  EditorPropertyNodePath : : _get_node_path ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Node  * base_node  =  const_cast < EditorPropertyNodePath  * > ( this ) - > get_base_node ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Variant  val  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * n  =  Object : : cast_to < Node > ( val ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( n )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! n - > is_inside_tree ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  NodePath ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( base_node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  base_node - > get_path_to ( n ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  get_tree ( ) - > get_edited_scene_root ( ) - > get_path_to ( n ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  val ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 18:50:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  EditorPropertyNodePath : : can_drop_data_fw ( const  Point2  & p_point ,  const  Variant  & p_data ,  Control  * p_from )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ! is_read_only ( )  & &  is_drop_valid ( p_data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : drop_data_fw ( const  Point2  & p_point ,  const  Variant  & p_data ,  Control  * p_from )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND ( ! is_drop_valid ( p_data ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Dictionary  data_dict  =  p_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Array  nodes  =  data_dict [ " nodes " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 18:50:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Node  * node  =  get_tree ( ) - > get_edited_scene_root ( ) - > get_node ( nodes [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_node_selected ( node - > get_path ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  EditorPropertyNodePath : : is_drop_valid ( const  Dictionary  & p_drag_data )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_drag_data [ " type " ]  ! =  " nodes " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Array  nodes  =  p_drag_data [ " nodes " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 03:23:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( nodes . size ( )  ! =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * dropped_node  =  get_tree ( ) - > get_edited_scene_root ( ) - > get_node ( nodes [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_NULL_V ( dropped_node ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-22 18:29:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( valid_types . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// No type requirements specified so any type is valid.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 03:23:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( const  StringName  & E  :  valid_types )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-08 00:16:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( dropped_node - > is_class ( E )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > is_object_of_custom_type ( dropped_node ,  E ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 03:23:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-29 14:58:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Ref < Script >  dropped_node_script  =  dropped_node - > get_script ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											while  ( dropped_node_script . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( dropped_node_script - > get_path ( )  = =  E )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												dropped_node_script  =  dropped_node_script - > get_base_script ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-04 03:23:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 18:50:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Node  * base_node  =  get_base_node ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  NodePath  & p  =  _get_node_path ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									assign - > set_tooltip_text ( p ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										assign - > set_button_icon ( Ref < Texture2D > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-07 16:57:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										assign - > set_text ( TTR ( " Assign... " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										assign - > set_flat ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									assign - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! base_node  | |  ! base_node - > has_node ( p ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										assign - > set_button_icon ( Ref < Texture2D > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										assign - > set_text ( p ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Node  * target_node  =  base_node - > get_node ( p ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( target_node ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-05 17:56:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( String ( target_node - > get_name ( ) ) . contains_char ( ' @ ' ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										assign - > set_button_icon ( Ref < Texture2D > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-15 23:42:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										assign - > set_text ( p ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									assign - > set_text ( target_node - > get_name ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									assign - > set_button_icon ( EditorNode : : get_singleton ( ) - > get_object_icon ( target_node ,  " Node " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-05-29 13:18:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : setup ( const  Vector < StringName >  & p_valid_types ,  bool  p_use_path_from_scene_root ,  bool  p_editing_node )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-27 20:50:25 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									valid_types  =  p_valid_types ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 14:03:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									editing_node  =  p_editing_node ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-14 15:52:43 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									use_path_from_scene_root  =  p_use_path_from_scene_root ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyNodePath : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-10-09 15:21:47 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											menu - > set_button_icon ( get_editor_theme_icon ( SNAME ( " GuiTabMenuHl " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											menu - > get_popup ( ) - > set_item_icon ( ACTION_CLEAR ,  get_editor_theme_icon ( SNAME ( " Clear " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											menu - > get_popup ( ) - > set_item_icon ( ACTION_COPY ,  get_editor_theme_icon ( SNAME ( " ActionCopy " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											menu - > get_popup ( ) - > set_item_icon ( ACTION_EDIT ,  get_editor_theme_icon ( SNAME ( " Edit " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											menu - > get_popup ( ) - > set_item_icon ( ACTION_SELECT ,  get_editor_theme_icon ( SNAME ( " ExternalLink " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 14:03:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Node  * EditorPropertyNodePath : : get_base_node ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * base_node  =  Object : : cast_to < Node > ( get_edited_object ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! base_node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										base_node  =  Object : : cast_to < Node > ( InspectorDock : : get_inspector_singleton ( ) - > get_edited_object ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! base_node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Try a base node within history.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( EditorNode : : get_singleton ( ) - > get_editor_selection_history ( ) - > get_path_size ( )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Object  * base  =  ObjectDB : : get_instance ( EditorNode : : get_singleton ( ) - > get_editor_selection_history ( ) - > get_path_object ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( base )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												base_node  =  Object : : cast_to < Node > ( base ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( use_path_from_scene_root )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( get_edited_object ( ) - > has_method ( " get_root_path " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											base_node  =  Object : : cast_to < Node > ( get_edited_object ( ) - > call ( " get_root_path " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											base_node  =  get_tree ( ) - > get_edited_scene_root ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  base_node ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyNodePath : : EditorPropertyNodePath ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									HBoxContainer  * hbc  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-31 18:55:51 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hbc - > add_theme_constant_override ( " separation " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_child ( hbc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									assign  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									assign - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									assign - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									assign - > set_clip_text ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-23 18:29:45 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									assign - > set_auto_translate_mode ( AUTO_TRANSLATE_MODE_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-03 15:43:23 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									assign - > set_expand_icon ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 09:40:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									assign - > connect ( SceneStringName ( pressed ) ,  callable_mp ( this ,  & EditorPropertyNodePath : : _node_assign ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-14 03:37:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									SET_DRAG_FORWARDING_CD ( assign ,  EditorPropertyNodePath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									hbc - > add_child ( assign ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									menu  =  memnew ( MenuButton ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									menu - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									menu - > connect ( SNAME ( " about_to_popup " ) ,  callable_mp ( this ,  & EditorPropertyNodePath : : _update_menu ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hbc - > add_child ( menu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									menu - > get_popup ( ) - > add_item ( TTR ( " Clear " ) ,  ACTION_CLEAR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									menu - > get_popup ( ) - > add_item ( TTR ( " Copy as Text " ) ,  ACTION_COPY ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									menu - > get_popup ( ) - > add_item ( TTR ( " Edit " ) ,  ACTION_EDIT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									menu - > get_popup ( ) - > add_item ( TTR ( " Show Node in Tree " ) ,  ACTION_SELECT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-14 14:13:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									menu - > get_popup ( ) - > connect ( SceneStringName ( id_pressed ) ,  callable_mp ( this ,  & EditorPropertyNodePath : : _menu_option ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-13 16:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > connect ( SceneStringName ( focus_exited ) ,  callable_mp ( this ,  & EditorPropertyNodePath : : _accept_text ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-11-02 16:15:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > connect ( SceneStringName ( text_submitted ) ,  callable_mp ( this ,  & EditorPropertyNodePath : : _text_submitted ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-23 21:55:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hbc - > add_child ( edit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-13 15:43:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								///////////////////// RID /////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyRID : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RID  rid  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-13 15:43:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( rid . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-30 02:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uint64_t  id  =  rid . get_id ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										label - > set_text ( " RID:  "  +  uitos ( id ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-13 15:43:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										label - > set_text ( TTR ( " Invalid RID " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EditorPropertyRID : : EditorPropertyRID ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									label  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								////////////// RESOURCE //////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _set_read_only ( bool  p_read_only )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									resource_picker - > set_editable ( ! p_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2021-08-16 11:42:24 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-29 07:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _resource_selected ( const  Ref < Resource >  & p_resource ,  bool  p_inspect )  {  
						 
					
						
							
								
									
										
										
										
											2022-04-25 00:06:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_resource - > is_built_in ( )  & &  ! p_resource - > get_path ( ) . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  parent  =  p_resource - > get_path ( ) . get_slice ( " :: " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										List < String >  extensions ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ResourceLoader : : get_recognized_extensions_for_type ( " PackedScene " ,  & extensions ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-29 07:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p_inspect )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( extensions . find ( parent . get_extension ( ) )  & &  ( ! EditorNode : : get_singleton ( ) - > get_edited_scene ( )  | |  EditorNode : : get_singleton ( ) - > get_edited_scene ( ) - > get_scene_file_path ( )  ! =  parent ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// If the resource belongs to another (non-imported) scene, edit it in that scene instead.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! FileAccess : : exists ( parent  +  " .import " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-18 15:46:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													callable_mp ( EditorNode : : get_singleton ( ) ,  & EditorNode : : edit_foreign_resource ) . call_deferred ( p_resource ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-29 07:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-25 00:06:11 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-25 01:17:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-29 07:06:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! p_inspect  & &  use_sub_inspector )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bool  unfold  =  ! get_edited_object ( ) - > editor_is_section_unfolded ( get_edited_property ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_edited_object ( ) - > editor_set_section_unfold ( get_edited_property ( ) ,  unfold ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_signal ( SNAME ( " resource_selected " ) ,  get_edited_property ( ) ,  p_resource ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-30 17:52:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-06 15:05:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  bool  _find_recursive_resources ( const  Variant  & v ,  HashSet < Resource  * >  & resources_found )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( v . get_type ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : ARRAY :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Array  a  =  v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  a . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Variant  v2  =  a [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( v2 . get_type ( )  ! =  Variant : : ARRAY  & &  v2 . get_type ( )  ! =  Variant : : DICTIONARY  & &  v2 . get_type ( )  ! =  Variant : : OBJECT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( _find_recursive_resources ( v2 ,  resources_found ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : DICTIONARY :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Dictionary  d  =  v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											List < Variant >  keys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											d . get_key_list ( & keys ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( const  Variant  & k  :  keys )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( k . get_type ( )  = =  Variant : : ARRAY  | |  k . get_type ( )  = =  Variant : : DICTIONARY  | |  k . get_type ( )  = =  Variant : : OBJECT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( _find_recursive_resources ( k ,  resources_found ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Variant  v2  =  d [ k ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( v2 . get_type ( )  = =  Variant : : ARRAY  | |  v2 . get_type ( )  = =  Variant : : DICTIONARY  | |  v2 . get_type ( )  = =  Variant : : OBJECT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( _find_recursive_resources ( v2 ,  resources_found ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : OBJECT :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Ref < Resource >  r  =  v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( resources_found . has ( r . ptr ( ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											resources_found . insert ( r . ptr ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											List < PropertyInfo >  plist ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											r - > get_property_list ( & plist ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( const  PropertyInfo  & pinfo  :  plist )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! ( pinfo . usage  &  PROPERTY_USAGE_STORAGE ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( pinfo . type  ! =  Variant : : ARRAY  & &  pinfo . type  ! =  Variant : : DICTIONARY  & &  pinfo . type  ! =  Variant : : OBJECT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( _find_recursive_resources ( r - > get ( pinfo . name ) ,  resources_found ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-11 18:28:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											resources_found . erase ( r . ptr ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-06 15:05:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _resource_changed ( const  Ref < Resource >  & p_resource )  {  
						 
					
						
							
								
									
										
										
										
											2023-01-06 15:05:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Resource  * r  =  Object : : cast_to < Resource > ( get_edited_object ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( r )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Check for recursive setting of resource
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										HashSet < Resource  * >  resources_found ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										resources_found . insert ( r ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  found  =  _find_recursive_resources ( p_resource ,  resources_found ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( found )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Recursion detected, unable to assign resource to property. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											emit_changed ( get_edited_property ( ) ,  Ref < Resource > ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-06 23:21:43 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// The bool is_script applies only to an object's main script.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Changing the value of Script-type exported variables of the main script should not trigger saving/reloading properties.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-25 22:32:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  is_script  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-09 15:31:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Script >  s  =  p_resource ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-04 17:01:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( get_edited_object ( )  & &  s . is_valid ( )  & &  get_edited_property ( )  = =  CoreStringName ( script ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-25 22:32:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										is_script  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										InspectorDock : : get_singleton ( ) - > store_script_properties ( get_edited_object ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										s - > call ( " set_instance_base_type " ,  get_edited_object ( ) - > get_class ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Prevent the creation of invalid ViewportTextures when possible.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < ViewportTexture >  vpt  =  p_resource ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( vpt . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-06 15:05:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										r  =  Object : : cast_to < Resource > ( get_edited_object ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-04 00:52:45 +04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( Object : : cast_to < VisualShaderNodeTexture > ( r ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Can't create a ViewportTexture in a Texture2D node because the texture will not be bound to a scene. \n Use a Texture2DParameter node instead and set the texture in the  \" Shader Parameters \"  tab. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											emit_changed ( get_edited_property ( ) ,  Ref < Resource > ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( r  & &  r - > get_path ( ) . is_resource_file ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Can't create a ViewportTexture on resources saved as a file. \n Resource needs to belong to a scene. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_changed ( get_edited_property ( ) ,  Ref < Resource > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											update_property ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-05 16:16:55 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( r  & &  ! r - > is_local_to_scene ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Can't create a ViewportTexture on this resource because it's not set as local to scene. \n Please switch on the 'local to scene' property on it (and all resources containing it up to a node). " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_changed ( get_edited_property ( ) ,  Ref < Resource > ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  p_resource ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_property ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-25 22:32:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( is_script )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Restore properties if script was changed.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										InspectorDock : : get_singleton ( ) - > apply_script_properties ( get_edited_object ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Automatically suggest setting up the path for a ViewportTexture.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( vpt . is_valid ( )  & &  vpt - > get_viewport_path_in_scene ( ) . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! scene_tree )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											scene_tree  =  memnew ( SceneTreeDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											scene_tree - > set_title ( TTR ( " Pick a Viewport " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Vector < StringName >  valid_types ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											valid_types . push_back ( " Viewport " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-17 23:40:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											scene_tree - > set_valid_types ( valid_types ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											scene_tree - > get_scene_tree ( ) - > set_show_enabled_subscene ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											add_child ( scene_tree ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											scene_tree - > connect ( " selected " ,  callable_mp ( this ,  & EditorPropertyResource : : _viewport_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										scene_tree - > popup_scenetree_dialog ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-18 21:28:28 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-03 16:23:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _sub_inspector_property_keyed ( const  String  & p_property ,  const  Variant  & p_value ,  bool  p_advance )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// The second parameter could be null, causing the event to fire with less arguments, so use the pointer call which preserves it.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Variant  args [ 3 ]  =  {  String ( get_edited_property ( ) )  +  " : "  +  p_property ,  p_value ,  p_advance  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  Variant  * argp [ 3 ]  =  {  & args [ 0 ] ,  & args [ 1 ] ,  & args [ 2 ]  } ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-09 14:58:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signalp ( SNAME ( " property_keyed_with_value " ) ,  argp ,  3 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _sub_inspector_resource_selected ( const  Ref < Resource >  & p_resource ,  const  String  & p_property )  {  
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " resource_selected " ) ,  String ( get_edited_property ( ) )  +  " : "  +  p_property ,  p_resource ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _sub_inspector_object_id_selected ( int  p_id )  {  
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " object_id_selected " ) ,  get_edited_property ( ) ,  p_id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 22:10:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _open_editor_pressed ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Resource >  res  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 22:10:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( res . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// May clear the editor so do it deferred.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-27 13:29:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										callable_mp ( EditorNode : : get_singleton ( ) ,  & EditorNode : : edit_item ) . call_deferred ( res . ptr ( ) ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-04 16:44:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-17 16:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _update_preferred_shader ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * parent  =  get_parent ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									EditorProperty  * parent_property  =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									while  ( parent  & &  ! parent_property )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										parent_property  =  Object : : cast_to < EditorProperty > ( parent ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										parent  =  parent - > get_parent ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( parent_property )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorShaderPicker  * shader_picker  =  Object : : cast_to < EditorShaderPicker > ( resource_picker ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Object  * ed_object  =  parent_property - > get_edited_object ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  StringName  & ed_property  =  parent_property - > get_edited_property ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-17 16:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Set preferred shader based on edited parent type.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ( Object : : cast_to < GPUParticles2D > ( ed_object )  | |  Object : : cast_to < GPUParticles3D > ( ed_object ) )  & &  ed_property  = =  SNAME ( " process_material " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-17 16:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											shader_picker - > set_preferred_mode ( Shader : : MODE_PARTICLES ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( Object : : cast_to < FogVolume > ( ed_object ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-17 16:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											shader_picker - > set_preferred_mode ( Shader : : MODE_FOG ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( Object : : cast_to < CanvasItem > ( ed_object ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-17 16:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											shader_picker - > set_preferred_mode ( Shader : : MODE_CANVAS_ITEM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( Object : : cast_to < Node3D > ( ed_object )  | |  Object : : cast_to < Mesh > ( ed_object ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-17 16:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											shader_picker - > set_preferred_mode ( Shader : : MODE_SPATIAL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( Object : : cast_to < Sky > ( ed_object ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-17 16:35:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											shader_picker - > set_preferred_mode ( Shader : : MODE_SKY ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-27 16:32:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  EditorPropertyResource : : _should_stop_editing ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ! resource_picker - > is_toggle_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _viewport_selected ( const  NodePath  & p_path )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * to_node  =  get_node ( p_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! Object : : cast_to < Viewport > ( to_node ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Selected node is not a Viewport! " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < ViewportTexture >  vt ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-17 16:03:09 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									vt . instantiate ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									vt - > set_viewport_path_in_scene ( get_tree ( ) - > get_edited_scene_root ( ) - > get_path_to ( to_node ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									emit_changed ( get_edited_property ( ) ,  vt ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyResource : : setup ( Object  * p_object ,  const  String  & p_path ,  const  String  & p_base_type )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( resource_picker )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										memdelete ( resource_picker ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-25 01:17:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										resource_picker  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_path  = =  " script "  & &  p_base_type  = =  " Script "  & &  Object : : cast_to < Node > ( p_object ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorScriptPicker  * script_picker  =  memnew ( EditorScriptPicker ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										script_picker - > set_script_owner ( Object : : cast_to < Node > ( p_object ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										resource_picker  =  script_picker ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-04 12:24:08 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  if  ( p_path  = =  " shader "  & &  p_base_type  = =  " Shader "  & &  Object : : cast_to < ShaderMaterial > ( p_object ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorShaderPicker  * shader_picker  =  memnew ( EditorShaderPicker ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										shader_picker - > set_edited_material ( Object : : cast_to < ShaderMaterial > ( p_object ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										resource_picker  =  shader_picker ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-13 16:56:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										connect ( SceneStringName ( ready ) ,  callable_mp ( this ,  & EditorPropertyResource : : _update_preferred_shader ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-21 01:00:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  if  ( p_base_type  = =  " AudioStream " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorAudioStreamPicker  * astream_picker  =  memnew ( EditorAudioStreamPicker ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										resource_picker  =  astream_picker ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										resource_picker  =  memnew ( EditorResourcePicker ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									resource_picker - > set_base_type ( p_base_type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-25 00:32:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									resource_picker - > set_resource_owner ( p_object ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									resource_picker - > set_editable ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									resource_picker - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( resource_picker ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									resource_picker - > connect ( " resource_selected " ,  callable_mp ( this ,  & EditorPropertyResource : : _resource_selected ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									resource_picker - > connect ( " resource_changed " ,  callable_mp ( this ,  & EditorPropertyResource : : _resource_changed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  resource_picker - > get_child_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Button  * b  =  Object : : cast_to < Button > ( resource_picker - > get_child ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( b )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_focusable ( b ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyResource : : update_property ( )  {  
						 
					
						
							
								
									
										
										
										
											2023-05-26 09:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Resource >  res  =  get_edited_property_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( use_sub_inspector )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( res . is_valid ( )  ! =  resource_picker - > is_toggle_mode ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											resource_picker - > set_toggle_mode ( res . is_valid ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-30 19:02:46 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( res . is_valid ( )  & &  get_edited_object ( ) - > editor_is_section_unfolded ( get_edited_property ( ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! sub_inspector )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sub_inspector  =  memnew ( EditorInspector ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 00:25:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												sub_inspector - > set_vertical_scroll_mode ( ScrollContainer : : SCROLL_MODE_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-07 20:38:03 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												sub_inspector - > set_use_doc_hints ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-04 00:26:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorInspector  * parent_inspector  =  get_parent_inspector ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ERR_FAIL_NULL ( parent_inspector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sub_inspector - > set_root_inspector ( parent_inspector - > get_root_inspector ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-23 09:46:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												sub_inspector - > set_property_name_style ( InspectorDock : : get_singleton ( ) - > get_property_name_style ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 19:37:17 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												sub_inspector - > connect ( " property_keyed " ,  callable_mp ( this ,  & EditorPropertyResource : : _sub_inspector_property_keyed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sub_inspector - > connect ( " resource_selected " ,  callable_mp ( this ,  & EditorPropertyResource : : _sub_inspector_resource_selected ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sub_inspector - > connect ( " object_id_selected " ,  callable_mp ( this ,  & EditorPropertyResource : : _sub_inspector_object_id_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												sub_inspector - > set_keying ( is_keying ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sub_inspector - > set_read_only ( is_read_only ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sub_inspector - > set_use_folding ( is_using_folding ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-23 14:30:07 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												sub_inspector - > set_draw_focus_border ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-03 12:20:28 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												sub_inspector - > set_use_filter ( use_filter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sub_inspector - > register_text_enter ( parent_inspector - > search_box ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-25 23:16:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												sub_inspector - > set_mouse_filter ( MOUSE_FILTER_STOP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												add_child ( sub_inspector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												set_bottom_editor ( sub_inspector ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 22:10:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												resource_picker - > set_toggle_pressed ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 22:10:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-21 22:49:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Array  editor_list ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-26 15:08:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  EditorNode : : get_editor_data ( ) . get_editor_plugin_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													EditorPlugin  * ep  =  EditorNode : : get_editor_data ( ) . get_editor_plugin ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 22:10:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ep - > handles ( res . ptr ( ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-21 22:49:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														editor_list . push_back ( ep ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 22:10:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-21 22:49:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ! editor_list . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Open editor directly.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-04 16:44:39 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													_open_editor_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													opened_editor  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 22:10:48 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( res . ptr ( )  ! =  sub_inspector - > get_edited_object ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sub_inspector - > edit ( res . ptr ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-25 23:16:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												_update_property_bg ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-03 12:20:28 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( sub_inspector )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											set_bottom_editor ( nullptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											memdelete ( sub_inspector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											sub_inspector  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-03 12:20:28 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( opened_editor )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > hide_unused_editors ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												opened_editor  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-11-04 13:02:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									resource_picker - > set_edited_resource_no_check ( res ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-05-17 18:02:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyResource : : collapse_all_folding ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( sub_inspector )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sub_inspector - > collapse_all_folding ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  EditorPropertyResource : : expand_all_folding ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( sub_inspector )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sub_inspector - > expand_all_folding ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-30 15:12:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : expand_revertable ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( sub_inspector )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sub_inspector - > expand_revertable ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : set_use_sub_inspector ( bool  p_enable )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									use_sub_inspector  =  p_enable ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 19:41:25 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-12-03 12:20:28 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : set_use_filter ( bool  p_use )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									use_filter  =  p_use ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( sub_inspector )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-21 22:49:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : fold_resource ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  unfolded  =  get_edited_object ( ) - > editor_is_section_unfolded ( get_edited_property ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( unfolded )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										resource_picker - > set_toggle_pressed ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_edited_object ( ) - > editor_set_section_unfold ( get_edited_property ( ) ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										update_property ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-04-25 23:16:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  EditorPropertyResource : : is_colored ( ColorationMode  p_mode )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  COLORATION_CONTAINER_RESOURCE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  sub_inspector  ! =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  COLORATION_RESOURCE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  COLORATION_EXTERNAL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( sub_inspector )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Resource  * edited_resource  =  Object : : cast_to < Resource > ( sub_inspector - > get_edited_object ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  edited_resource  & &  ! edited_resource - > is_built_in ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 15:19:07 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _notification ( int  p_what )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 18:03:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_EXIT_TREE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  EditorInspector  * ei  =  get_parent_inspector ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-08-04 22:31:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											const  EditorInspector  * main_ei  =  InspectorDock : : get_inspector_singleton ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ei  & &  main_ei  & &  ei  ! =  main_ei  & &  ! main_ei - > is_ancestor_of ( ei ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 18:03:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												fold_resource ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-17 19:41:25 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-09-27 16:32:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  EditorPropertyResource : : _bind_methods ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _should_stop_editing " ) ,  & EditorPropertyResource : : _should_stop_editing ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								EditorPropertyResource : : EditorPropertyResource ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-07-14 18:15:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									use_sub_inspector  =  bool ( EDITOR_GET ( " interface/inspector/open_resources_in_current_inspector " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-12 21:35:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									has_borders  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								////////////// DEFAULT PLUGIN //////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  EditorInspectorDefaultPlugin : : can_handle ( Object  * p_object )  {  
						 
					
						
							
								
									
										
										
										
											2021-11-10 17:49:19 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  true ;  // Can handle everything.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-31 19:08:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  EditorInspectorDefaultPlugin : : parse_property ( Object  * p_object ,  const  Variant : : Type  p_type ,  const  String  & p_path ,  const  PropertyHint  p_hint ,  const  String  & p_hint_text ,  const  BitField < PropertyUsageFlags >  p_usage ,  const  bool  p_wide )  {  
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Control  * editor  =  EditorInspectorDefaultPlugin : : get_editor_for_property ( p_object ,  p_type ,  p_path ,  p_hint ,  p_hint_text ,  p_usage ,  p_wide ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( editor )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_property_editor ( p_path ,  editor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								struct  EditorPropertyRangeHint  {  
						 
					
						
							
								
									
										
										
										
											2022-03-27 19:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  or_greater  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  or_less  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-03 11:57:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									double  min  =  - 99999.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  max  =  99999.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									double  step  =  1.0 ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  suffix ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  exp_range  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  hide_slider  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 16:27:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  radians_as_degrees  =  false ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 15:24:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  EditorPropertyRangeHint  _parse_range_hint ( PropertyHint  p_hint ,  const  String  & p_hint_text ,  double  p_default_step ,  bool  is_int  =  false )  {  
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorPropertyRangeHint  hint ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hint . step  =  p_default_step ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 15:24:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( is_int )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										hint . hide_slider  =  false ;  // Always show slider for ints, unless specified in hint range.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-20 02:04:58 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector < String >  slices  =  p_hint_text . split ( " , " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-03 11:57:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_hint  = =  PROPERTY_HINT_RANGE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ERR_FAIL_COND_V_MSG ( slices . size ( )  <  2 ,  hint , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												vformat ( " Invalid PROPERTY_HINT_RANGE with hint  \" %s \" : Missing required min and/or max values. " ,  p_hint_text ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-27 19:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										hint . or_greater  =  false ;  // If using ranged, assume false by default.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										hint . or_less  =  false ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-03 11:57:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										hint . min  =  slices [ 0 ] . to_float ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										hint . max  =  slices [ 1 ] . to_float ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( slices . size ( )  > =  3  & &  slices [ 2 ] . is_valid_float ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Step is optional, could be something else if not a number.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											hint . step  =  slices [ 2 ] . to_float ( ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										hint . hide_slider  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-03 11:57:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( int  i  =  2 ;  i  <  slices . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  slice  =  slices [ i ] . strip_edges ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-20 02:04:58 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( slice  = =  " or_greater " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-27 19:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												hint . or_greater  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( slice  = =  " or_less " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												hint . or_less  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 11:59:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  if  ( slice  = =  " hide_slider " )  { 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												hint . hide_slider  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( slice  = =  " exp " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												hint . exp_range  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-20 02:04:58 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  degrees  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  slices . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  slice  =  slices [ i ] . strip_edges ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 16:27:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( slice  = =  " radians_as_degrees " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# ifndef DISABLE_DEPRECATED 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												| |  slice  = =  " radians " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif  // DISABLE_DEPRECATED
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										)  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											hint . radians_as_degrees  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-20 02:04:58 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  if  ( slice  = =  " degrees " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											degrees  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( slice . begins_with ( " suffix: " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											hint . suffix  =  "   "  +  slice . replace_first ( " suffix: " ,  " " ) . strip_edges ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 16:27:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ( hint . radians_as_degrees  | |  degrees )  & &  hint . suffix . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										hint . suffix  =  U " \u00B0 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-03 11:57:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND_V_MSG ( hint . step  = =  0 ,  hint , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											vformat ( " Invalid PROPERTY_HINT_RANGE with hint  \" %s \" : Step cannot be 0. " ,  p_hint_text ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  hint ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-31 19:08:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EditorProperty  * EditorInspectorDefaultPlugin : : get_editor_for_property ( Object  * p_object ,  const  Variant : : Type  p_type ,  const  String  & p_path ,  const  PropertyHint  p_hint ,  const  String  & p_hint_text ,  const  BitField < PropertyUsageFlags >  p_usage ,  const  bool  p_wide )  {  
						 
					
						
							
								
									
										
										
										
											2021-03-31 22:27:24 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									double  default_float_step  =  EDITOR_GET ( " interface/inspector/default_float_step " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-23 17:27:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									switch  ( p_type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// atomic types
 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : NIL :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyNil  * editor  =  memnew ( EditorPropertyNil ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  Variant : : BOOL :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyCheck  * editor  =  memnew ( EditorPropertyCheck ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : INT :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( p_hint  = =  PROPERTY_HINT_ENUM )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyEnum  * editor  =  memnew ( EditorPropertyEnum ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector < String >  options  =  p_hint_text . split ( " , " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor - > setup ( options ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( p_hint  = =  PROPERTY_HINT_FLAGS )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyFlags  * editor  =  memnew ( EditorPropertyFlags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector < String >  options  =  p_hint_text . split ( " , " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor - > setup ( options ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-08 20:56:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  if  ( p_hint  = =  PROPERTY_HINT_LAYERS_2D_PHYSICS  | | 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-28 15:19:35 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													p_hint  = =  PROPERTY_HINT_LAYERS_2D_RENDER  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													p_hint  = =  PROPERTY_HINT_LAYERS_2D_NAVIGATION  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													p_hint  = =  PROPERTY_HINT_LAYERS_3D_PHYSICS  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													p_hint  = =  PROPERTY_HINT_LAYERS_3D_RENDER  | | 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-10 07:14:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													p_hint  = =  PROPERTY_HINT_LAYERS_3D_NAVIGATION  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													p_hint  = =  PROPERTY_HINT_LAYERS_AVOIDANCE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-01 17:33:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorPropertyLayers : : LayerType  lt  =  EditorPropertyLayers : : LAYER_RENDER_2D ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												switch  ( p_hint )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  PROPERTY_HINT_LAYERS_2D_RENDER : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														lt  =  EditorPropertyLayers : : LAYER_RENDER_2D ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  PROPERTY_HINT_LAYERS_2D_PHYSICS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														lt  =  EditorPropertyLayers : : LAYER_PHYSICS_2D ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-08 20:56:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													case  PROPERTY_HINT_LAYERS_2D_NAVIGATION : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														lt  =  EditorPropertyLayers : : LAYER_NAVIGATION_2D ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													case  PROPERTY_HINT_LAYERS_3D_RENDER : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														lt  =  EditorPropertyLayers : : LAYER_RENDER_3D ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  PROPERTY_HINT_LAYERS_3D_PHYSICS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														lt  =  EditorPropertyLayers : : LAYER_PHYSICS_3D ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-08 20:56:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													case  PROPERTY_HINT_LAYERS_3D_NAVIGATION : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														lt  =  EditorPropertyLayers : : LAYER_NAVIGATION_3D ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-10 07:14:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													case  PROPERTY_HINT_LAYERS_AVOIDANCE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														lt  =  EditorPropertyLayers : : LAYER_AVOIDANCE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-09 17:08:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  //compiler could be smarter here and realize this can't happen
 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyLayers  * editor  =  memnew ( EditorPropertyLayers ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor - > setup ( lt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											}  else  if  ( p_hint  = =  PROPERTY_HINT_OBJECT_ID )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyObjectID  * editor  =  memnew ( EditorPropertyObjectID ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor - > setup ( p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyInteger  * editor  =  memnew ( EditorPropertyInteger ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-24 18:26:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 15:24:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  1 ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  hint . or_greater ,  hint . or_less ,  hint . suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
											
												Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
											 
										 
										
											2020-02-24 15:20:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : FLOAT :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											if  ( p_hint  = =  PROPERTY_HINT_EXP_EASING )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyEasing  * editor  =  memnew ( EditorPropertyEasing ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-07 18:17:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bool  positive_only  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												bool  flip  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-07 18:17:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												const  Vector < String >  hints  =  p_hint_text . split ( " , " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  hints . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-07 18:17:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													const  String  hint  =  hints [ i ] . strip_edges ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( hint  = =  " attenuation " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														flip  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-07 18:17:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( hint  = =  " positive_only " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														positive_only  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-07 18:17:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												editor - > setup ( positive_only ,  flip ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyFloat  * editor  =  memnew ( EditorPropertyFloat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 16:27:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  hint . exp_range ,  hint . or_greater ,  hint . or_less ,  hint . suffix ,  hint . radians_as_degrees ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : STRING :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( p_hint  = =  PROPERTY_HINT_ENUM  | |  p_hint  = =  PROPERTY_HINT_ENUM_SUGGESTION )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												EditorPropertyTextEnum  * editor  =  memnew ( EditorPropertyTextEnum ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Vector < String >  options  =  p_hint_text . split ( " , " ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor - > setup ( options ,  false ,  ( p_hint  = =  PROPERTY_HINT_ENUM_SUGGESTION ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											}  else  if  ( p_hint  = =  PROPERTY_HINT_MULTILINE_TEXT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyMultilineText  * editor  =  memnew ( EditorPropertyMultilineText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-27 13:10:04 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  if  ( p_hint  = =  PROPERTY_HINT_EXPRESSION )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyMultilineText  * editor  =  memnew ( EditorPropertyMultilineText ( true ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-18 21:58:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  if  ( p_hint  = =  PROPERTY_HINT_TYPE_STRING )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyClassName  * editor  =  memnew ( EditorPropertyClassName ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-06 23:07:21 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												editor - > setup ( p_hint_text ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-23 14:08:50 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  if  ( p_hint  = =  PROPERTY_HINT_LOCALE_ID )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyLocale  * editor  =  memnew ( EditorPropertyLocale ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor - > setup ( p_hint_text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.
This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).
**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).
Usage:
$ godot --write-movie movie.avi [scene_file.tscn]
Missing:
* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
											 
										 
										
											2022-06-17 00:55:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  if  ( p_hint  = =  PROPERTY_HINT_DIR  | |  p_hint  = =  PROPERTY_HINT_FILE  | |  p_hint  = =  PROPERTY_HINT_SAVE_FILE  | |  p_hint  = =  PROPERTY_HINT_GLOBAL_SAVE_FILE  | |  p_hint  = =  PROPERTY_HINT_GLOBAL_DIR  | |  p_hint  = =  PROPERTY_HINT_GLOBAL_FILE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												Vector < String >  extensions  =  p_hint_text . split ( " , " ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.
This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).
**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).
Usage:
$ godot --write-movie movie.avi [scene_file.tscn]
Missing:
* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
											 
										 
										
											2022-06-17 00:55:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bool  global  =  p_hint  = =  PROPERTY_HINT_GLOBAL_DIR  | |  p_hint  = =  PROPERTY_HINT_GLOBAL_FILE  | |  p_hint  = =  PROPERTY_HINT_GLOBAL_SAVE_FILE ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												bool  folder  =  p_hint  = =  PROPERTY_HINT_DIR  | |  p_hint  = =  PROPERTY_HINT_GLOBAL_DIR ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.
This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).
**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).
Usage:
$ godot --write-movie movie.avi [scene_file.tscn]
Missing:
* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
											 
										 
										
											2022-06-17 00:55:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bool  save  =  p_hint  = =  PROPERTY_HINT_SAVE_FILE  | |  p_hint  = =  PROPERTY_HINT_GLOBAL_SAVE_FILE ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												EditorPropertyPath  * editor  =  memnew ( EditorPropertyPath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor - > setup ( extensions ,  folder ,  global ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-19 15:54:33 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( save )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													editor - > set_save_mode ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyText  * editor  =  memnew ( EditorPropertyText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-17 03:50:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( p_hint  = =  PROPERTY_HINT_PLACEHOLDER_TEXT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													editor - > set_placeholder ( p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 18:51:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  if  ( p_hint  = =  PROPERTY_HINT_PASSWORD )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													editor - > set_secret ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													editor - > set_placeholder ( p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-17 03:50:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// math types
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : VECTOR2 :  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyVector2  * editor  =  memnew ( EditorPropertyVector2 ( p_wide ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-05 02:58:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  p_hint  = =  PROPERTY_HINT_LINK ,  hint . suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : VECTOR2I :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyVector2i  * editor  =  memnew ( EditorPropertyVector2i ( p_wide ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 15:24:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  1 ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:07:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  1 ,  false ,  p_hint  = =  PROPERTY_HINT_LINK ,  hint . suffix ,  false ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-24 17:00:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  Variant : : RECT2 :  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRect2  * editor  =  memnew ( EditorPropertyRect2 ( p_wide ) ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  hint . suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : RECT2I :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyRect2i  * editor  =  memnew ( EditorPropertyRect2i ( p_wide ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 15:24:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  1 ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  Variant : : VECTOR3 :  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyVector3  * editor  =  memnew ( EditorPropertyVector3 ( p_wide ) ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-23 16:27:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  p_hint  = =  PROPERTY_HINT_LINK ,  hint . suffix ,  hint . radians_as_degrees ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : VECTOR3I :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyVector3i  * editor  =  memnew ( EditorPropertyVector3i ( p_wide ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 15:24:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  1 ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:07:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  1 ,  false ,  p_hint  = =  PROPERTY_HINT_LINK ,  hint . suffix ,  false ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : VECTOR4 :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyVector4  * editor  =  memnew ( EditorPropertyVector4 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-16 17:30:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  p_hint  = =  PROPERTY_HINT_LINK ,  hint . suffix ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : VECTOR4I :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyVector4i  * editor  =  memnew ( EditorPropertyVector4i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 15:24:35 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  1 ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2025-02-05 21:07:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  1 ,  false ,  p_hint  = =  PROPERTY_HINT_LINK ,  hint . suffix ,  false ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : TRANSFORM2D :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-29 17:01:07 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyTransform2D  * editor  =  memnew ( EditorPropertyTransform2D ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  hint . suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : PLANE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-16 23:52:00 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyPlane  * editor  =  memnew ( EditorPropertyPlane ( p_wide ) ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  hint . suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 07:02:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : QUATERNION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyQuaternion  * editor  =  memnew ( EditorPropertyQuaternion ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 16:03:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  hint . suffix ,  p_hint  = =  PROPERTY_HINT_HIDE_QUATERNION_EDIT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-24 17:00:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  Variant : : AABB :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyAABB  * editor  =  memnew ( EditorPropertyAABB ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  hint . suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : BASIS :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyBasis  * editor  =  memnew ( EditorPropertyBasis ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  hint . suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-28 03:36:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : TRANSFORM3D :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-03 21:58:26 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyTransform3D  * editor  =  memnew ( EditorPropertyTransform3D ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
											 
										 
										
											2022-07-20 01:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  hint . suffix ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : PROJECTION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyProjection  * editor  =  memnew ( EditorPropertyProjection ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyRangeHint  hint  =  _parse_range_hint ( p_hint ,  p_hint_text ,  default_float_step ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
											 
										 
										
											2021-06-29 16:42:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( hint . min ,  hint . max ,  hint . step ,  hint . hide_slider ,  hint . suffix ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// misc types
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : COLOR :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyColor  * editor  =  memnew ( EditorPropertyColor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											editor - > setup ( p_hint  ! =  PROPERTY_HINT_COLOR_NO_ALPHA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : STRING_NAME :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( p_hint  = =  PROPERTY_HINT_ENUM  | |  p_hint  = =  PROPERTY_HINT_ENUM_SUGGESTION )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorPropertyTextEnum  * editor  =  memnew ( EditorPropertyTextEnum ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-04 23:42:23 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Vector < String >  options  =  p_hint_text . split ( " , " ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor - > setup ( options ,  true ,  ( p_hint  = =  PROPERTY_HINT_ENUM_SUGGESTION ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyText  * editor  =  memnew ( EditorPropertyText ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( p_hint  = =  PROPERTY_HINT_PLACEHOLDER_TEXT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													editor - > set_placeholder ( p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-09 18:51:43 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  if  ( p_hint  = =  PROPERTY_HINT_PASSWORD )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													editor - > set_secret ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													editor - > set_placeholder ( p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor - > set_string_name ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-20 18:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  Variant : : NODE_PATH :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyNodePath  * editor  =  memnew ( EditorPropertyNodePath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( p_hint  = =  PROPERTY_HINT_NODE_PATH_VALID_TYPES  & &  ! p_hint_text . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-27 20:50:25 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Vector < String >  types  =  p_hint_text . split ( " , " ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector < StringName >  sn  =  Variant ( types ) ;  //convert via variant
 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-29 13:18:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												editor - > setup ( sn ,  ( p_usage  &  PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-24 17:00:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-09 14:53:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : RID :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-13 15:43:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyRID  * editor  =  memnew ( EditorPropertyRID ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : OBJECT :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-19 00:42:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( p_hint  = =  PROPERTY_HINT_NODE_TYPE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyNodePath  * editor  =  memnew ( EditorPropertyNodePath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector < String >  types  =  p_hint_text . split ( " , " ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector < StringName >  sn  =  Variant ( types ) ;  //convert via variant
 
							 
						 
					
						
							
								
									
										
										
										
											2024-05-29 13:18:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												editor - > setup ( sn ,  false ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-19 00:42:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyResource  * editor  =  memnew ( EditorPropertyResource ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												editor - > setup ( p_object ,  p_path ,  p_hint  = =  PROPERTY_HINT_RESOURCE_TYPE  ?  p_hint_text  :  " Resource " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( p_hint  = =  PROPERTY_HINT_RESOURCE_TYPE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-23 18:59:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													const  PackedStringArray  open_in_new_inspector  =  EDITOR_GET ( " interface/inspector/resources_to_open_in_new_inspector " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( const  String  & type  :  open_in_new_inspector )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-19 00:42:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														for  ( int  j  =  0 ;  j  <  p_hint_text . get_slice_count ( " , " ) ;  j + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-23 18:59:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															const  String  inherits  =  p_hint_text . get_slicec ( ' , ' ,  j ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-19 00:42:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															if  ( ClassDB : : is_parent_class ( inherits ,  type ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																editor - > set_use_sub_inspector ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-14 18:15:42 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-19 00:42:02 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-30 02:16:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : CALLABLE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyCallable  * editor  =  memnew ( EditorPropertyCallable ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : SIGNAL :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertySignal  * editor  =  memnew ( EditorPropertySignal ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  Variant : : DICTIONARY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-04 15:04:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( p_hint  = =  PROPERTY_HINT_LOCALIZABLE_STRING )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyLocalizableString  * editor  =  memnew ( EditorPropertyLocalizableString ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorPropertyDictionary  * editor  =  memnew ( EditorPropertyDictionary ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-24 13:03:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												editor - > setup ( p_hint ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-04 15:04:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : ARRAY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-03 04:41:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( Variant : : ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-17 18:06:54 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : PACKED_BYTE_ARRAY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-07 19:32:08 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( Variant : : PACKED_BYTE_ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-24 17:00:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
											
												Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
											 
										 
										
											2020-02-24 15:20:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : PACKED_INT32_ARRAY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-07 19:32:08 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( Variant : : PACKED_INT32_ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
											
												Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
											 
										 
										
											2020-02-24 15:20:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : PACKED_INT64_ARRAY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-07 19:32:08 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( Variant : : PACKED_INT64_ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
											
												Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
											 
										 
										
											2020-02-24 15:20:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : PACKED_FLOAT32_ARRAY :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-07 19:32:08 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( Variant : : PACKED_FLOAT32_ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
											
												Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
											 
										 
										
											2020-02-24 15:20:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : PACKED_FLOAT64_ARRAY :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-07 19:32:08 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( Variant : : PACKED_FLOAT64_ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-17 18:06:54 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : PACKED_STRING_ARRAY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-04 13:53:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( Variant : : PACKED_STRING_ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-17 18:06:54 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : PACKED_VECTOR2_ARRAY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-07 19:32:08 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( Variant : : PACKED_VECTOR2_ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-17 18:06:54 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : PACKED_VECTOR3_ARRAY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-07 19:32:08 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( Variant : : PACKED_VECTOR3_ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-24 17:00:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-17 18:06:54 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : PACKED_COLOR_ARRAY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 16:09:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-07 19:32:08 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											editor - > setup ( Variant : : PACKED_COLOR_ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-01 02:52:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2024-04-08 07:51:34 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : PACKED_VECTOR4_ARRAY :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorPropertyArray  * editor  =  memnew ( EditorPropertyArray ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											editor - > setup ( Variant : : PACKED_VECTOR4_ARRAY ,  p_hint_text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-09 17:08:36 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-09 20:01:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-15 17:12:35 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}