2023-01-05 13:25:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/**************************************************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*  animation_track_editor.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-06-09 15:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "animation_track_editor.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-09-27 11:24:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "animation_track_editor_plugins.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-04-28 15:19:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "core/input/input.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "editor/animation_bezier_editor.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-02-12 02:46:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/editor_node.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "editor/editor_scale.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-11-19 12:45:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/editor_settings.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/editor_string_names.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-03-25 18:06:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "editor/editor_undo_redo_manager.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-04-07 18:59:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# 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" 
  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "editor/plugins/animation_player_editor_plugin.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/animation/animation_player.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/animation/tween.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-04-07 18:59:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/check_box.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-11-19 12:45:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/grid_container.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-04-07 18:59:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/option_button.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "scene/gui/panel_container.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-08-01 17:04:35 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/separator.h" 
  
						 
					
						
							
								
									
										
										
										
											2023-04-07 18:59:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/slider.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "scene/gui/spin_box.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "scene/gui/texture_rect.h" 
  
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/gui/view_panner.h" 
  
						 
					
						
							
								
									
										
										
										
											2020-03-03 22:51:12 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/main/window.h" 
  
						 
					
						
							
								
									
										
										
										
											2021-12-06 01:46:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "scene/scene_string_names.h" 
  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "servers/audio/audio_stream.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackKeyEdit : : _bind_methods ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _update_obj " ) ,  & AnimationTrackKeyEdit : : _update_obj ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _key_ofs_changed " ) ,  & AnimationTrackKeyEdit : : _key_ofs_changed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _hide_script_from_inspector " ) ,  & AnimationTrackKeyEdit : : _hide_script_from_inspector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _hide_metadata_from_inspector " ) ,  & AnimationTrackKeyEdit : : _hide_metadata_from_inspector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_root_path " ) ,  & AnimationTrackKeyEdit : : get_root_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _dont_undo_redo " ) ,  & AnimationTrackKeyEdit : : _dont_undo_redo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _is_read_only " ) ,  & AnimationTrackKeyEdit : : _is_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackKeyEdit : : _fix_node_path ( Variant  & value )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NodePath  np  =  value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-14 10:19:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( np  = =  NodePath ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Node  * root  =  EditorNode : : get_singleton ( ) - > get_tree ( ) - > get_root ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Node  * np_node  =  root - > get_node ( np ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( np_node ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Node  * edited_node  =  root - > get_node ( base ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( edited_node ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									value  =  edited_node - > get_path_to ( np_node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackKeyEdit : : _update_obj ( const  Ref < Animation >  & p_anim )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( setting  | |  animation  ! =  p_anim )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									notify_change ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackKeyEdit : : _key_ofs_changed ( const  Ref < Animation >  & p_anim ,  float  from ,  float  to )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( animation  ! =  p_anim  | |  from  ! =  key_ofs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									key_ofs  =  to ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-14 10:19:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									notify_change ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  AnimationTrackKeyEdit : : _set ( const  StringName  & p_name ,  const  Variant  & p_value )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  key  =  animation - > track_find_key ( track ,  key_ofs ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND_V ( key  = =  - 1 ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  name  =  p_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( name  = =  " easing " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  val  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  prev_val  =  animation - > track_get_key_transition ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										setting  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > create_action ( TTR ( " Animation Change Transition " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_key_transition " ,  track ,  key ,  val ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_key_transition " ,  track ,  key ,  prev_val ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										setting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( animation - > track_get_type ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_SCALE_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " position "  | |  name  = =  " rotation "  | |  name  = =  " scale " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Variant  old  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												setting  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												String  action_name ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												switch  ( animation - > track_get_type ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														action_name  =  TTR ( " Animation Change Position3D " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														action_name  =  TTR ( " Animation Change Rotation3D " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_SCALE_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														action_name  =  TTR ( " Animation Change Scale3D " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												undo_redo - > create_action ( action_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  p_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  old ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												setting  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_BLEND_SHAPE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Variant  value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( value . get_type ( )  = =  Variant : : NODE_PATH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													_fix_node_path ( value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Variant  prev  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_METHOD :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Dictionary  d_old  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Dictionary  d_new  =  d_old . duplicate ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  change_notify_deserved  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  mergeable  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " name " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												d_new [ " method " ]  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( name  = =  " arg_count " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector < Variant >  args  =  d_old [ " args " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												args . resize ( p_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												d_new [ " args " ]  =  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												change_notify_deserved  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( name . begins_with ( " args/ " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector < Variant >  args  =  d_old [ " args " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  idx  =  name . get_slice ( " / " ,  1 ) . to_int ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ERR_FAIL_INDEX_V ( idx ,  args . size ( ) ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												String  what  =  name . get_slice ( " / " ,  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( what  = =  " type " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Variant : : Type  t  =  Variant : : Type ( int ( p_value ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( t  ! =  args [ idx ] . get_type ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Callable : : CallError  err ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-15 19:32:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( Variant : : can_convert_strict ( args [ idx ] . get_type ( ) ,  t ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															Variant  old  =  args [ idx ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															Variant  * ptrs [ 1 ]  =  {  & old  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															Variant : : construct ( t ,  args . write [ idx ] ,  ( const  Variant  * * ) ptrs ,  1 ,  err ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															Variant : : construct ( t ,  args . write [ idx ] ,  nullptr ,  0 ,  err ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														change_notify_deserved  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														d_new [ " args " ]  =  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if  ( what  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Variant  value  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( value . get_type ( )  = =  Variant : : NODE_PATH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														_fix_node_path ( value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													args . write [ idx ]  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													d_new [ " args " ]  =  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													mergeable  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( mergeable )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Call " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Call " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											setting  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  d_new ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  d_old ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											setting  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( change_notify_deserved )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												notify_change ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_BEZIER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  Variant  & value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  prev  =  animation - > bezier_track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " bezier_track_set_key_value " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " bezier_track_set_key_value " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-14 10:19:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " in_handle " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  Variant  & value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector2  prev  =  animation - > bezier_track_get_key_in_handle ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " bezier_track_set_key_in_handle " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " bezier_track_set_key_in_handle " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-14 10:19:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " out_handle " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  Variant  & value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector2  prev  =  animation - > bezier_track_get_key_out_handle ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " bezier_track_set_key_out_handle " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " bezier_track_set_key_out_handle " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " handle_mode " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  Variant  & value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												setting  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  prev  =  animation - > bezier_track_get_key_handle_mode ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _bezier_track_set_key_handle_mode " ,  animation . ptr ( ) ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _bezier_track_set_key_handle_mode " ,  animation . ptr ( ) ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-14 10:19:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												setting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_AUDIO :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " stream " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Ref < AudioStream >  stream  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Ref < Resource >  prev  =  animation - > audio_track_get_key_stream ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " audio_track_set_key_stream " ,  track ,  key ,  stream ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " audio_track_set_key_stream " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " start_offset " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  prev  =  animation - > audio_track_get_key_start_offset ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " audio_track_set_key_start_offset " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " audio_track_set_key_start_offset " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-03 10:02:53 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-03 10:02:53 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " end_offset " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  prev  =  animation - > audio_track_get_key_end_offset ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " audio_track_set_key_end_offset " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " audio_track_set_key_end_offset " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " animation " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												StringName  anim_name  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												StringName  prev  =  animation - > animation_track_get_key_animation ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " animation_track_set_key_animation " ,  track ,  key ,  anim_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " animation_track_set_key_animation " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  AnimationTrackKeyEdit : : _get ( const  StringName  & p_name ,  Variant  & r_ret )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  key  =  animation - > track_find_key ( track ,  key_ofs ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND_V ( key  = =  - 1 ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  name  =  p_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( name  = =  " easing " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										r_ret  =  animation - > track_get_key_transition ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( animation - > track_get_type ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_SCALE_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " position "  | |  name  = =  " rotation "  | |  name  = =  " scale " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_BLEND_SHAPE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_METHOD :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Dictionary  d  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " name " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ERR_FAIL_COND_V ( ! d . has ( " method " ) ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  d [ " method " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ERR_FAIL_COND_V ( ! d . has ( " args " ) ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Vector < Variant >  args  =  d [ " args " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " arg_count " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  args . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name . begins_with ( " args/ " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  idx  =  name . get_slice ( " / " ,  1 ) . to_int ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ERR_FAIL_INDEX_V ( idx ,  args . size ( ) ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												String  what  =  name . get_slice ( " / " ,  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( what  = =  " type " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													r_ret  =  args [ idx ] . get_type ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( what  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													r_ret  =  args [ idx ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_BEZIER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > bezier_track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " in_handle " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > bezier_track_get_key_in_handle ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " out_handle " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > bezier_track_get_key_out_handle ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-03 10:02:53 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " handle_mode " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > bezier_track_get_key_handle_mode ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_AUDIO :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " stream " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > audio_track_get_key_stream ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " start_offset " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > audio_track_get_key_start_offset ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( name  = =  " end_offset " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > audio_track_get_key_end_offset ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " animation " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > animation_track_get_key_animation ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackKeyEdit : : _get_property_list ( List < PropertyInfo >  * p_list )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( animation . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_INDEX ( track ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  key  =  animation - > track_find_key ( track ,  key_ofs ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND ( key  = =  - 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( animation - > track_get_type ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_POSITION_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : VECTOR3 ,  PNAME ( " position " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ROTATION_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : QUATERNION ,  PNAME ( " rotation " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_SCALE_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : VECTOR3 ,  PNAME ( " scale " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_BLEND_SHAPE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : FLOAT ,  PNAME ( " value " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Variant  v  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( hint . type  ! =  Variant : : NIL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												PropertyInfo  pi  =  hint ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												pi . name  =  PNAME ( " value " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( pi ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												PropertyHint  val_hint  =  PROPERTY_HINT_NONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												String  val_hint_string ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( v . get_type ( )  = =  Variant : : OBJECT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Could actually check the object property if exists..? Yes I will!
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Ref < Resource >  res  =  v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( res . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														val_hint  =  PROPERTY_HINT_RESOURCE_TYPE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														val_hint_string  =  res - > get_class ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( v . get_type ( )  ! =  Variant : : NIL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													p_list - > push_back ( PropertyInfo ( v . get_type ( ) ,  PNAME ( " value " ) ,  val_hint ,  val_hint_string ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_METHOD :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : STRING_NAME ,  PNAME ( " name " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : INT ,  PNAME ( " arg_count " ) ,  PROPERTY_HINT_RANGE ,  " 0,32,1,or_greater " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Dictionary  d  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_FAIL_COND ( ! d . has ( " args " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Vector < Variant >  args  =  d [ " args " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  vtypes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  Variant : : VARIANT_MAX ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( i  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													vtypes  + =  " , " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												vtypes  + =  Variant : : get_type_name ( Variant : : Type ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  args . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : INT ,  vformat ( " %s/%d/%s " ,  PNAME ( " args " ) ,  i ,  PNAME ( " type " ) ) ,  PROPERTY_HINT_ENUM ,  vtypes ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( args [ i ] . get_type ( )  ! =  Variant : : NIL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													p_list - > push_back ( PropertyInfo ( args [ i ] . get_type ( ) ,  vformat ( " %s/%d/%s " ,  PNAME ( " args " ) ,  i ,  PNAME ( " value " ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 19:45:30 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_BEZIER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Animation : : HandleMode  hm  =  animation - > bezier_track_get_key_handle_mode ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : FLOAT ,  PNAME ( " value " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( hm  = =  Animation : : HANDLE_MODE_LINEAR )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : VECTOR2 ,  PNAME ( " in_handle " ) ,  PROPERTY_HINT_NONE ,  " " ,  PROPERTY_USAGE_DEFAULT  |  PROPERTY_USAGE_READ_ONLY ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : VECTOR2 ,  PNAME ( " out_handle " ) ,  PROPERTY_HINT_NONE ,  " " ,  PROPERTY_USAGE_DEFAULT  |  PROPERTY_USAGE_READ_ONLY ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : VECTOR2 ,  PNAME ( " in_handle " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : VECTOR2 ,  PNAME ( " out_handle " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : INT ,  PNAME ( " handle_mode " ) ,  PROPERTY_HINT_ENUM ,  " Free,Linear,Balanced,Mirrored " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_AUDIO :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : OBJECT ,  PNAME ( " stream " ) ,  PROPERTY_HINT_RESOURCE_TYPE ,  " AudioStream " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : FLOAT ,  PNAME ( " start_offset " ) ,  PROPERTY_HINT_RANGE ,  " 0,3600,0.0001,or_greater " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : FLOAT ,  PNAME ( " end_offset " ) ,  PROPERTY_HINT_RANGE ,  " 0,3600,0.0001,or_greater " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  animations ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( root_path  & &  root_path - > has_node ( animation - > track_get_path ( track ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												AnimationPlayer  * ap  =  Object : : cast_to < AnimationPlayer > ( root_path - > get_node ( animation - > track_get_path ( track ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ap )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													List < StringName >  anims ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ap - > get_animation_list ( & anims ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( const  StringName  & E  :  anims )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( ! animations . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															animations  + =  " , " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														animations  + =  String ( E ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! animations . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												animations  + =  " , " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											animations  + =  " [stop] " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											p_list - > push_back ( PropertyInfo ( Variant : : STRING_NAME ,  PNAME ( " animation " ) ,  PROPERTY_HINT_ENUM ,  animations ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										p_list - > push_back ( PropertyInfo ( Variant : : FLOAT ,  PNAME ( " easing " ) ,  PROPERTY_HINT_EXP_EASING ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackKeyEdit : : notify_change ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									notify_property_list_changed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Node  * AnimationTrackKeyEdit : : get_root_path ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  root_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackKeyEdit : : set_use_fps ( bool  p_enable )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									use_fps  =  p_enable ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									notify_property_list_changed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationMultiTrackKeyEdit : : _bind_methods ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _update_obj " ) ,  & AnimationMultiTrackKeyEdit : : _update_obj ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _key_ofs_changed " ) ,  & AnimationMultiTrackKeyEdit : : _key_ofs_changed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _hide_script_from_inspector " ) ,  & AnimationMultiTrackKeyEdit : : _hide_script_from_inspector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _hide_metadata_from_inspector " ) ,  & AnimationMultiTrackKeyEdit : : _hide_metadata_from_inspector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " get_root_path " ) ,  & AnimationMultiTrackKeyEdit : : get_root_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _dont_undo_redo " ) ,  & AnimationMultiTrackKeyEdit : : _dont_undo_redo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _is_read_only " ) ,  & AnimationMultiTrackKeyEdit : : _is_read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationMultiTrackKeyEdit : : _fix_node_path ( Variant  & value ,  NodePath  & base )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NodePath  np  =  value ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-22 14:48:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( np  = =  NodePath ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Node  * root  =  EditorNode : : get_singleton ( ) - > get_tree ( ) - > get_root ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Node  * np_node  =  root - > get_node ( np ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( np_node ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Node  * edited_node  =  root - > get_node ( base ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( edited_node ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									value  =  edited_node - > get_path_to ( np_node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationMultiTrackKeyEdit : : _update_obj ( const  Ref < Animation >  & p_anim )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( setting  | |  animation  ! =  p_anim )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									notify_change ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationMultiTrackKeyEdit : : _key_ofs_changed ( const  Ref < Animation >  & p_anim ,  float  from ,  float  to )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( animation  ! =  p_anim )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( const  KeyValue < int ,  List < float > >  & E  :  key_ofs_map )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  key  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( const  float  & key_ofs  :  E . value )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( from  ! =  key_ofs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												key + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  track  =  E . key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											key_ofs_map [ track ] [ key ]  =  to ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											notify_change ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  AnimationMultiTrackKeyEdit : : _set ( const  StringName  & p_name ,  const  Variant  & p_value )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  update_obj  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  change_notify_deserved  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  KeyValue < int ,  List < float > >  & E  :  key_ofs_map )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  track  =  E . key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( const  float  & key_ofs  :  E . value )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  key  =  animation - > track_find_key ( track ,  key_ofs ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_FAIL_COND_V ( key  = =  - 1 ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											String  name  =  p_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " easing " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  val  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  prev_val  =  animation - > track_get_key_transition ( track ,  key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ! setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > create_action ( TTR ( " Animation Multi Change Transition " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_key_transition " ,  track ,  key ,  val ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_key_transition " ,  track ,  key ,  prev_val ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												update_obj  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											switch  ( animation - > track_get_type ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_SCALE_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Variant  old  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ! setting )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														String  action_name ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														switch  ( animation - > track_get_type ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																action_name  =  TTR ( " Animation Multi Change Position3D " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																action_name  =  TTR ( " Animation Multi Change Rotation3D " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															case  Animation : : TYPE_SCALE_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																action_name  =  TTR ( " Animation Multi Change Scale3D " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														setting  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														undo_redo - > create_action ( action_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  p_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  old ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													update_obj  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_BLEND_SHAPE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( name  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Variant  value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( value . get_type ( )  = =  Variant : : NODE_PATH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															_fix_node_path ( value ,  base_map [ track ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ! setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Variant  prev  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_obj  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_METHOD :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Dictionary  d_old  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Dictionary  d_new  =  d_old . duplicate ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													bool  mergeable  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( name  = =  " name " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														d_new [ " method " ]  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( name  = =  " arg_count " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Vector < Variant >  args  =  d_old [ " args " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														args . resize ( p_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														d_new [ " args " ]  =  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														change_notify_deserved  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( name . begins_with ( " args/ " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Vector < Variant >  args  =  d_old [ " args " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														int  idx  =  name . get_slice ( " / " ,  1 ) . to_int ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ERR_FAIL_INDEX_V ( idx ,  args . size ( ) ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														String  what  =  name . get_slice ( " / " ,  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( what  = =  " type " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															Variant : : Type  t  =  Variant : : Type ( int ( p_value ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( t  ! =  args [ idx ] . get_type ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																Callable : : CallError  err ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-15 19:32:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																if  ( Variant : : can_convert_strict ( args [ idx ] . get_type ( ) ,  t ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																	Variant  old  =  args [ idx ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	Variant  * ptrs [ 1 ]  =  {  & old  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	Variant : : construct ( t ,  args . write [ idx ] ,  ( const  Variant  * * ) ptrs ,  1 ,  err ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	Variant : : construct ( t ,  args . write [ idx ] ,  nullptr ,  0 ,  err ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																change_notify_deserved  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																d_new [ " args " ]  =  args ; 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														}  else  if  ( what  = =  " value " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															Variant  value  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( value . get_type ( )  = =  Variant : : NODE_PATH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																_fix_node_path ( value ,  base_map [ track ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															args . write [ idx ]  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															d_new [ " args " ]  =  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															mergeable  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Variant  prev  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ! setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( mergeable )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Call " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Call " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  d_new ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_key_value " ,  track ,  key ,  d_old ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													update_obj  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_BEZIER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( name  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														const  Variant  & value  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( ! setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														float  prev  =  animation - > bezier_track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( animation . ptr ( ) ,  " bezier_track_set_key_value " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( animation . ptr ( ) ,  " bezier_track_set_key_value " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_obj  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( name  = =  " in_handle " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														const  Variant  & value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ! setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Vector2  prev  =  animation - > bezier_track_get_key_in_handle ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( this ,  " _bezier_track_set_key_in_handle " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( this ,  " _bezier_track_set_key_in_handle " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_obj  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( name  = =  " out_handle " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														const  Variant  & value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( ! setting )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Vector2  prev  =  animation - > bezier_track_get_key_out_handle ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( this ,  " _bezier_track_set_key_out_handle " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( this ,  " _bezier_track_set_key_out_handle " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_obj  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( name  = =  " handle_mode " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														const  Variant  & value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ! setting )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															setting  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														int  prev  =  animation - > bezier_track_get_key_handle_mode ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( this ,  " _bezier_track_set_key_handle_mode " ,  animation . ptr ( ) ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( this ,  " _bezier_track_set_key_handle_mode " ,  animation . ptr ( ) ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_obj  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_AUDIO :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( name  = =  " stream " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Ref < AudioStream >  stream  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ! setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Ref < Resource >  prev  =  animation - > audio_track_get_key_stream ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( animation . ptr ( ) ,  " audio_track_set_key_stream " ,  track ,  key ,  stream ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( animation . ptr ( ) ,  " audio_track_set_key_stream " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														update_obj  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  if  ( name  = =  " start_offset " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														float  value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ! setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														float  prev  =  animation - > audio_track_get_key_start_offset ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( animation . ptr ( ) ,  " audio_track_set_key_start_offset " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( animation . ptr ( ) ,  " audio_track_set_key_start_offset " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_obj  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( name  = =  " end_offset " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														float  value  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ! setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														float  prev  =  animation - > audio_track_get_key_end_offset ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( animation . ptr ( ) ,  " audio_track_set_key_end_offset " ,  track ,  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( animation . ptr ( ) ,  " audio_track_set_key_end_offset " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_obj  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( name  = =  " animation " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														StringName  anim_name  =  p_value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ! setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															setting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															undo_redo - > create_action ( TTR ( " Animation Multi Change Keyframe Value " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														StringName  prev  =  animation - > animation_track_get_key_animation ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( animation . ptr ( ) ,  " animation_track_set_key_animation " ,  track ,  key ,  anim_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( animation . ptr ( ) ,  " animation_track_set_key_animation " ,  track ,  key ,  prev ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_obj  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( update_obj )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _update_obj " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										setting  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( change_notify_deserved )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											notify_change ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  AnimationMultiTrackKeyEdit : : _get ( const  StringName  & p_name ,  Variant  & r_ret )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  KeyValue < int ,  List < float > >  & E  :  key_ofs_map )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  track  =  E . key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( const  float  & key_ofs  :  E . value )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  key  =  animation - > track_find_key ( track ,  key_ofs ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_CONTINUE ( key  = =  - 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  name  =  p_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( name  = =  " easing " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												r_ret  =  animation - > track_get_key_transition ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											switch  ( animation - > track_get_type ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_SCALE_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( name  = =  " position "  | |  name  = =  " rotation "  | |  name  = =  " scale " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_BLEND_SHAPE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( name  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_METHOD :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Dictionary  d  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( name  = =  " name " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ERR_FAIL_COND_V ( ! d . has ( " method " ) ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  d [ " method " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ERR_FAIL_COND_V ( ! d . has ( " args " ) ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Vector < Variant >  args  =  d [ " args " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( name  = =  " arg_count " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  args . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( name . begins_with ( " args/ " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														int  idx  =  name . get_slice ( " / " ,  1 ) . to_int ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ERR_FAIL_INDEX_V ( idx ,  args . size ( ) ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														String  what  =  name . get_slice ( " / " ,  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( what  = =  " type " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															r_ret  =  args [ idx ] . get_type ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( what  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															r_ret  =  args [ idx ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_BEZIER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( name  = =  " value " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  animation - > bezier_track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( name  = =  " in_handle " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  animation - > bezier_track_get_key_in_handle ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( name  = =  " out_handle " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  animation - > bezier_track_get_key_out_handle ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-03 10:02:53 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( name  = =  " handle_mode " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  animation - > bezier_track_get_key_handle_mode ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_AUDIO :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( name  = =  " stream " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  animation - > audio_track_get_key_stream ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( name  = =  " start_offset " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  animation - > audio_track_get_key_start_offset ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( name  = =  " end_offset " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  animation - > audio_track_get_key_end_offset ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( name  = =  " animation " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														r_ret  =  animation - > animation_track_get_key_animation ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationMultiTrackKeyEdit : : _get_property_list ( List < PropertyInfo >  * p_list )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( animation . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  first_track  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  first_key  =  - 1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  same_track_type  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  same_key_type  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  KeyValue < int ,  List < float > >  & E  :  key_ofs_map )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  track  =  E . key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ERR_FAIL_INDEX ( track ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( first_track  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											first_track  =  track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( same_track_type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( animation - > track_get_type ( first_track )  ! =  animation - > track_get_type ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												same_track_type  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												same_key_type  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( const  float  & F  :  E . value )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  key  =  animation - > track_find_key ( track ,  F ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ERR_FAIL_COND ( key  = =  - 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( first_key  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													first_key  =  key ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( animation - > track_get_key_value ( first_track ,  first_key ) . get_type ( )  ! =  animation - > track_get_key_value ( track ,  key ) . get_type ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													same_key_type  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( same_track_type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch  ( animation - > track_get_type ( first_track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : TYPE_POSITION_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : VECTOR3 ,  " position " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : TYPE_ROTATION_3D :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-06 13:48:33 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : QUATERNION ,  " rotation " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : TYPE_SCALE_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : VECTOR3 ,  " scale " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : TYPE_BLEND_SHAPE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : FLOAT ,  " value " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( same_key_type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Variant  v  =  animation - > track_get_key_value ( first_track ,  first_key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-17 23:28:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( hint . type  ! =  Variant : : NIL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														PropertyInfo  pi  =  hint ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														pi . name  =  " value " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														p_list - > push_back ( pi ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														PropertyHint  val_hint  =  PROPERTY_HINT_NONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														String  val_hint_string ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( v . get_type ( )  = =  Variant : : OBJECT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															// Could actually check the object property if exists..? Yes I will!
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															Ref < Resource >  res  =  v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( res . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																val_hint  =  PROPERTY_HINT_RESOURCE_TYPE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																val_hint_string  =  res - > get_class ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( v . get_type ( )  ! =  Variant : : NIL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															p_list - > push_back ( PropertyInfo ( v . get_type ( ) ,  " value " ,  val_hint ,  val_hint_string ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : FLOAT ,  " easing " ,  PROPERTY_HINT_EXP_EASING ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : TYPE_METHOD :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : STRING_NAME ,  " name " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-09 14:58:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : INT ,  " arg_count " ,  PROPERTY_HINT_RANGE ,  " 0,32,1,or_greater " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Dictionary  d  =  animation - > track_get_key_value ( first_track ,  first_key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ERR_FAIL_COND ( ! d . has ( " args " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector < Variant >  args  =  d [ " args " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												String  vtypes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  Variant : : VARIANT_MAX ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( i  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														vtypes  + =  " , " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													vtypes  + =  Variant : : get_type_name ( Variant : : Type ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  args . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													p_list - > push_back ( PropertyInfo ( Variant : : INT ,  " args/ "  +  itos ( i )  +  " /type " ,  PROPERTY_HINT_ENUM ,  vtypes ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( args [ i ] . get_type ( )  ! =  Variant : : NIL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														p_list - > push_back ( PropertyInfo ( args [ i ] . get_type ( ) ,  " args/ "  +  itos ( i )  +  " /value " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : TYPE_BEZIER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : FLOAT ,  " value " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : VECTOR2 ,  " in_handle " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : VECTOR2 ,  " out_handle " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : INT ,  " handle_mode " ,  PROPERTY_HINT_ENUM ,  " Free,Linear,Balanced,Mirrored " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : TYPE_AUDIO :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : OBJECT ,  " stream " ,  PROPERTY_HINT_RESOURCE_TYPE ,  " AudioStream " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : FLOAT ,  " start_offset " ,  PROPERTY_HINT_RANGE ,  " 0,3600,0.0001,or_greater " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : FLOAT ,  " end_offset " ,  PROPERTY_HINT_RANGE ,  " 0,3600,0.0001,or_greater " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : TYPE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( key_ofs_map . size ( )  >  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												String  animations ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( root_path  & &  root_path - > has_node ( animation - > track_get_path ( first_track ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													AnimationPlayer  * ap  =  Object : : cast_to < AnimationPlayer > ( root_path - > get_node ( animation - > track_get_path ( first_track ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ap )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														List < StringName >  anims ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ap - > get_animation_list ( & anims ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														for  ( List < StringName > : : Element  * G  =  anims . front ( ) ;  G ;  G  =  G - > next ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( ! animations . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																animations  + =  " , " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															animations  + =  String ( G - > get ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ! animations . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													animations  + =  " , " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												animations  + =  " [stop] " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												p_list - > push_back ( PropertyInfo ( Variant : : STRING_NAME ,  " animation " ,  PROPERTY_HINT_ENUM ,  animations ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationMultiTrackKeyEdit : : notify_change ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									notify_property_list_changed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Node  * AnimationMultiTrackKeyEdit : : get_root_path ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  root_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationMultiTrackKeyEdit : : set_use_fps ( bool  p_enable )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									use_fps  =  p_enable ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									notify_property_list_changed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : _zoom_changed ( double )  {  
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									play_position - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " zoom_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								float  AnimationTimelineEdit : : get_zoom_scale ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2020-04-05 13:57:38 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  zv  =  zoom - > get_max ( )  -  zoom - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									if  ( zv  <  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										zv  =  1.0  -  zv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  Math : : pow ( 1.0f  +  zv ,  8.0f )  *  100 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  1.0  /  Math : : pow ( zv ,  8.0f )  *  100 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : _anim_length_changed ( double  p_new_len )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( editing )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									p_new_len  =  MAX ( 0.0001 ,  p_new_len ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 23:48:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( use_fps  & &  animation - > get_step ( )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										p_new_len  * =  animation - > get_step ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 13:42:04 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									editing  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-10 12:29:05 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > create_action ( TTR ( " Change Animation Length " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_do_method ( animation . ptr ( ) ,  " set_length " ,  p_new_len ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_undo_method ( animation . ptr ( ) ,  " set_length " ,  animation - > get_length ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									editing  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " length_changed " ) ,  p_new_len ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : _anim_loop_pressed ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! read_only )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > create_action ( TTR ( " Change Animation Loop " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch  ( animation - > get_loop_mode ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : LOOP_NONE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " set_loop_mode " ,  Animation : : LOOP_LINEAR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : LOOP_LINEAR :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " set_loop_mode " ,  Animation : : LOOP_PINGPONG ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Animation : : LOOP_PINGPONG :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " set_loop_mode " ,  Animation : : LOOP_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-16 16:19:53 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( this ,  " update_values " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( animation . ptr ( ) ,  " set_loop_mode " ,  animation - > get_loop_mode ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-16 16:19:53 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( this ,  " update_values " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  base_path  =  animation - > get_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( FileAccess : : exists ( base_path  +  " .import " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Can't change loop mode on animation instanced from imported scene. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Can't change loop mode on animation embedded in another scene. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										update_values ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 22:25:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  AnimationTimelineEdit : : get_buttons_width ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Texture2D >  interp_mode  =  get_editor_theme_icon ( SNAME ( " TrackContinuous " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < Texture2D >  interp_type  =  get_editor_theme_icon ( SNAME ( " InterpRaw " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < Texture2D >  loop_type  =  get_editor_theme_icon ( SNAME ( " InterpWrapClamp " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < Texture2D >  remove_icon  =  get_editor_theme_icon ( SNAME ( " Remove " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Texture2D >  down_icon  =  get_theme_icon ( SNAME ( " select_arrow " ) ,  SNAME ( " Tree " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  total_w  =  interp_mode - > get_width ( )  +  interp_type - > get_width ( )  +  loop_type - > get_width ( )  +  remove_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									total_w  + =  ( down_icon - > get_width ( )  +  4  *  EDSCALE )  *  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  total_w ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  AnimationTimelineEdit : : get_name_limit ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Texture2D >  hsize_icon  =  get_editor_theme_icon ( SNAME ( " Hsize " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  limit  =  MAX ( name_limit ,  add_track - > get_minimum_size ( ) . width  +  hsize_icon - > get_width ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									limit  =  MIN ( limit ,  get_size ( ) . width  -  get_buttons_width ( )  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  limit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : _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-03-10 13:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 16:43:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											panner - > setup ( ( ViewPanner : : ControlScheme ) EDITOR_GET ( " editors/panning/animation_editors_panning_scheme " ) . operator  int ( ) ,  ED_GET_SHORTCUT ( " canvas_item_editor/pan_view " ) ,  bool ( EDITOR_GET ( " editors/panning/simple_panning " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											add_track - > set_icon ( get_editor_theme_icon ( SNAME ( " Add " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											loop - > set_icon ( get_editor_theme_icon ( SNAME ( " Loop " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											time_icon - > set_texture ( get_editor_theme_icon ( SNAME ( " Time " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > get_popup ( ) - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											add_track - > get_popup ( ) - > add_icon_item ( get_editor_theme_icon ( SNAME ( " KeyValue " ) ) ,  TTR ( " Property Track " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > get_popup ( ) - > add_icon_item ( get_editor_theme_icon ( SNAME ( " KeyXPosition " ) ) ,  TTR ( " 3D Position Track " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > get_popup ( ) - > add_icon_item ( get_editor_theme_icon ( SNAME ( " KeyXRotation " ) ) ,  TTR ( " 3D Rotation Track " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > get_popup ( ) - > add_icon_item ( get_editor_theme_icon ( SNAME ( " KeyXScale " ) ) ,  TTR ( " 3D Scale Track " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > get_popup ( ) - > add_icon_item ( get_editor_theme_icon ( SNAME ( " KeyBlendShape " ) ) ,  TTR ( " Blend Shape Track " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > get_popup ( ) - > add_icon_item ( get_editor_theme_icon ( SNAME ( " KeyCall " ) ) ,  TTR ( " Call Method Track " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > get_popup ( ) - > add_icon_item ( get_editor_theme_icon ( SNAME ( " KeyBezier " ) ) ,  TTR ( " Bezier Curve Track " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > get_popup ( ) - > add_icon_item ( get_editor_theme_icon ( SNAME ( " KeyAudio " ) ) ,  TTR ( " Audio Playback Track " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > get_popup ( ) - > add_icon_item ( get_editor_theme_icon ( SNAME ( " KeyAnimation " ) ) ,  TTR ( " Animation Playback Track " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  EditorSettings : : NOTIFICATION_EDITOR_SETTINGS_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 16:43:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											panner - > setup ( ( ViewPanner : : ControlScheme ) EDITOR_GET ( " editors/panning/animation_editors_panning_scheme " ) . operator  int ( ) ,  ED_GET_SHORTCUT ( " canvas_item_editor/pan_view " ) ,  bool ( EDITOR_GET ( " editors/panning/simple_panning " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 15:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_RESIZED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											len_hb - > set_position ( Vector2 ( get_size ( ) . width  -  get_buttons_width ( ) ,  0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											len_hb - > set_size ( Size2 ( get_buttons_width ( ) ,  get_size ( ) . height ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_DRAW :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  key_range  =  get_size ( ) . width  -  get_buttons_width ( )  -  get_name_limit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Ref < Font >  font  =  get_theme_font ( SNAME ( " font " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  font_size  =  get_theme_font_size ( SNAME ( " font_size " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Color  color  =  get_theme_color ( SNAME ( " font_color " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  zoomw  =  key_range ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  scale  =  get_zoom_scale ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  h  =  get_size ( ) . height ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											float  l  =  animation - > get_length ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( l  < =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												l  =  0.0001 ;  // Avoid crashor.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Ref < Texture2D >  hsize_icon  =  get_editor_theme_icon ( SNAME ( " Hsize " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											hsize_rect  =  Rect2 ( get_name_limit ( )  -  hsize_icon - > get_width ( )  -  2  *  EDSCALE ,  ( get_size ( ) . height  -  hsize_icon - > get_height ( ) )  /  2 ,  hsize_icon - > get_width ( ) ,  hsize_icon - > get_height ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											draw_texture ( hsize_icon ,  hsize_rect . position ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  time_min  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  time_max  =  animation - > get_length ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  animation - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( animation - > track_get_key_count ( i )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														float  beg  =  animation - > track_get_key_time ( i ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( beg  <  time_min )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															time_min  =  beg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														float  end  =  animation - > track_get_key_time ( i ,  animation - > track_get_key_count ( i )  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( end  >  time_max )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															time_max  =  end ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												float  extra  =  ( zoomw  /  scale )  *  0.5 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												time_max  + =  extra ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												set_min ( time_min ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												set_max ( time_max ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( zoomw  /  scale  <  ( time_max  -  time_min ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													hscroll - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													hscroll - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											set_page ( zoomw  /  scale ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  end_px  =  ( l  -  get_value ( ) )  *  scale ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  begin_px  =  - get_value ( )  *  scale ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  notimecol  =  get_theme_color ( SNAME ( " dark_color_2 " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  timecolor  =  color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											timecolor . a  =  0.2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Color  linecolor  =  color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											linecolor . a  =  0.2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 17:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												draw_rect ( Rect2 ( Point2 ( get_name_limit ( ) ,  0 ) ,  Point2 ( zoomw  -  1 ,  h ) ) ,  notimecol ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 17:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( begin_px  <  zoomw  & &  end_px  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( begin_px  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														begin_px  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( end_px  >  zoomw )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														end_px  =  zoomw ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 17:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													draw_rect ( Rect2 ( Point2 ( get_name_limit ( )  +  begin_px ,  0 ) ,  Point2 ( end_px  -  begin_px ,  h ) ) ,  timecolor ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 17:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  color_time_sec  =  color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Color  color_time_dec  =  color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											color_time_dec . a  * =  0.5 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# define SC_ADJ 100 
  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  dec  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  step  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  decimals  =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  step_found  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-09 12:47:10 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											const  float  period_width  =  font - > get_char_size ( ' . ' ,  font_size ) . width ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  max_digit_width  =  font - > get_char_size ( ' 0 ' ,  font_size ) . width ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( int  i  =  1 ;  i  < =  9 ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-09 12:47:10 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												const  float  digit_width  =  font - > get_char_size ( ' 0 '  +  i ,  font_size ) . width ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												max_digit_width  =  MAX ( digit_width ,  max_digit_width ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											const  int  max_sc  =  int ( Math : : ceil ( zoomw  /  scale ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  int  max_sc_width  =  String : : num ( max_sc ) . length ( )  *  max_digit_width ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											while  ( ! step_found )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-07 13:23:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												int  min  =  max_sc_width ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( decimals  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													min  + =  period_width  +  max_digit_width  *  decimals ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												static  const  int  _multp [ 3 ]  =  {  1 ,  2 ,  5  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  3 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													step  =  ( _multp [ i ]  *  dec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( step  *  scale  /  SC_ADJ  >  min )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														step_found  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( step_found )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												dec  * =  10 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												decimals - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( decimals  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													decimals  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( use_fps )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  step_size  =  animation - > get_step ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( step_size  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  prev_frame_ofs  =  - 10000000 ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( int  i  =  0 ;  i  <  zoomw ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														float  pos  =  get_value ( )  +  double ( i )  /  scale ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														float  prev  =  get_value ( )  +  ( double ( i )  -  1.0 )  /  scale ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														int  frame  =  pos  /  step_size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														int  prev_frame  =  prev  /  step_size ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														bool  sub  =  Math : : floor ( prev )  = =  Math : : floor ( pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( frame  ! =  prev_frame  & &  i  > =  prev_frame_ofs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															draw_line ( Point2 ( get_name_limit ( )  +  i ,  0 ) ,  Point2 ( get_name_limit ( )  +  i ,  h ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															draw_string ( font ,  Point2 ( get_name_limit ( )  +  i  +  3  *  EDSCALE ,  ( h  -  font - > get_height ( font_size ) )  /  2  +  font - > get_ascent ( font_size ) ) . floor ( ) ,  itos ( frame ) ,  HORIZONTAL_ALIGNMENT_LEFT ,  zoomw  -  i ,  font_size ,  sub  ?  color_time_dec  :  color_time_sec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-09 12:47:10 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															prev_frame_ofs  =  i  +  font - > get_string_size ( itos ( frame ) ,  HORIZONTAL_ALIGNMENT_LEFT ,  - 1 ,  font_size ) . x  +  5  *  EDSCALE ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  zoomw ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  pos  =  get_value ( )  +  double ( i )  /  scale ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  prev  =  get_value ( )  +  ( double ( i )  -  1.0 )  /  scale ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  sc  =  int ( Math : : floor ( pos  *  SC_ADJ ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  prev_sc  =  int ( Math : : floor ( prev  *  SC_ADJ ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bool  sub  =  ( sc  %  SC_ADJ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ( sc  /  step )  ! =  ( prev_sc  /  step )  | |  ( prev_sc  <  0  & &  sc  > =  0 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														int  scd  =  sc  <  0  ?  prev_sc  :  sc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														draw_line ( Point2 ( get_name_limit ( )  +  i ,  0 ) ,  Point2 ( get_name_limit ( )  +  i ,  h ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														draw_string ( font ,  Point2 ( get_name_limit ( )  +  i  +  3 ,  ( h  -  font - > get_height ( font_size ) )  /  2  +  font - > get_ascent ( font_size ) ) . floor ( ) ,  String : : num ( ( scd  -  ( scd  %  step ) )  /  double ( SC_ADJ ) ,  decimals ) ,  HORIZONTAL_ALIGNMENT_LEFT ,  zoomw  -  i ,  font_size ,  sub  ?  color_time_dec  :  color_time_sec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											draw_line ( Vector2 ( 0 ,  get_size ( ) . height ) ,  get_size ( ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-17 12:24:48 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											update_values ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : set_animation ( const  Ref < Animation >  & p_animation ,  bool  p_read_only )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									animation  =  p_animation ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									read_only  =  p_read_only ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 15:13:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									length - > set_read_only ( read_only ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									if  ( animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										len_hb - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( read_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_track - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-01 16:10:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										play_position - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										len_hb - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										add_track - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-01 16:10:20 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										play_position - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Size2  AnimationTimelineEdit : : get_minimum_size ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Size2  ms  =  add_track - > get_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Font >  font  =  get_theme_font ( SNAME ( " font " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  get_theme_font_size ( SNAME ( " font_size " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-03 14:22:16 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ms . height  =  MAX ( ms . height ,  font - > get_height ( font_size ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ms . width  =  get_buttons_width ( )  +  add_track - > get_minimum_size ( ) . width  +  get_editor_theme_icon ( SNAME ( " Hsize " ) ) - > get_width ( )  +  2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									return  ms ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : set_zoom ( Range  * p_zoom )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									zoom  =  p_zoom ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									zoom - > connect ( " value_changed " ,  callable_mp ( this ,  & AnimationTimelineEdit : : _zoom_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : set_track_edit ( AnimationTrackEdit  * p_track_edit )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									track_edit  =  p_track_edit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : set_play_position ( float  p_pos )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									play_position_pos  =  p_pos ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									play_position - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								float  AnimationTimelineEdit : : get_play_position ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  play_position_pos ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : update_play_position ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									play_position - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : update_values ( )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! animation . is_valid ( )  | |  editing )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									editing  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 23:48:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( use_fps  & &  animation - > get_step ( )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										length - > set_value ( animation - > get_length ( )  /  animation - > get_step ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-15 13:33:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										length - > set_step ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										length - > set_tooltip_text ( TTR ( " Animation length (frames) " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										time_icon - > set_tooltip_text ( TTR ( " Animation length (frames) " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-30 00:27:56 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( track_edit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											track_edit - > editor - > _update_key_edit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 23:48:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										length - > set_value ( animation - > get_length ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										length - > set_step ( 0.0001 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										length - > set_tooltip_text ( TTR ( " Animation length (seconds) " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										time_icon - > set_tooltip_text ( TTR ( " Animation length (seconds) " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 23:48:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 22:25:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( animation - > get_loop_mode ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-05 03:53:48 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : LOOP_NONE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											loop - > set_icon ( get_editor_theme_icon ( SNAME ( " Loop " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 22:25:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											loop - > set_pressed ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-05 03:53:48 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : LOOP_LINEAR :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											loop - > set_icon ( get_editor_theme_icon ( SNAME ( " Loop " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 22:25:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											loop - > set_pressed ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-05 03:53:48 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : LOOP_PINGPONG :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											loop - > set_icon ( get_editor_theme_icon ( SNAME ( " PingPongLoop " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 22:25:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											loop - > set_pressed ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									editing  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : _play_position_draw ( )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! animation . is_valid ( )  | |  play_position_pos  <  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  scale  =  get_zoom_scale ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  h  =  play_position - > get_size ( ) . height ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  px  =  ( - get_value ( )  +  play_position_pos )  *  scale  +  get_name_limit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( px  > =  get_name_limit ( )  & &  px  <  ( play_position - > get_size ( ) . width  -  get_buttons_width ( ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Color  color  =  get_theme_color ( SNAME ( " accent_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-17 00:09:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										play_position - > draw_line ( Point2 ( px ,  0 ) ,  Point2 ( px ,  h ) ,  color ,  Math : : round ( 2  *  EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										play_position - > draw_texture ( 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												get_editor_theme_icon ( SNAME ( " TimelineIndicator " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Point2 ( px  -  get_editor_theme_icon ( SNAME ( " TimelineIndicator " ) ) - > get_width ( )  *  0.5 ,  0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-17 00:09:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-22 12:37:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : gui_input ( const  Ref < InputEvent >  & p_event )  {  
						 
					
						
							
								
									
										
										
										
											2021-04-05 08:52:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND ( p_event . is_null ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( panner - > gui_input ( p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										accept_event ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Ref < InputEventMouseButton >  mb  =  p_event ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  mb - > is_pressed ( )  & &  mb - > is_alt_pressed ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : WHEEL_UP )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( track_edit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											track_edit - > get_editor ( ) - > goto_prev_step ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										accept_event ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  mb - > is_pressed ( )  & &  mb - > is_alt_pressed ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : WHEEL_DOWN )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( track_edit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											track_edit - > get_editor ( ) - > goto_next_step ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										accept_event ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  mb - > is_pressed ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : LEFT  & &  hsize_rect . has_point ( mb - > get_position ( ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										dragging_hsize  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dragging_hsize_from  =  mb - > get_position ( ) . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dragging_hsize_at  =  name_limit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  ! mb - > is_pressed ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : LEFT  & &  dragging_hsize )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										dragging_hsize  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  mb - > get_position ( ) . x  >  get_name_limit ( )  & &  mb - > get_position ( ) . x  <  ( get_size ( ) . width  -  get_buttons_width ( ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! panner - > is_panning ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : LEFT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											int  x  =  mb - > get_position ( ) . x  -  get_name_limit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 17:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											float  ofs  =  x  /  get_zoom_scale ( )  +  get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-23 13:49:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( SNAME ( " timeline_changed " ) ,  ofs ,  false ,  mb - > is_alt_pressed ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											dragging_timeline  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( dragging_timeline  & &  mb . is_valid ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : LEFT  & &  ! mb - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										dragging_timeline  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < InputEventMouseMotion >  mm  =  p_event ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( mm . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( dragging_hsize )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  ofs  =  mm - > get_position ( ) . x  -  dragging_hsize_from ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											name_limit  =  dragging_hsize_at  +  ofs ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( SNAME ( " name_limit_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											play_position - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( dragging_timeline )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  x  =  mm - > get_position ( ) . x  -  get_name_limit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 17:58:05 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											float  ofs  =  x  /  get_zoom_scale ( )  +  get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( SNAME ( " timeline_changed " ) ,  ofs ,  false ,  mm - > is_alt_pressed ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 10:18:27 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Control : : CursorShape  AnimationTimelineEdit : : get_cursor_shape ( const  Point2  & p_pos )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( dragging_hsize  | |  hsize_rect . has_point ( p_pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Indicate that the track name column's width can be adjusted
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  Control : : CURSOR_HSIZE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  get_default_cursor_shape ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-19 17:50:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : _pan_callback ( Vector2  p_scroll_vec ,  Ref < InputEvent >  p_event )  {  
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_value ( get_value ( )  -  p_scroll_vec . x  /  get_zoom_scale ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-19 17:50:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : _zoom_callback ( float  p_zoom_factor ,  Vector2  p_origin ,  Ref < InputEvent >  p_event )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-12 23:31:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									double  current_zoom_value  =  get_zoom ( ) - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-19 17:50:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									get_zoom ( ) - > set_value ( MAX ( 0.01 ,  current_zoom_value  *  p_zoom_factor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : set_use_fps ( bool  p_use_fps )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									use_fps  =  p_use_fps ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  AnimationTimelineEdit : : is_using_fps ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  use_fps ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : set_hscroll ( HScrollBar  * p_hscroll )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hscroll  =  p_hscroll ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : _track_added ( int  p_track )  {  
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " track_added " ) ,  p_track ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTimelineEdit : : _bind_methods ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " zoom_changed " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " name_limit_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-23 13:49:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " timeline_changed " ,  PropertyInfo ( Variant : : FLOAT ,  " position " ) ,  PropertyInfo ( Variant : : BOOL ,  " drag " ) ,  PropertyInfo ( Variant : : BOOL ,  " timeline_only " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " track_added " ,  PropertyInfo ( Variant : : INT ,  " track " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " length_changed " ,  PropertyInfo ( Variant : : FLOAT ,  " size " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-16 16:19:53 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " update_values " ) ,  & AnimationTimelineEdit : : update_values ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AnimationTimelineEdit : : AnimationTimelineEdit ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-08-23 23:00:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									name_limit  =  150  *  EDSCALE ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									play_position  =  memnew ( Control ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									play_position - > set_mouse_filter ( MOUSE_FILTER_PASS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( play_position ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-18 19:02:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									play_position - > set_anchors_and_offsets_preset ( PRESET_FULL_RECT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									play_position - > connect ( " draw " ,  callable_mp ( this ,  & AnimationTimelineEdit : : _play_position_draw ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_track  =  memnew ( MenuButton ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_track - > set_position ( Vector2 ( 0 ,  0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( add_track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_track - > set_text ( TTR ( " Add Track " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									len_hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Control  * expander  =  memnew ( Control ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									expander - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									len_hb - > add_child ( expander ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									time_icon  =  memnew ( TextureRect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									time_icon - > set_v_size_flags ( SIZE_SHRINK_CENTER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									time_icon - > set_tooltip_text ( TTR ( " Animation length (seconds) " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									len_hb - > add_child ( time_icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									length  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									length - > set_min ( 0.0001 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 23:48:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									length - > set_max ( 36000 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									length - > set_step ( 0.0001 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									length - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									length - > set_custom_minimum_size ( Vector2 ( 70  *  EDSCALE ,  0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									length - > set_hide_slider ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									length - > set_tooltip_text ( TTR ( " Animation length (seconds) " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									length - > connect ( " value_changed " ,  callable_mp ( this ,  & AnimationTimelineEdit : : _anim_length_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									len_hb - > add_child ( length ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 20:49:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									loop  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									loop - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									loop - > set_tooltip_text ( TTR ( " Animation Looping " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									loop - > connect ( " pressed " ,  callable_mp ( this ,  & AnimationTimelineEdit : : _anim_loop_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									loop - > set_toggle_mode ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									len_hb - > add_child ( loop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( len_hb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_track - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									add_track - > get_popup ( ) - > connect ( " index_pressed " ,  callable_mp ( this ,  & AnimationTimelineEdit : : _track_added ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									len_hb - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									panner . instantiate ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-19 17:50:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									panner - > set_callbacks ( callable_mp ( this ,  & AnimationTimelineEdit : : _pan_callback ) ,  callable_mp ( this ,  & AnimationTimelineEdit : : _zoom_callback ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									panner - > set_pan_axis ( ViewPanner : : PAN_AXIS_HORIZONTAL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-03 14:22:16 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_layout_direction ( Control : : LAYOUT_DIRECTION_LTR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								////////////////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 13:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( animation . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_FAIL_INDEX ( track ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											type_icon  =  _get_key_type_icon ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											selected_icon  =  get_editor_theme_icon ( SNAME ( " KeySelected " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 13:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_DRAW :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( animation . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ERR_FAIL_INDEX ( track ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  limit  =  timeline - > get_name_limit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 21:55:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( track  %  2  = =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Draw a background over odd lines to make long lists of tracks easier to read.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												draw_rect ( Rect2 ( Point2 ( 1  *  EDSCALE ,  0 ) ,  get_size ( )  -  Size2 ( 1  *  EDSCALE ,  0 ) ) ,  Color ( 0.5 ,  0.5 ,  0.5 ,  0.05 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( hovered )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Draw hover feedback.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												draw_rect ( Rect2 ( Point2 ( 1  *  EDSCALE ,  0 ) ,  get_size ( )  -  Size2 ( 1  *  EDSCALE ,  0 ) ) ,  Color ( 0.5 ,  0.5 ,  0.5 ,  0.1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( has_focus ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Color  accent  =  get_theme_color ( SNAME ( " accent_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												accent . a  * =  0.7 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Offside so the horizontal sides aren't cutoff.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												draw_style_box ( get_theme_stylebox ( SNAME ( " Focus " ) ,  EditorStringName ( EditorStyles ) ) ,  Rect2 ( Point2 ( 1  *  EDSCALE ,  0 ) ,  get_size ( )  -  Size2 ( 1  *  EDSCALE ,  0 ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Ref < Font >  font  =  get_theme_font ( SNAME ( " font " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  font_size  =  get_theme_font_size ( SNAME ( " font_size " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Color  color  =  get_theme_color ( SNAME ( " font_color " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:20:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  hsep  =  get_theme_constant ( SNAME ( " h_separation " ) ,  SNAME ( " ItemList " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  linecolor  =  color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											linecolor . a  =  0.2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  dc  =  get_theme_color ( SNAME ( " disabled_font_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// NAMES AND ICONS //
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Ref < Texture2D >  check  =  animation - > track_is_enabled ( track )  ?  get_theme_icon ( SNAME ( " checked " ) ,  SNAME ( " CheckBox " ) )  :  get_theme_icon ( SNAME ( " unchecked " ) ,  SNAME ( " CheckBox " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												int  ofs  =  in_group  ?  check - > get_width ( )  :  0 ;  // Not the best reference for margin but..
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												check_rect  =  Rect2 ( Point2 ( ofs ,  int ( get_size ( ) . height  -  check - > get_height ( ) )  /  2 ) ,  check - > get_size ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												draw_texture ( check ,  check_rect . position ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ofs  + =  check - > get_width ( )  +  hsep ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Ref < Texture2D >  key_type_icon  =  _get_key_type_icon ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												draw_texture ( key_type_icon ,  Point2 ( ofs ,  int ( get_size ( ) . height  -  key_type_icon - > get_height ( ) )  /  2 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ofs  + =  key_type_icon - > get_width ( )  +  hsep ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												NodePath  anim_path  =  animation - > track_get_path ( track ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Node  * node  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( root  & &  root - > has_node ( anim_path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													node  =  root - > get_node ( anim_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												String  text ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Color  text_color  =  color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( node  & &  EditorNode : : get_singleton ( ) - > get_editor_selection ( ) - > is_selected ( node ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text_color  =  get_theme_color ( SNAME ( " accent_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( in_group )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_METHOD )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														text  =  TTR ( " Functions: " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_AUDIO )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														text  =  TTR ( " Audio Clips: " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_ANIMATION )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														text  =  TTR ( " Animation Clips: " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														text  + =  anim_path . get_concatenated_subnames ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													text_color . a  * =  0.7 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  if  ( node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Ref < Texture2D >  icon  =  EditorNode : : get_singleton ( ) - > get_object_icon ( node ,  " Node " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													draw_texture ( icon ,  Point2 ( ofs ,  int ( get_size ( ) . height  -  icon - > get_height ( ) )  /  2 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													icon_cache  =  icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-30 10:29:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  =  String ( )  +  node - > get_name ( )  +  " : "  +  anim_path . get_concatenated_subnames ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ofs  + =  hsep ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ofs  + =  icon - > get_width ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													icon_cache  =  key_type_icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  =  anim_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												path_cache  =  text ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												path_rect  =  Rect2 ( ofs ,  0 ,  limit  -  ofs  -  hsep ,  get_size ( ) . height ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Vector2  string_pos  =  Point2 ( ofs ,  ( get_size ( ) . height  -  font - > get_height ( font_size ) )  /  2  +  font - > get_ascent ( font_size ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												string_pos  =  string_pos . floor ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												draw_string ( font ,  string_pos ,  text ,  HORIZONTAL_ALIGNMENT_LEFT ,  limit  -  ofs  -  hsep ,  font_size ,  text_color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												draw_line ( Point2 ( limit ,  0 ) ,  Point2 ( limit ,  get_size ( ) . height ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// KEYFRAMES //
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											draw_bg ( limit ,  get_size ( ) . width  -  timeline - > get_buttons_width ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  scale  =  timeline - > get_zoom_scale ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  limit_end  =  get_size ( ) . width  -  timeline - > get_buttons_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  animation - > track_get_key_count ( track ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  offset  =  animation - > track_get_key_time ( track ,  i )  -  timeline - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( editor - > is_key_selected ( track ,  i )  & &  editor - > is_moving_selection ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														offset  =  editor - > snap_time ( offset  +  editor - > get_moving_selection_offset ( ) ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													offset  =  offset  *  scale  +  limit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( i  <  animation - > track_get_key_count ( track )  -  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														float  offset_n  =  animation - > track_get_key_time ( track ,  i  +  1 )  -  timeline - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( editor - > is_key_selected ( track ,  i  +  1 )  & &  editor - > is_moving_selection ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															offset_n  =  editor - > snap_time ( offset_n  +  editor - > get_moving_selection_offset ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														offset_n  =  offset_n  *  scale  +  limit ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														draw_key_link ( i ,  scale ,  int ( offset ) ,  int ( offset_n ) ,  limit ,  limit_end ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													draw_key ( i ,  scale ,  int ( offset ) ,  editor - > is_key_selected ( track ,  i ) ,  limit ,  limit_end ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											draw_fg ( limit ,  get_size ( ) . width  -  timeline - > get_buttons_width ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// BUTTONS //
 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Ref < Texture2D >  wrap_icon [ 2 ]  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " InterpWrapClamp " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " InterpWrapLoop " ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-26 11:42:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Ref < Texture2D >  interp_icon [ 5 ]  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " InterpRaw " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " InterpLinear " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " InterpCubic " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " InterpLinearAngle " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " InterpCubicAngle " ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-29 18:51:45 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Ref < Texture2D >  cont_icon [ 3 ]  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " TrackContinuous " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " TrackDiscrete " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " TrackCapture " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Ref < Texture2D >  blend_icon [ 2 ]  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " UseBlendEnable " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													get_editor_theme_icon ( SNAME ( " UseBlendDisable " ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												int  ofs  =  get_size ( ) . width  -  timeline - > get_buttons_width ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Ref < Texture2D >  down_icon  =  get_theme_icon ( SNAME ( " select_arrow " ) ,  SNAME ( " Tree " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												draw_line ( Point2 ( ofs ,  0 ) ,  Point2 ( ofs ,  get_size ( ) . height ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ofs  + =  hsep ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Callmode.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Animation : : UpdateMode  update_mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_mode  =  animation - > value_track_get_update_mode ( track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_mode  =  Animation : : UPDATE_CONTINUOUS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Ref < Texture2D >  update_icon  =  cont_icon [ update_mode ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													update_mode_rect . position . x  =  ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													update_mode_rect . position . y  =  int ( get_size ( ) . height  -  update_icon - > get_height ( ) )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													update_mode_rect . size  =  update_icon - > get_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ! animation - > track_is_compressed ( track )  & &  animation - > track_get_type ( track )  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														draw_texture ( update_icon ,  update_mode_rect . position ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_AUDIO )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Ref < Texture2D >  use_blend_icon  =  blend_icon [ animation - > audio_track_is_use_blend ( track )  ?  0  :  1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Vector2  use_blend_icon_pos  =  update_mode_rect . position  +  ( update_mode_rect . size  -  use_blend_icon - > get_size ( ) )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														draw_texture ( use_blend_icon ,  use_blend_icon_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													// Make it easier to click.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													update_mode_rect . position . y  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													update_mode_rect . size . y  =  get_size ( ) . height ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ofs  + =  update_icon - > get_width ( )  +  hsep  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													update_mode_rect . size . x  + =  hsep  /  2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ! read_only )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_VALUE  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_AUDIO )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															draw_texture ( down_icon ,  Vector2 ( ofs ,  int ( get_size ( ) . height  -  down_icon - > get_height ( ) )  /  2 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															update_mode_rect . size . x  + =  down_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_BEZIER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															update_mode_rect . size . x  + =  down_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															update_mode_rect  =  Rect2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															update_mode_rect  =  Rect2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														update_mode_rect  =  Rect2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ofs  + =  down_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													draw_line ( Point2 ( ofs  +  hsep  *  0.5 ,  0 ) ,  Point2 ( ofs  +  hsep  *  0.5 ,  get_size ( ) . height ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ofs  + =  hsep ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Interp.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Animation : : InterpolationType  interp_mode  =  animation - > track_get_interpolation_type ( track ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Ref < Texture2D >  icon  =  interp_icon [ interp_mode ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													interp_mode_rect . position . x  =  ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													interp_mode_rect . position . y  =  int ( get_size ( ) . height  -  icon - > get_height ( ) )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													interp_mode_rect . size  =  icon - > get_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ! animation - > track_is_compressed ( track )  & &  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_VALUE  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_BLEND_SHAPE  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_POSITION_3D  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_SCALE_3D  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_ROTATION_3D ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														draw_texture ( icon ,  interp_mode_rect . position ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Make it easier to click.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													interp_mode_rect . position . y  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													interp_mode_rect . size . y  =  get_size ( ) . height ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ofs  + =  icon - > get_width ( )  +  hsep  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													interp_mode_rect . size . x  + =  hsep  /  2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ! read_only  & &  ! animation - > track_is_compressed ( track )  & &  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_VALUE  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_BLEND_SHAPE  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_POSITION_3D  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_SCALE_3D  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_ROTATION_3D ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														draw_texture ( down_icon ,  Vector2 ( ofs ,  int ( get_size ( ) . height  -  down_icon - > get_height ( ) )  /  2 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														interp_mode_rect . size . x  + =  down_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														interp_mode_rect  =  Rect2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ofs  + =  down_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													draw_line ( Point2 ( ofs  +  hsep  *  0.5 ,  0 ) ,  Point2 ( ofs  +  hsep  *  0.5 ,  get_size ( ) . height ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ofs  + =  hsep ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Loop.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													bool  loop_wrap  =  animation - > track_get_interpolation_loop_wrap ( track ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Ref < Texture2D >  icon  =  wrap_icon [ loop_wrap  ?  1  :  0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													loop_wrap_rect . position . x  =  ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													loop_wrap_rect . position . y  =  int ( get_size ( ) . height  -  icon - > get_height ( ) )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													loop_wrap_rect . size  =  icon - > get_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ! animation - > track_is_compressed ( track )  & &  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_VALUE  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_BLEND_SHAPE  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_POSITION_3D  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_SCALE_3D  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_ROTATION_3D ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														draw_texture ( icon ,  loop_wrap_rect . position ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													loop_wrap_rect . position . y  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													loop_wrap_rect . size . y  =  get_size ( ) . height ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ofs  + =  icon - > get_width ( )  +  hsep  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													loop_wrap_rect . size . x  + =  hsep  /  2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ! read_only  & &  ! animation - > track_is_compressed ( track )  & &  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_VALUE  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_BLEND_SHAPE  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_POSITION_3D  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_SCALE_3D  | |  animation - > track_get_type ( track )  = =  Animation : : TYPE_ROTATION_3D ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														draw_texture ( down_icon ,  Vector2 ( ofs ,  int ( get_size ( ) . height  -  down_icon - > get_height ( ) )  /  2 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														loop_wrap_rect . size . x  + =  down_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														loop_wrap_rect  =  Rect2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ofs  + =  down_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													draw_line ( Point2 ( ofs  +  hsep  *  0.5 ,  0 ) ,  Point2 ( ofs  +  hsep  *  0.5 ,  get_size ( ) . height ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ofs  + =  hsep ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Erase.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Ref < Texture2D >  icon  =  get_editor_theme_icon ( animation - > track_is_compressed ( track )  ?  SNAME ( " Lock " )  :  SNAME ( " Remove " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													remove_rect . position . x  =  ofs  +  ( ( get_size ( ) . width  -  ofs )  -  icon - > get_width ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													remove_rect . position . y  =  int ( get_size ( ) . height  -  icon - > get_height ( ) )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													remove_rect . size  =  icon - > get_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( read_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														draw_texture ( icon ,  remove_rect . position ,  dc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														draw_texture ( icon ,  remove_rect . position ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( in_group )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												draw_line ( Vector2 ( timeline - > get_name_limit ( ) ,  get_size ( ) . height ) ,  get_size ( ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												draw_line ( Vector2 ( 0 ,  get_size ( ) . height ) ,  get_size ( ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( dropping_at  ! =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Color  drop_color  =  get_theme_color ( SNAME ( " accent_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( dropping_at  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													draw_line ( Vector2 ( 0 ,  0 ) ,  Vector2 ( get_size ( ) . width ,  0 ) ,  drop_color ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													draw_line ( Vector2 ( 0 ,  get_size ( ) . height ) ,  get_size ( ) ,  drop_color ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 21:55:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_MOUSE_ENTER : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											hovered  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 21:55:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_MOUSE_EXIT : 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 21:55:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											hovered  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 22:59:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// When the mouse cursor exits the track, we're no longer hovering any keyframe.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											hovering_key_idx  =  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 21:55:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											[[fallthrough]] ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_DRAG_END :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cancel_drop ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  AnimationTrackEdit : : get_key_height ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  type_icon - > get_height ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Rect2  AnimationTrackEdit : : get_key_rect ( int  p_index ,  float  p_pixels_sec )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  Rect2 ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Rect2  rect  =  Rect2 ( - type_icon - > get_width ( )  /  2 ,  0 ,  type_icon - > get_width ( ) ,  get_size ( ) . height ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Make it a big easier to click.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									rect . position . x  - =  rect . size . x  *  0.5 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rect . size . x  * =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  AnimationTrackEdit : : is_key_selectable_by_distance ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : draw_key_link ( int  p_index ,  float  p_pixels_sec ,  int  p_x ,  int  p_next_x ,  int  p_clip_left ,  int  p_clip_right )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_next_x  <  p_clip_left )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_x  >  p_clip_right )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Variant  current  =  animation - > track_get_key_value ( get_track ( ) ,  p_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Variant  next  =  animation - > track_get_key_value ( get_track ( ) ,  p_index  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 14:43:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( current  ! =  next  | |  animation - > track_get_type ( get_track ( ) )  = =  Animation : : TrackType : : TYPE_METHOD )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Color  color  =  get_theme_color ( SNAME ( " font_color " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									color . a  =  0.5 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  from_x  =  MAX ( p_x ,  p_clip_left ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  to_x  =  MIN ( p_next_x ,  p_clip_right ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-15 14:11:13 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									draw_line ( Point2 ( from_x  +  1 ,  get_size ( ) . height  /  2 ) ,  Point2 ( to_x ,  get_size ( ) . height  /  2 ) ,  color ,  Math : : round ( 2  *  EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : draw_key ( int  p_index ,  float  p_pixels_sec ,  int  p_x ,  bool  p_selected ,  int  p_clip_left ,  int  p_clip_right )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_x  <  p_clip_left  | |  p_x  >  p_clip_right )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-11 15:43:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Texture2D >  icon_to_draw  =  p_selected  ?  selected_icon  :  type_icon ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-13 20:07:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_VALUE  & &  ! Math : : is_equal_approx ( animation - > track_get_key_transition ( track ,  p_index ) ,  real_t ( 1.0 ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Use a different icon for keys with non-linear easing.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										icon_to_draw  =  get_editor_theme_icon ( p_selected  ?  SNAME ( " KeyEasedSelected " )  :  SNAME ( " KeyValueEased " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-13 20:07:19 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Override type icon for invalid value keys, unless selected.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! p_selected  & &  animation - > track_get_type ( track )  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  Variant  & v  =  animation - > track_get_key_value ( track ,  p_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Variant : : Type  valid_type  =  Variant : : NIL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! _is_value_key_valid ( v ,  valid_type ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											icon_to_draw  =  get_editor_theme_icon ( SNAME ( " KeyInvalid " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector2  ofs ( p_x  -  icon_to_draw - > get_width ( )  /  2 ,  int ( get_size ( ) . height  -  icon_to_draw - > get_height ( ) )  /  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_METHOD )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Ref < Font >  font  =  get_theme_font ( SNAME ( " font " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  font_size  =  get_theme_font_size ( SNAME ( " font_size " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Color  color  =  get_theme_color ( SNAME ( " font_color " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										color . a  =  0.5 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Dictionary  d  =  animation - > track_get_key_value ( track ,  p_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  text ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( d . has ( " method " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											text  + =  String ( d [ " method " ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										text  + =  " ( " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Vector < Variant >  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( d . has ( " args " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											args  =  d [ " args " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  args . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( i  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												text  + =  " ,  " ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-08 09:47:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											text  + =  args [ i ] . get_construct_string ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										text  + =  " ) " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  limit  =  MAX ( 0 ,  p_clip_right  -  p_x  -  icon_to_draw - > get_width ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  ( limit  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											draw_string ( font ,  Vector2 ( p_x  +  icon_to_draw - > get_width ( ) ,  int ( get_size ( ) . height  -  font - > get_height ( font_size ) )  /  2  +  font - > get_ascent ( font_size ) ) ,  text ,  HORIZONTAL_ALIGNMENT_LEFT ,  limit ,  font_size ,  color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 22:59:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Use a different color for the currently hovered key.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// The color multiplier is chosen to work with both dark and light editor themes,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// and on both unselected and selected key icons.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									draw_texture ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											icon_to_draw , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ofs , 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-06 20:09:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											p_index  = =  hovering_key_idx  ?  get_theme_color ( SNAME ( " folder_icon_color " ) ,  SNAME ( " FileDialog " ) )  :  Color ( 1 ,  1 ,  1 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Helper.
  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : draw_rect_clipped ( const  Rect2  & p_rect ,  const  Color  & p_color ,  bool  p_filled )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  clip_left  =  timeline - > get_name_limit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  clip_right  =  get_size ( ) . width  -  timeline - > get_buttons_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_rect . position . x  >  clip_right )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_rect . position . x  +  p_rect . size . x  <  clip_left )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Rect2  clip  =  Rect2 ( clip_left ,  0 ,  clip_right  -  clip_left ,  get_size ( ) . height ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-19 12:43:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									draw_rect ( clip . intersection ( p_rect ) ,  p_color ,  p_filled ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : draw_bg ( int  p_clip_left ,  int  p_clip_right )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : draw_fg ( int  p_clip_left ,  int  p_clip_right )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-11 15:43:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : draw_texture_region_clipped ( const  Ref < Texture2D >  & p_texture ,  const  Rect2  & p_rect ,  const  Rect2  & p_region )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									int  clip_left  =  timeline - > get_name_limit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  clip_right  =  get_size ( ) . width  -  timeline - > get_buttons_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Clip left and right.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( clip_left  >  p_rect . position . x  +  p_rect . size . x )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( clip_right  <  p_rect . position . x )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Rect2  rect  =  p_rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Rect2  region  =  p_region ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( clip_left  >  rect . position . x )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  rect_pixels  =  ( clip_left  -  rect . position . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  region_pixels  =  rect_pixels  *  region . size . x  /  rect . size . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rect . position . x  + =  rect_pixels ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rect . size . x  - =  rect_pixels ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										region . position . x  + =  region_pixels ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										region . size . x  - =  region_pixels ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( clip_right  <  rect . position . x  +  rect . size . x )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  rect_pixels  =  rect . position . x  +  rect . size . x  -  clip_right ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  region_pixels  =  rect_pixels  *  region . size . x  /  rect . size . x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rect . size . x  - =  rect_pixels ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										region . size . x  - =  region_pixels ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									draw_texture_rect_region ( p_texture ,  rect ,  region ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  AnimationTrackEdit : : get_track ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Ref < Animation >  AnimationTrackEdit : : get_animation ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  animation ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : set_animation_and_track ( const  Ref < Animation >  & p_animation ,  int  p_track ,  bool  p_read_only )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									animation  =  p_animation ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									read_only  =  p_read_only ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									track  =  p_track ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_INDEX ( track ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									node_path  =  animation - > track_get_path ( p_track ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 13:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									type_icon  =  _get_key_type_icon ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									selected_icon  =  get_editor_theme_icon ( SNAME ( " KeySelected " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								NodePath  AnimationTrackEdit : : get_path ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  node_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Size2  AnimationTrackEdit : : get_minimum_size ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Texture2D >  texture  =  get_editor_theme_icon ( SNAME ( " Object " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Font >  font  =  get_theme_font ( SNAME ( " font " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  get_theme_font_size ( SNAME ( " font_size " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:20:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  separation  =  get_theme_constant ( SNAME ( " v_separation " ) ,  SNAME ( " ItemList " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-03 14:22:16 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  max_h  =  MAX ( texture - > get_height ( ) ,  font - > get_height ( font_size ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									max_h  =  MAX ( max_h ,  get_key_height ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  Vector2 ( 1 ,  max_h  +  separation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : set_timeline ( AnimationTimelineEdit  * p_timeline )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline  =  p_timeline ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									timeline - > set_track_edit ( this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									timeline - > connect ( " zoom_changed " ,  callable_mp ( this ,  & AnimationTrackEdit : : _zoom_changed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > connect ( " name_limit_changed " ,  callable_mp ( this ,  & AnimationTrackEdit : : _zoom_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : set_editor ( AnimationTrackEditor  * p_editor )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									editor  =  p_editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : _play_position_draw ( )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! animation . is_valid ( )  | |  play_position_pos  <  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  scale  =  timeline - > get_zoom_scale ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  h  =  get_size ( ) . height ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  px  =  ( - timeline - > get_value ( )  +  play_position_pos )  *  scale  +  timeline - > get_name_limit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( px  > =  timeline - > get_name_limit ( )  & &  px  <  ( get_size ( ) . width  -  timeline - > get_buttons_width ( ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Color  color  =  get_theme_color ( SNAME ( " accent_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-17 00:09:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										play_position - > draw_line ( Point2 ( px ,  0 ) ,  Point2 ( px ,  h ) ,  color ,  Math : : round ( 2  *  EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : set_play_position ( float  p_pos )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									play_position_pos  =  p_pos ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									play_position - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : update_play_position ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									play_position - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : set_root ( Node  * p_root )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									root  =  p_root ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-09-04 02:20:57 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : _zoom_changed ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									play_position - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-16 09:43:34 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : _path_submitted ( const  String  & p_text )  {  
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > create_action ( TTR ( " Change Track Path " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_path " ,  track ,  p_text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_path " ,  track ,  animation - > track_get_path ( track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-19 23:32:09 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									path_popup - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  AnimationTrackEdit : : _is_value_key_valid ( const  Variant  & p_key_value ,  Variant : : Type  & r_valid_type )  const  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( root  = =  nullptr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-26 14:50:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-26 14:50:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Resource >  res ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Vector < StringName >  leftover_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * node  =  root - > get_node_and_resource ( animation - > track_get_path ( track ) ,  res ,  leftover_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Object  * obj  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( res . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										obj  =  res . ptr ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										obj  =  node ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  prop_exists  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( obj )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										r_valid_type  =  obj - > get_static_property_type_indexed ( leftover_path ,  & prop_exists ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ( ! prop_exists  | |  Variant : : can_convert ( p_key_value . get_type ( ) ,  r_valid_type ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 13:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Ref < Texture2D >  AnimationTrackEdit : : _get_key_type_icon ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2022-04-07 13:23:40 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Ref < Texture2D >  type_icons [ 9 ]  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										get_editor_theme_icon ( SNAME ( " KeyValue " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_editor_theme_icon ( SNAME ( " KeyTrackPosition " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_editor_theme_icon ( SNAME ( " KeyTrackRotation " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_editor_theme_icon ( SNAME ( " KeyTrackScale " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_editor_theme_icon ( SNAME ( " KeyTrackBlendShape " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_editor_theme_icon ( SNAME ( " KeyCall " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_editor_theme_icon ( SNAME ( " KeyBezier " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_editor_theme_icon ( SNAME ( " KeyAudio " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										get_editor_theme_icon ( SNAME ( " KeyAnimation " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-10 13:46:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  type_icons [ animation - > track_get_type ( track ) ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								String  AnimationTrackEdit : : get_tooltip ( const  Point2  & p_pos )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( check_rect . has_point ( p_pos ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 15:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  TTR ( " Toggle this track on/off. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-21 22:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Don't overlap track keys if they start at 0.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( path_rect . has_point ( p_pos  +  Size2 ( type_icon - > get_width ( ) ,  0 ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  animation - > track_get_path ( track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( update_mode_rect . has_point ( p_pos ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_AUDIO )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  TTR ( " Use Blend " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  TTR ( " Update Mode (How this property is set) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( interp_mode_rect . has_point ( p_pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  TTR ( " Interpolation Mode " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 22:25:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( loop_wrap_rect . has_point ( p_pos ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 15:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  TTR ( " Loop Wrap Mode (Interpolate end with beginning on loop) " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( remove_rect . has_point ( p_pos ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 15:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  TTR ( " Remove this track. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-21 22:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  limit  =  timeline - > get_name_limit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  limit_end  =  get_size ( ) . width  -  timeline - > get_buttons_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Left Border including space occupied by keyframes on t=0.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  limit_start_hitbox  =  limit  -  type_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_pos . x  > =  limit_start_hitbox  & &  p_pos . x  < =  limit_end )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										int  key_idx  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  key_distance  =  1e20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-21 22:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Select should happen in the opposite order of drawing for more accurate overlap select.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  animation - > track_get_key_count ( track )  -  1 ;  i  > =  0 ;  i - - )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											Rect2  rect  =  const_cast < AnimationTrackEdit  * > ( this ) - > get_key_rect ( i ,  timeline - > get_zoom_scale ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  offset  =  animation - > track_get_key_time ( track ,  i )  -  timeline - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-21 22:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											offset  =  offset  *  timeline - > get_zoom_scale ( )  +  limit ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											rect . position . x  + =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( rect . has_point ( p_pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( const_cast < AnimationTrackEdit  * > ( this ) - > is_key_selectable_by_distance ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  distance  =  ABS ( offset  -  p_pos . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( key_idx  = =  - 1  | |  distance  <  key_distance )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														key_idx  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														key_distance  =  distance ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													// First one does it.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( key_idx  ! =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											String  text  =  TTR ( " Time (s): " )  +  "   "  +  TS - > format_number ( rtos ( Math : : snapped ( animation - > track_get_key_time ( track ,  key_idx ) ,  0.0001 ) ) )  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											switch  ( animation - > track_get_type ( track ) )  { 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												case  Animation : : TYPE_POSITION_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Vector3  t  =  animation - > track_get_key_value ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Position: " )  +  "   "  +  String ( t )  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_ROTATION_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Quaternion  t  =  animation - > track_get_key_value ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Rotation: " )  +  "   "  +  String ( t )  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_SCALE_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Vector3  t  =  animation - > track_get_key_value ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Scale: " )  +  "   "  +  String ( t )  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 19:04:35 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												case  Animation : : TYPE_BLEND_SHAPE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  t  =  animation - > track_get_key_value ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Blend Shape: " )  +  "   "  +  itos ( t )  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 19:04:35 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													const  Variant  & v  =  animation - > track_get_key_value ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Type: " )  +  "   "  +  Variant : : get_type_name ( v . get_type ( ) )  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Variant : : Type  valid_type  =  Variant : : NIL ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Value: " )  +  "   "  +  String ( v ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-23 19:52:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ! _is_value_key_valid ( v ,  valid_type ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														text  + =  "   "  +  vformat ( TTR ( " (Invalid, expected type: %s) " ) ,  Variant : : get_type_name ( valid_type ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  " \n "  +  TTR ( " Easing: " )  +  "   "  +  rtos ( animation - > track_get_key_transition ( track ,  key_idx ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_METHOD :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Dictionary  d  =  animation - > track_get_key_value ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( d . has ( " method " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														text  + =  String ( d [ " method " ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													text  + =  " ( " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Vector < Variant >  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( d . has ( " args " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														args  =  d [ " args " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													for  ( int  i  =  0 ;  i  <  args . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( i  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
															text  + =  " ,  " ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-08 09:47:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														text  + =  args [ i ] . get_construct_string ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													text  + =  " ) \n " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_BEZIER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  h  =  animation - > bezier_track_get_key_value ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Value: " )  +  "   "  +  rtos ( h )  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													Vector2  ih  =  animation - > bezier_track_get_key_in_handle ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " In-Handle: " )  +  "   "  +  ih  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													Vector2  oh  =  animation - > bezier_track_get_key_out_handle ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Out-Handle: " )  +  "   "  +  oh  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-03 10:02:53 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													int  hm  =  animation - > bezier_track_get_key_handle_mode ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													switch  ( hm )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														case  Animation : : HANDLE_MODE_FREE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															text  + =  TTR ( " Handle mode: Free \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-03 10:02:53 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 19:45:30 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														case  Animation : : HANDLE_MODE_LINEAR :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															text  + =  TTR ( " Handle mode: Linear \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-03 10:02:53 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														case  Animation : : HANDLE_MODE_BALANCED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															text  + =  TTR ( " Handle mode: Balanced \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-03 10:02:53 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 19:45:30 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														case  Animation : : HANDLE_MODE_MIRRORED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															text  + =  TTR ( " Handle mode: Mirrored \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-03 10:02:53 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_AUDIO :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													String  stream_name  =  " null " ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Ref < Resource >  stream  =  animation - > audio_track_get_key_stream ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													if  ( stream . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( stream - > get_path ( ) . is_resource_file ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															stream_name  =  stream - > get_path ( ) . get_file ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														}  else  if  ( ! stream - > get_name ( ) . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
															stream_name  =  stream - > get_name ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															stream_name  =  stream - > get_class ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Stream: " )  +  "   "  +  stream_name  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													float  so  =  animation - > audio_track_get_key_start_offset ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Start (s): " )  +  "   "  +  rtos ( so )  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													float  eo  =  animation - > audio_track_get_key_end_offset ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " End (s): " )  +  "   "  +  rtos ( eo )  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												case  Animation : : TYPE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													String  name  =  animation - > animation_track_get_key_animation ( track ,  key_idx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													text  + =  TTR ( " Animation Clip: " )  +  "   "  +  name  +  " \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  text ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  Control : : get_tooltip ( p_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-22 12:37:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : gui_input ( const  Ref < InputEvent >  & p_event )  {  
						 
					
						
							
								
									
										
										
										
											2021-04-05 08:52:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND ( p_event . is_null ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									if  ( p_event - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 17:27:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ED_GET_SHORTCUT ( " animation_editor/duplicate_selection " ) - > matches_event ( p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! read_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												emit_signal ( SNAME ( " duplicate_request " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											accept_event ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 17:27:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ED_GET_SHORTCUT ( " animation_editor/duplicate_selection_transposed " ) - > matches_event ( p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! read_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												emit_signal ( SNAME ( " duplicate_transpose_request " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											accept_event ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 17:27:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ED_GET_SHORTCUT ( " animation_editor/delete_selection " ) - > matches_event ( p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! read_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												emit_signal ( SNAME ( " delete_request " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											accept_event ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < InputEventMouseButton >  mb  =  p_event ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  mb - > is_pressed ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : LEFT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										Point2  pos  =  mb - > get_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! read_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( check_rect . has_point ( pos ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Toggle Track Enabled " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_enabled " ,  track ,  ! animation - > track_is_enabled ( track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_enabled " ,  track ,  animation - > track_is_enabled ( track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												accept_event ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Don't overlap track keys if they start at 0.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( path_rect . has_point ( pos  +  Size2 ( type_icon - > get_width ( ) ,  0 ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												clicking_on_name  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												accept_event ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( update_mode_rect . has_point ( pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! menu )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													add_child ( menu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu - > connect ( " id_pressed " ,  callable_mp ( this ,  & AnimationTrackEdit : : _menu_selected ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( animation - > track_get_type ( track )  = =  Animation : : TYPE_AUDIO )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " UseBlendEnable " ) ) ,  TTR ( " Use Blend " ) ,  MENU_USE_BLEND_ENABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " UseBlendDisable " ) ) ,  TTR ( " Don't Use Blend " ) ,  MENU_USE_BLEND_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " TrackContinuous " ) ) ,  TTR ( " Continuous " ) ,  MENU_CALL_MODE_CONTINUOUS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " TrackDiscrete " ) ) ,  TTR ( " Discrete " ) ,  MENU_CALL_MODE_DISCRETE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " TrackCapture " ) ) ,  TTR ( " Capture " ) ,  MENU_CALL_MODE_CAPTURE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												menu - > reset_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector2  popup_pos  =  get_screen_position ( )  +  update_mode_rect . position  +  Vector2 ( 0 ,  update_mode_rect . size . height ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > set_position ( popup_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > popup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												accept_event ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( interp_mode_rect . has_point ( pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! menu )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													add_child ( menu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu - > connect ( " id_pressed " ,  callable_mp ( this ,  & AnimationTrackEdit : : _menu_selected ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " InterpRaw " ) ) ,  TTR ( " Nearest " ) ,  MENU_INTERPOLATION_NEAREST ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " InterpLinear " ) ) ,  TTR ( " Linear " ) ,  MENU_INTERPOLATION_LINEAR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " InterpCubic " ) ) ,  TTR ( " Cubic " ) ,  MENU_INTERPOLATION_CUBIC ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												// Check whether it is angle property.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-26 11:42:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												AnimationPlayerEditor  * ape  =  AnimationPlayerEditor : : get_singleton ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ape )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													AnimationPlayer  * ap  =  ape - > get_player ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ap )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														NodePath  npath  =  animation - > track_get_path ( track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Node  * nd  =  ap - > get_node ( ap - > get_root ( ) ) - > get_node ( NodePath ( npath . get_concatenated_names ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														StringName  prop  =  npath . get_concatenated_subnames ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-26 11:42:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														PropertyInfo  prop_info ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ClassDB : : get_property_info ( nd - > get_class ( ) ,  prop ,  & prop_info ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														bool  is_angle  =  prop_info . type  = =  Variant : : FLOAT  & &  prop_info . hint_string . find ( " radians " )  ! =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( is_angle )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " InterpLinearAngle " ) ) ,  TTR ( " Linear Angle " ) ,  MENU_INTERPOLATION_LINEAR_ANGLE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " InterpCubicAngle " ) ) ,  TTR ( " Cubic Angle " ) ,  MENU_INTERPOLATION_CUBIC_ANGLE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-26 11:42:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												menu - > reset_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector2  popup_pos  =  get_screen_position ( )  +  interp_mode_rect . position  +  Vector2 ( 0 ,  interp_mode_rect . size . height ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > set_position ( popup_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > popup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												accept_event ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( loop_wrap_rect . has_point ( pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! menu )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													add_child ( menu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu - > connect ( " id_pressed " ,  callable_mp ( this ,  & AnimationTrackEdit : : _menu_selected ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " InterpWrapClamp " ) ) ,  TTR ( " Clamp Loop Interp " ) ,  MENU_LOOP_CLAMP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " InterpWrapLoop " ) ) ,  TTR ( " Wrap Loop Interp " ) ,  MENU_LOOP_WRAP ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												menu - > reset_size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector2  popup_pos  =  get_screen_position ( )  +  loop_wrap_rect . position  +  Vector2 ( 0 ,  loop_wrap_rect . size . height ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > set_position ( popup_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > popup ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												accept_event ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( remove_rect . has_point ( pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												emit_signal ( SNAME ( " remove_request " ) ,  track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												accept_event ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-21 22:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Check keyframes.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 20:42:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! animation - > track_is_compressed ( track ) )  {  // Selecting compressed keyframes for editing is not possible.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 20:42:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											float  scale  =  timeline - > get_zoom_scale ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  limit  =  timeline - > get_name_limit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  limit_end  =  get_size ( ) . width  -  timeline - > get_buttons_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Left Border including space occupied by keyframes on t=0.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  limit_start_hitbox  =  limit  -  type_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( pos . x  > =  limit_start_hitbox  & &  pos . x  < =  limit_end )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  key_idx  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  key_distance  =  1e20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Select should happen in the opposite order of drawing for more accurate overlap select.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  animation - > track_get_key_count ( track )  -  1 ;  i  > =  0 ;  i - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Rect2  rect  =  get_key_rect ( i ,  scale ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  offset  =  animation - > track_get_key_time ( track ,  i )  -  timeline - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													offset  =  offset  *  scale  +  limit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													rect . position . x  + =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( rect . has_point ( pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( is_key_selectable_by_distance ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															float  distance  =  ABS ( offset  -  pos . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( key_idx  = =  - 1  | |  distance  <  key_distance )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																key_idx  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																key_distance  =  distance ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															// First one does it.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
															key_idx  =  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 20:42:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 20:42:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( key_idx  ! =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-02 12:37:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( mb - > is_command_or_control_pressed ( )  | |  mb - > is_shift_pressed ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 20:42:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( editor - > is_key_selected ( track ,  key_idx ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															emit_signal ( SNAME ( " deselect_key " ) ,  key_idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															emit_signal ( SNAME ( " select_key " ) ,  key_idx ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															moving_selection_attempt  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															select_single_attempt  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															moving_selection_from_ofs  =  ( mb - > get_position ( ) . x  -  limit )  /  timeline - > get_zoom_scale ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 20:42:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ! editor - > is_key_selected ( track ,  key_idx ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															emit_signal ( SNAME ( " select_key " ) ,  key_idx ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															select_single_attempt  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															select_single_attempt  =  key_idx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														moving_selection_attempt  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-21 22:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														moving_selection_from_ofs  =  ( mb - > get_position ( ) . x  -  limit )  /  timeline - > get_zoom_scale ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( read_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														moving_selection_attempt  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														moving_selection_from_ofs  =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 20:42:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													accept_event ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  mb - > is_pressed ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : RIGHT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										Point2  pos  =  mb - > get_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( pos . x  > =  timeline - > get_name_limit ( )  & &  pos . x  < =  get_size ( ) . width  -  timeline - > get_buttons_width ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-21 22:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Can do something with menu too! show insert key.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											float  offset  =  ( pos . x  -  timeline - > get_name_limit ( ) )  /  timeline - > get_zoom_scale ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! read_only )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! menu )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu  =  memnew ( PopupMenu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													add_child ( menu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu - > connect ( " id_pressed " ,  callable_mp ( this ,  & AnimationTrackEdit : : _menu_selected ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												menu - > clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Key " ) ) ,  TTR ( " Insert Key " ) ,  MENU_KEY_INSERT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( editor - > is_selection_active ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													menu - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Duplicate " ) ) ,  TTR ( " Duplicate Key(s) " ) ,  MENU_KEY_DUPLICATE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													AnimationPlayer  * player  =  AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ! player - > has_animation ( SceneStringNames : : get_singleton ( ) - > RESET )  | |  animation  ! =  player - > get_animation ( SceneStringNames : : get_singleton ( ) - > RESET ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Reload " ) ) ,  TTR ( " Add RESET Value(s) " ) ,  MENU_KEY_ADD_RESET ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													menu - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													menu - > add_icon_item ( get_editor_theme_icon ( SNAME ( " Remove " ) ) ,  TTR ( " Delete Key(s) " ) ,  MENU_KEY_DELETE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > reset_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												menu - > set_position ( get_screen_position ( )  +  get_local_mouse_position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												menu - > popup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												insert_at_pos  =  offset  +  timeline - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												accept_event ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  ! mb - > is_pressed ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : LEFT  & &  clicking_on_name )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  ( ! path )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-19 23:32:09 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											path_popup  =  memnew ( Popup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											path_popup - > set_wrap_controls ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											add_child ( path_popup ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											path  =  memnew ( LineEdit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-19 23:32:09 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											path_popup - > add_child ( path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-18 19:02:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											path - > set_anchors_and_offsets_preset ( PRESET_FULL_RECT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-16 09:43:34 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											path - > connect ( " text_submitted " ,  callable_mp ( this ,  & AnimationTrackEdit : : _path_submitted ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										path - > set_text ( animation - > track_get_path ( track ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Vector2  theme_ofs  =  path - > get_theme_stylebox ( SNAME ( " normal " ) ,  SNAME ( " LineEdit " ) ) - > get_offset ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-19 23:32:09 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										path_popup - > set_position ( get_screen_position ( )  +  path_rect . position  -  theme_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										path_popup - > set_size ( path_rect . size ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										path_popup - > popup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										path - > grab_focus ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-28 19:31:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										path - > set_caret_column ( path - > get_text ( ) . length ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										clicking_on_name  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  moving_selection_attempt )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! mb - > is_pressed ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : LEFT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											moving_selection_attempt  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( moving_selection )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												emit_signal ( SNAME ( " move_selection_commit " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											}  else  if  ( select_single_attempt  ! =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												emit_signal ( SNAME ( " select_key " ) ,  select_single_attempt ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											moving_selection  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											select_single_attempt  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( moving_selection  & &  mb - > is_pressed ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : RIGHT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											moving_selection_attempt  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											moving_selection  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( SNAME ( " move_selection_cancel " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < InputEventMouseMotion >  mm  =  p_event ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 22:59:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mm . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  int  previous_hovering_key_idx  =  hovering_key_idx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Hovering compressed keyframes for editing is not possible.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! animation - > track_is_compressed ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  float  scale  =  timeline - > get_zoom_scale ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  int  limit  =  timeline - > get_name_limit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  int  limit_end  =  get_size ( ) . width  -  timeline - > get_buttons_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Left Border including space occupied by keyframes on t=0.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  int  limit_start_hitbox  =  limit  -  type_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  Point2  pos  =  mm - > get_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( pos . x  > =  limit_start_hitbox  & &  pos . x  < =  limit_end )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Use the same logic as key selection to ensure that hovering accurately represents
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// which key will be selected when clicking.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  key_idx  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  key_distance  =  1e20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												hovering_key_idx  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Hovering should happen in the opposite order of drawing for more accurate overlap hovering.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  animation - > track_get_key_count ( track )  -  1 ;  i  > =  0 ;  i - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Rect2  rect  =  get_key_rect ( i ,  scale ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													float  offset  =  animation - > track_get_key_time ( track ,  i )  -  timeline - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													offset  =  offset  *  scale  +  limit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													rect . position . x  + =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( rect . has_point ( pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( is_key_selectable_by_distance ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															const  float  distance  =  ABS ( offset  -  pos . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( key_idx  = =  - 1  | |  distance  <  key_distance )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																key_idx  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																key_distance  =  distance ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																hovering_key_idx  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															// First one does it.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															hovering_key_idx  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( hovering_key_idx  ! =  previous_hovering_key_idx )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Required to draw keyframe hover feedback on the correct keyframe.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-21 22:59:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-08 00:55:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mm . is_valid ( )  & &  mm - > get_button_mask ( ) . has_flag ( MouseButtonMask : : LEFT )  & &  moving_selection_attempt )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  ( ! moving_selection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											moving_selection  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( SNAME ( " move_selection_begin " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  new_ofs  =  ( mm - > get_position ( ) . x  -  timeline - > get_name_limit ( ) )  /  timeline - > get_zoom_scale ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_signal ( SNAME ( " move_selection " ) ,  new_ofs  -  moving_selection_from_ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Variant  AnimationTrackEdit : : get_drag_data ( const  Point2  & p_point )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! clicking_on_name )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  Variant ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Dictionary  drag_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									drag_data [ " type " ]  =  " animation_track " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  base_path  =  animation - > track_get_path ( track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									base_path  =  base_path . get_slice ( " : " ,  0 ) ;  // Remove sub-path.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									drag_data [ " group " ]  =  base_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									drag_data [ " index " ]  =  track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 20:49:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * tb  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tb - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									tb - > set_text ( path_cache ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									tb - > set_icon ( icon_cache ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_drag_preview ( tb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									clicking_on_name  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  drag_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  AnimationTrackEdit : : can_drop_data ( const  Point2  & p_point ,  const  Variant  & p_data )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Dictionary  d  =  p_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! d . has ( " type " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  type  =  d [ " type " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( type  ! =  " animation_track " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Don't allow moving tracks outside their groups.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( get_editor ( ) - > is_grouping_tracks ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  base_path  =  animation - > track_get_path ( track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										base_path  =  base_path . get_slice ( " : " ,  0 ) ;  // Remove sub-path.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( d [ " group " ]  ! =  base_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_point . y  <  get_size ( ) . height  /  2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dropping_at  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dropping_at  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const_cast < AnimationTrackEdit  * > ( this ) - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : drop_data ( const  Point2  & p_point ,  const  Variant  & p_data )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Dictionary  d  =  p_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! d . has ( " type " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  type  =  d [ " type " ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( type  ! =  " animation_track " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Don't allow moving tracks outside their groups.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( get_editor ( ) - > is_grouping_tracks ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  base_path  =  animation - > track_get_path ( track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										base_path  =  base_path . get_slice ( " : " ,  0 ) ;  // Remove sub-path.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( d [ " group " ]  ! =  base_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  from_track  =  d [ " index " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( dropping_at  <  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_signal ( SNAME ( " dropped " ) ,  from_track ,  track ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										emit_signal ( SNAME ( " dropped " ) ,  from_track ,  track  +  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : _menu_selected ( int  p_index )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_index )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_CALL_MODE_CONTINUOUS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_CALL_MODE_DISCRETE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_CALL_MODE_CAPTURE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Animation : : UpdateMode  update_mode  =  Animation : : UpdateMode ( p_index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Change Animation Update Mode " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " value_track_set_update_mode " ,  track ,  update_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " value_track_set_update_mode " ,  track ,  animation - > value_track_get_update_mode ( track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_INTERPOLATION_NEAREST : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_INTERPOLATION_LINEAR : 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-26 11:42:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  MENU_INTERPOLATION_CUBIC : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_INTERPOLATION_LINEAR_ANGLE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_INTERPOLATION_CUBIC_ANGLE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											Animation : : InterpolationType  interp_mode  =  Animation : : InterpolationType ( p_index  -  MENU_INTERPOLATION_NEAREST ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Change Animation Interpolation Mode " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_interpolation_type " ,  track ,  interp_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_interpolation_type " ,  track ,  animation - > track_get_interpolation_type ( track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_LOOP_WRAP : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_LOOP_CLAMP :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  loop_wrap  =  p_index  = =  MENU_LOOP_WRAP ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Change Animation Loop Mode " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_interpolation_loop_wrap " ,  track ,  loop_wrap ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_interpolation_loop_wrap " ,  track ,  animation - > track_get_interpolation_loop_wrap ( track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_KEY_INSERT :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( SNAME ( " insert_key " ) ,  insert_at_pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_KEY_DUPLICATE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( SNAME ( " duplicate_request " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_KEY_ADD_RESET :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											emit_signal ( SNAME ( " create_reset_request " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_KEY_DELETE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											emit_signal ( SNAME ( " delete_request " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  MENU_USE_BLEND_ENABLED : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MENU_USE_BLEND_DISABLED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  use_blend  =  p_index  = =  MENU_USE_BLEND_ENABLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Change Animation Use Blend " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " audio_track_set_use_blend " ,  track ,  use_blend ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " audio_track_set_use_blend " ,  track ,  animation - > audio_track_is_use_blend ( track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : cancel_drop ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( dropping_at  ! =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dropping_at  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : set_in_group ( bool  p_enable )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									in_group  =  p_enable ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 13:34:22 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : append_to_selection ( const  Rect2  & p_box ,  bool  p_deselection )  {  
						 
					
						
							
								
									
										
										
										
											2021-10-20 20:42:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( animation - > track_is_compressed ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ;  // Compressed keyframes can't be edited
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-21 22:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Left Border including space occupied by keyframes on t=0.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  limit_start_hitbox  =  timeline - > get_name_limit ( )  -  type_icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Rect2  select_rect ( limit_start_hitbox ,  0 ,  get_size ( ) . width  -  timeline - > get_name_limit ( )  -  timeline - > get_buttons_width ( ) ,  get_size ( ) . height ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-19 12:43:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									select_rect  =  select_rect . intersection ( p_box ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-21 22:40:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Select should happen in the opposite order of drawing for more accurate overlap select.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  animation - > track_get_key_count ( track )  -  1 ;  i  > =  0 ;  i - - )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										Rect2  rect  =  const_cast < AnimationTrackEdit  * > ( this ) - > get_key_rect ( i ,  timeline - > get_zoom_scale ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  offset  =  animation - > track_get_key_time ( track ,  i )  -  timeline - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										offset  =  offset  *  timeline - > get_zoom_scale ( )  +  timeline - > get_name_limit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rect . position . x  + =  offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( select_rect . intersects ( rect ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( p_deselection )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												emit_signal ( SNAME ( " deselect_key " ) ,  i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												emit_signal ( SNAME ( " select_key " ) ,  i ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEdit : : _bind_methods ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-01-23 13:49:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " timeline_changed " ,  PropertyInfo ( Variant : : FLOAT ,  " position " ) ,  PropertyInfo ( Variant : : BOOL ,  " drag " ) ,  PropertyInfo ( Variant : : BOOL ,  " timeline_only " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " remove_request " ,  PropertyInfo ( Variant : : INT ,  " track " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " dropped " ,  PropertyInfo ( Variant : : INT ,  " from_track " ) ,  PropertyInfo ( Variant : : INT ,  " to_track " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:20:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " insert_key " ,  PropertyInfo ( Variant : : FLOAT ,  " offset " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " select_key " ,  PropertyInfo ( Variant : : INT ,  " index " ) ,  PropertyInfo ( Variant : : BOOL ,  " single " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " deselect_key " ,  PropertyInfo ( Variant : : INT ,  " index " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " move_selection_begin " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:20:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " move_selection " ,  PropertyInfo ( Variant : : FLOAT ,  " offset " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " move_selection_commit " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " move_selection_cancel " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " duplicate_request " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " create_reset_request " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " duplicate_transpose_request " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " delete_request " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AnimationTrackEdit : : AnimationTrackEdit ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									play_position  =  memnew ( Control ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									play_position - > set_mouse_filter ( MOUSE_FILTER_PASS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( play_position ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-18 19:02:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									play_position - > set_anchors_and_offsets_preset ( PRESET_FULL_RECT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									play_position - > connect ( " draw " ,  callable_mp ( this ,  & AnimationTrackEdit : : _play_position_draw ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									set_focus_mode ( FOCUS_CLICK ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_mouse_filter ( MOUSE_FILTER_PASS ) ;  // Scroll has to work too for selection.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//////////////////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AnimationTrackEdit  * AnimationTrackEditPlugin : : create_value_track_edit ( Object  * p_object ,  Variant : : Type  p_type ,  const  String  & p_property ,  PropertyHint  p_hint ,  const  String  & p_hint_string ,  int  p_usage )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( get_script_instance ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Variant  args [ 6 ]  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_object , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_type , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_property , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_hint , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_hint_string , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_usage 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Variant  * argptrs [ 6 ]  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											& args [ 0 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											& args [ 1 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											& args [ 2 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											& args [ 3 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											& args [ 4 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											& args [ 5 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-19 16:27:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Callable : : CallError  ce ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-09 14:58:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  Object : : cast_to < AnimationTrackEdit > ( get_script_instance ( ) - > callp ( " create_value_track_edit " ,  ( const  Variant  * * ) & argptrs ,  6 ,  ce ) . operator  Object  * ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AnimationTrackEdit  * AnimationTrackEditPlugin : : create_audio_track_edit ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( get_script_instance ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  Object : : cast_to < AnimationTrackEdit > ( get_script_instance ( ) - > call ( " create_audio_track_edit " ) . operator  Object  * ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AnimationTrackEdit  * AnimationTrackEditPlugin : : create_animation_track_edit ( Object  * p_object )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( get_script_instance ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  Object : : cast_to < AnimationTrackEdit > ( get_script_instance ( ) - > call ( " create_animation_track_edit " ,  p_object ) . operator  Object  * ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								///////////////////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditGroup : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  NOTIFICATION_DRAW :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Ref < Font >  font  =  get_theme_font ( SNAME ( " font " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  font_size  =  get_theme_font_size ( SNAME ( " font_size " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:20:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  separation  =  get_theme_constant ( SNAME ( " h_separation " ) ,  SNAME ( " ItemList " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  color  =  get_theme_color ( SNAME ( " font_color " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( root  & &  root - > has_node ( node ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Node  * n  =  root - > get_node ( node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( n  & &  EditorNode : : get_singleton ( ) - > get_editor_selection ( ) - > is_selected ( n ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													color  =  get_theme_color ( SNAME ( " accent_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Color  bgcol  =  get_theme_color ( SNAME ( " dark_color_2 " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bgcol . a  * =  0.6 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											draw_rect ( Rect2 ( Point2 ( ) ,  get_size ( ) ) ,  bgcol ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Color  linecolor  =  color ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											linecolor . a  =  0.2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											draw_line ( Point2 ( ) ,  Point2 ( get_size ( ) . width ,  0 ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											draw_line ( Point2 ( timeline - > get_name_limit ( ) ,  0 ) ,  Point2 ( timeline - > get_name_limit ( ) ,  get_size ( ) . height ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											draw_line ( Point2 ( get_size ( ) . width  -  timeline - > get_buttons_width ( ) ,  0 ) ,  Point2 ( get_size ( ) . width  -  timeline - > get_buttons_width ( ) ,  get_size ( ) . height ) ,  linecolor ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  ofs  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											draw_texture ( icon ,  Point2 ( ofs ,  int ( get_size ( ) . height  -  icon - > get_height ( ) )  /  2 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ofs  + =  separation  +  icon - > get_width ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											draw_string ( font ,  Point2 ( ofs ,  int ( get_size ( ) . height  -  font - > get_height ( font_size ) )  /  2  +  font - > get_ascent ( font_size ) ) ,  node_name ,  HORIZONTAL_ALIGNMENT_LEFT ,  timeline - > get_name_limit ( )  -  ofs ,  font_size ,  color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  px  =  ( - timeline - > get_value ( )  +  timeline - > get_play_position ( ) )  *  timeline - > get_zoom_scale ( )  +  timeline - > get_name_limit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( px  > =  timeline - > get_name_limit ( )  & &  px  <  ( get_size ( ) . width  -  timeline - > get_buttons_width ( ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Color  accent  =  get_theme_color ( SNAME ( " accent_color " ) ,  EditorStringName ( Editor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												draw_line ( Point2 ( px ,  0 ) ,  Point2 ( px ,  get_size ( ) . height ) ,  accent ,  Math : : round ( 2  *  EDSCALE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-11 15:43:37 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditGroup : : set_type_and_name ( const  Ref < Texture2D >  & p_type ,  const  String  & p_name ,  const  NodePath  & p_node )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									icon  =  p_type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									node_name  =  p_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									node  =  p_node ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 14:02:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									update_minimum_size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Size2  AnimationTrackEditGroup : : get_minimum_size ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Font >  font  =  get_theme_font ( SNAME ( " font " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  font_size  =  get_theme_font_size ( SNAME ( " font_size " ) ,  SNAME ( " Label " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-14 16:20:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  separation  =  get_theme_constant ( SNAME ( " v_separation " ) ,  SNAME ( " ItemList " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-03 14:22:16 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  Vector2 ( 0 ,  MAX ( font - > get_height ( font_size ) ,  icon - > get_height ( ) )  +  separation ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditGroup : : set_timeline ( AnimationTimelineEdit  * p_timeline )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline  =  p_timeline ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									timeline - > connect ( " zoom_changed " ,  callable_mp ( this ,  & AnimationTrackEditGroup : : _zoom_changed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > connect ( " name_limit_changed " ,  callable_mp ( this ,  & AnimationTrackEditGroup : : _zoom_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditGroup : : set_root ( Node  * p_root )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									root  =  p_root ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditGroup : : _zoom_changed ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AnimationTrackEditGroup : : AnimationTrackEditGroup ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_mouse_filter ( MOUSE_FILTER_PASS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//////////////////////////////////////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : add_track_edit_plugin ( const  Ref < AnimationTrackEditPlugin >  & p_plugin )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-02 00:04:13 +05:45 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( track_edit_plugins . has ( p_plugin ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									track_edit_plugins . push_back ( p_plugin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : remove_track_edit_plugin ( const  Ref < AnimationTrackEditPlugin >  & p_plugin )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									track_edit_plugins . erase ( p_plugin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : set_animation ( const  Ref < Animation >  & p_anim ,  bool  p_read_only )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									if  ( animation  ! =  p_anim  & &  _get_track_selected ( )  > =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edits [ _get_track_selected ( ) ] - > release_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-03 21:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										animation - > disconnect_changed ( callable_mp ( this ,  & AnimationTrackEditor : : _animation_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										_clear_selection ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									animation  =  p_anim ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									read_only  =  p_read_only ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > set_animation ( p_anim ,  read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_cancel_bezier_edit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_update_tracks ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-03 21:29:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										animation - > connect_changed ( callable_mp ( this ,  & AnimationTrackEditor : : _animation_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 15:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										hscroll - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										edit - > set_disabled ( read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										step - > set_block_signals ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_update_step_spinbox ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										step - > set_block_signals ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										step - > set_read_only ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										snap - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-18 14:36:28 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										snap_mode - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-23 15:02:34 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										imported_anim_warning - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  animation - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( animation - > track_is_imported ( i ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												imported_anim_warning - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-11 20:39:02 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_check_bezier_exist ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 15:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										hscroll - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										edit - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										step - > set_block_signals ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										step - > set_value ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										step - > set_block_signals ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										step - > set_read_only ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										snap - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-18 14:36:28 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										snap_mode - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-09 10:05:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bezier_edit_icon - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-11 20:39:02 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _check_bezier_exist ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  is_exist  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  animation - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( animation - > track_get_type ( i )  = =  Animation : : TrackType : : TYPE_BEZIER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											is_exist  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( is_exist )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bezier_edit_icon - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( bezier_edit - > is_visible ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_cancel_bezier_edit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bezier_edit_icon - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Ref < Animation >  AnimationTrackEditor : : get_current_animation ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  animation ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2019-09-04 02:20:57 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-03 14:49:18 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _root_removed ( )  {  
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									root  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : set_root ( Node  * p_root )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( root )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										root - > disconnect ( " tree_exiting " ,  callable_mp ( this ,  & AnimationTrackEditor : : _root_removed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									root  =  p_root ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( root )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-01 15:44:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										root - > connect ( " tree_exiting " ,  callable_mp ( this ,  & AnimationTrackEditor : : _root_removed ) ,  CONNECT_ONE_SHOT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_update_tracks ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Node  * AnimationTrackEditor : : get_root ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  root ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : update_keying ( )  {  
						 
					
						
							
								
									
										
										
										
											2021-12-02 12:01:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  keying_enabled  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 20:12:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorSelectionHistory  * editor_history  =  EditorNode : : get_singleton ( ) - > get_editor_selection_history ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-02 12:01:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( is_visible_in_tree ( )  & &  animation . is_valid ( )  & &  editor_history - > get_path_size ( )  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Object  * obj  =  ObjectDB : : get_instance ( editor_history - > get_path_object ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										keying_enabled  =  Object : : cast_to < Node > ( obj )  ! =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( keying_enabled  = =  keying )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									keying  =  keying_enabled ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-19 11:48:20 -08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " keying_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  AnimationTrackEditor : : has_keying ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  keying ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Dictionary  AnimationTrackEditor : : get_state ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Dictionary  state ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									state [ " fps_mode " ]  =  timeline - > is_using_fps ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									state [ " zoom " ]  =  zoom - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									state [ " offset " ]  =  timeline - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 13:46:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									state [ " v_scroll " ]  =  scroll - > get_v_scroll_bar ( ) - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  state ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : set_state ( const  Dictionary  & p_state )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_state . has ( " fps_mode " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  fps_mode  =  p_state [ " fps_mode " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( fps_mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											snap_mode - > select ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											snap_mode - > select ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_snap_mode_changed ( snap_mode - > get_selected ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										snap_mode - > select ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_snap_mode_changed ( snap_mode - > get_selected ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_state . has ( " zoom " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										zoom - > set_value ( p_state [ " zoom " ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										zoom - > set_value ( 1.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_state . has ( " offset " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										timeline - > set_value ( p_state [ " offset " ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										timeline - > set_value ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_state . has ( " v_scroll " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 13:46:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										scroll - > get_v_scroll_bar ( ) - > set_value ( p_state [ " v_scroll " ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 13:46:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										scroll - > get_v_scroll_bar ( ) - > set_value ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : cleanup ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									set_animation ( Ref < Animation > ( ) ,  read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _name_limit_changed ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-15 01:05:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _timeline_changed ( float  p_new_pos ,  bool  p_drag ,  bool  p_timeline_only )  {  
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " timeline_changed " ) ,  p_new_pos ,  p_drag ,  p_timeline_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _track_remove_request ( int  p_track )  {  
						 
					
						
							
								
									
										
										
										
											2022-04-23 00:40:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_animation_track_remove_request ( p_track ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _animation_track_remove_request ( int  p_track ,  Ref < Animation >  p_from_animation )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_from_animation - > track_is_compressed ( p_track ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-20 20:42:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Compressed tracks can't be edited or removed. Re-import the animation with compression disabled in order to edit. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									int  idx  =  p_track ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-23 00:40:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( idx  > =  0  & &  idx  <  p_from_animation - > get_track_count ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-28 02:54:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > create_action ( TTR ( " Remove Anim Track " ) ,  UndoRedo : : MERGE_DISABLE ,  p_from_animation . ptr ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-23 00:40:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Remove corresponding reset tracks if they are no longer needed.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										AnimationPlayer  * player  =  AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( player - > has_animation ( SceneStringNames : : get_singleton ( ) - > RESET ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Ref < Animation >  reset  =  player - > get_animation ( SceneStringNames : : get_singleton ( ) - > RESET ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( reset  ! =  p_from_animation )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  reset - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( reset - > track_get_path ( i )  = =  p_from_animation - > track_get_path ( p_track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														// Check if the reset track isn't used by other animations.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														bool  used  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														List < StringName >  animation_list ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														player - > get_animation_list ( & animation_list ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														for  ( const  StringName  & anim_name  :  animation_list )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															Ref < Animation >  anim  =  player - > get_animation ( anim_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( anim  = =  p_from_animation  | |  anim  = =  reset )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( int  j  =  0 ;  j  <  anim - > get_track_count ( ) ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( anim - > track_get_path ( j )  = =  reset - > track_get_path ( i ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	used  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( used )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( ! used )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															_animation_track_remove_request ( i ,  reset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 22:16:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( this ,  " _clear_selection " ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-23 00:40:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( p_from_animation . ptr ( ) ,  " remove_track " ,  idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( p_from_animation . ptr ( ) ,  " add_track " ,  p_from_animation - > track_get_type ( idx ) ,  idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( p_from_animation . ptr ( ) ,  " track_set_path " ,  idx ,  p_from_animation - > track_get_path ( idx ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 22:16:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// TODO interpolation.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-23 00:40:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  p_from_animation - > track_get_key_count ( idx ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Variant  v  =  p_from_animation - > track_get_key_value ( idx ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  time  =  p_from_animation - > track_get_key_time ( idx ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  trans  =  p_from_animation - > track_get_key_transition ( idx ,  i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-23 00:40:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( p_from_animation . ptr ( ) ,  " track_insert_key " ,  idx ,  time ,  v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( p_from_animation . ptr ( ) ,  " track_set_key_transition " ,  idx ,  i ,  trans ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-23 00:40:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( p_from_animation . ptr ( ) ,  " track_set_interpolation_type " ,  idx ,  p_from_animation - > track_get_interpolation_type ( idx ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( p_from_animation - > track_get_type ( idx )  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( p_from_animation . ptr ( ) ,  " value_track_set_update_mode " ,  idx ,  p_from_animation - > value_track_get_update_mode ( idx ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( animation - > track_get_type ( idx )  = =  Animation : : TYPE_AUDIO )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " audio_track_set_use_blend " ,  idx ,  animation - > audio_track_is_use_blend ( idx ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _track_grab_focus ( int  p_track )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Don't steal focus if not working with the track editor.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-03 11:59:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( Object : : cast_to < AnimationTrackEdit > ( get_viewport ( ) - > gui_get_focus_owner ( ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										track_edits [ p_track ] - > grab_focus ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : set_anim_pos ( float  p_pos )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > set_play_position ( p_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  track_edits . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edits [ i ] - > set_play_position ( p_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_redraw_groups ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									bezier_edit - > set_play_position ( p_pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  bool  track_type_is_resettable ( Animation : : TrackType  p_type )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_VALUE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											[[fallthrough]] ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 19:04:35 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : TYPE_BLEND_SHAPE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											[[fallthrough]] ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : TYPE_BEZIER : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											[[fallthrough]] ; 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											[[fallthrough]] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											[[fallthrough]] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_SCALE_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : make_insert_queue ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									insert_data . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									insert_queue  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : commit_insert_queue ( )  {  
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  reset_allowed  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AnimationPlayer  * player  =  AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 01:46:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( player - > has_animation ( SceneStringNames : : get_singleton ( ) - > RESET )  & &  player - > get_animation ( SceneStringNames : : get_singleton ( ) - > RESET )  = =  animation )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Avoid messing with the reset animation itself.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										reset_allowed  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  some_resettable  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  insert_data . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( track_type_is_resettable ( insert_data [ i ] . type ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												some_resettable  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! some_resettable )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											reset_allowed  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Organize insert data.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  num_tracks  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  last_track_query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  all_bezier  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  insert_data . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( insert_data [ i ] . type  ! =  Animation : : TYPE_VALUE  & &  insert_data [ i ] . type  ! =  Animation : : TYPE_BEZIER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											all_bezier  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( insert_data [ i ] . track_idx  = =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											+ + num_tracks ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											last_track_query  =  insert_data [ i ] . query ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( insert_data [ i ] . type  ! =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										switch  ( insert_data [ i ] . value . get_type ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Variant : : INT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Variant : : FLOAT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Variant : : VECTOR2 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Variant : : VECTOR3 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Variant : : QUATERNION : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Variant : : PLANE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Variant : : COLOR :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Valid.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												all_bezier  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 22:33:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Skip the confirmation dialog if the user holds Shift while clicking the key icon.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! Input : : get_singleton ( ) - > is_key_pressed ( Key : : SHIFT )  & &  num_tracks  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  shortcut_hint  =  TTR ( " Hold Shift when clicking the key icon to skip this dialog. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Potentially a new key, does not exist.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( num_tracks  = =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// TRANSLATORS: %s will be replaced by a phrase describing the target of track.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 22:33:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											insert_confirm_text - > set_text ( vformat ( TTR ( " Create new track for %s and insert key? " )  +  " \n \n "  +  shortcut_hint ,  last_track_query ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-02 22:33:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											insert_confirm_text - > set_text ( vformat ( TTR ( " Create %d new tracks and insert keys? " )  +  " \n \n "  +  shortcut_hint ,  num_tracks ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										insert_confirm_bezier - > set_visible ( all_bezier ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										insert_confirm_reset - > set_visible ( reset_allowed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-07 19:31:19 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										insert_confirm - > set_ok_button_text ( TTR ( " Create " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										insert_confirm - > popup_centered ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_insert_track ( reset_allowed  & &  EDITOR_GET ( " editors/animation/default_create_reset_tracks " ) ,  all_bezier  & &  EDITOR_GET ( " editors/animation/default_create_bezier_tracks " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									insert_queue  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _query_insert ( const  InsertData  & p_id )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! insert_queue )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										insert_data . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( const  InsertData  & E  :  insert_data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Prevent insertion of multiple tracks.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( E . path  = =  p_id . path  & &  E . type  = =  p_id . type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ;  // Already inserted a track this frame.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									insert_data . push_back ( p_id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Without queue, commit immediately.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! insert_queue )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										commit_insert_queue ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-17 19:42:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _insert_track ( bool  p_reset_wanted ,  bool  p_create_beziers )  {  
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-10 21:45:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > create_action ( TTR ( " Animation Insert Key " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Animation >  reset_anim ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-17 19:42:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_reset_wanted )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										reset_anim  =  _create_and_get_reset_animation ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TrackIndices  next_tracks ( animation . ptr ( ) ,  reset_anim . ptr ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									bool  advance  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									while  ( insert_data . size ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( insert_data . front ( ) - > get ( ) . advance )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											advance  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-17 19:42:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										next_tracks  =  _confirm_insert ( insert_data . front ( ) - > get ( ) ,  next_tracks ,  p_reset_wanted ,  reset_anim ,  p_create_beziers ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										insert_data . pop_front ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( advance )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-23 15:32:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_edit_menu_pressed ( EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : insert_transform_key ( Node3D  * p_node ,  const  String  & p_sub ,  const  Animation : : TrackType  p_type ,  const  Variant  p_value )  {  
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( root ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_COND_MSG ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											( p_type  ! =  Animation : : TYPE_POSITION_3D  & &  p_type  ! =  Animation : : TYPE_ROTATION_3D  & &  p_type  ! =  Animation : : TYPE_SCALE_3D ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											" Track type must be Position/Rotation/Scale 3D. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! keying )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Let's build a node path.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-19 07:23:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  path  =  root - > get_path_to ( p_node ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! p_sub . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										path  + =  " : "  +  p_sub ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NodePath  np  =  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  track_idx  =  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  animation - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( animation - > track_get_path ( i )  ! =  np )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( animation - > track_get_type ( i )  ! =  p_type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										track_idx  =  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									InsertData  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . path  =  np ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 23:53:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// TRANSLATORS: This describes the target of new animation track, will be inserted into another string.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . query  =  vformat ( TTR ( " node '%s' " ) ,  p_node - > get_name ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									id . advance  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									id . track_idx  =  track_idx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . value  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . type  =  p_type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_query_insert ( id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  AnimationTrackEditor : : has_track ( Node3D  * p_node ,  const  String  & p_sub ,  const  Animation : : TrackType  p_type )  {  
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL_V ( root ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! keying )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Let's build a node path.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-19 07:23:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  path  =  root - > get_path_to ( p_node ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! p_sub . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										path  + =  " : "  +  p_sub ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  track_id  =  animation - > find_track ( path ,  p_type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( track_id  > =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-16 10:04:09 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _insert_animation_key ( NodePath  p_path ,  const  Variant  & p_value )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  path  =  p_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Animation property is a special case, always creates an animation track.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  animation - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  np  =  animation - > track_get_path ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( path  = =  np  & &  animation - > track_get_type ( i )  = =  Animation : : TYPE_ANIMATION )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Exists.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											InsertData  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . path  =  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . track_idx  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . value  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . type  =  Animation : : TYPE_ANIMATION ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 23:53:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// TRANSLATORS: This describes the target of new animation track, will be inserted into another string.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . query  =  TTR ( " animation " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											id . advance  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Dialog insert.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											_query_insert ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									InsertData  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . path  =  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . track_idx  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . value  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . type  =  Animation : : TYPE_ANIMATION ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 23:53:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									id . query  =  TTR ( " animation " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									id . advance  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Dialog insert.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									_query_insert ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : insert_node_value_key ( Node  * p_node ,  const  String  & p_property ,  const  Variant  & p_value ,  bool  p_only_if_exists )  {  
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( root ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-19 07:23:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Let's build a node path.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Node  * node  =  p_node ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-19 07:23:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  path  =  root - > get_path_to ( node ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( Object : : cast_to < AnimationPlayer > ( node )  & &  p_property  = =  " current_animation " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( node  = =  AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " AnimationPlayer can't animate itself, only other players. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_insert_animation_key ( path ,  p_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-30 20:12:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorSelectionHistory  * history  =  EditorNode : : get_singleton ( ) - > get_editor_selection_history ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  1 ;  i  <  history - > get_path_size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  prop  =  history - > get_path_property ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ERR_FAIL_COND ( prop . is_empty ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										path  + =  " : "  +  prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									path  + =  " : "  +  p_property ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NodePath  np  =  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Locate track.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  inserted  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  animation - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( animation - > track_get_type ( i )  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( animation - > track_get_path ( i )  ! =  np )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											InsertData  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . path  =  np ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . track_idx  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . value  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . type  =  Animation : : TYPE_VALUE ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 23:53:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// TRANSLATORS: This describes the target of new animation track, will be inserted into another string.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . query  =  vformat ( TTR ( " property '%s' " ) ,  p_property ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											id . advance  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Dialog insert.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											_query_insert ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											inserted  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( animation - > track_get_type ( i )  = =  Animation : : TYPE_BEZIER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Variant  value ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											String  track_path  =  animation - > track_get_path ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( track_path  = =  np )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												value  =  p_value ;  // All good.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-03 15:26:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												int  sep  =  track_path . rfind ( " : " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( sep  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													String  base_path  =  track_path . substr ( 0 ,  sep ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( base_path  = =  np )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														String  value_name  =  track_path . substr ( sep  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														value  =  p_value . get ( value_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											InsertData  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . path  =  animation - > track_get_path ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . track_idx  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . value  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . type  =  Animation : : TYPE_BEZIER ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 23:53:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											id . query  =  vformat ( TTR ( " property '%s' " ) ,  p_property ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											id . advance  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Dialog insert.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											_query_insert ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											inserted  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( inserted  | |  p_only_if_exists )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									InsertData  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . path  =  np ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . track_idx  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . value  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id . type  =  Animation : : TYPE_VALUE ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 23:53:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									id . query  =  vformat ( TTR ( " property '%s' " ) ,  p_property ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									id . advance  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Dialog insert.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									_query_insert ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : insert_value_key ( const  String  & p_property ,  const  Variant  & p_value ,  bool  p_advance )  {  
						 
					
						
							
								
									
										
										
										
											2022-03-30 20:12:26 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorSelectionHistory  * history  =  EditorNode : : get_singleton ( ) - > get_editor_selection_history ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( root ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND ( history - > get_path_size ( )  = =  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * obj  =  ObjectDB : : get_instance ( history - > get_path_object ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND ( ! Object : : cast_to < Node > ( obj ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-19 07:23:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Let's build a node path.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Node  * node  =  Object : : cast_to < Node > ( obj ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-19 07:23:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									String  path  =  root - > get_path_to ( node ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( Object : : cast_to < AnimationPlayer > ( node )  & &  p_property  = =  " current_animation " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( node  = =  AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " AnimationPlayer can't animate itself, only other players. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_insert_animation_key ( path ,  p_value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  1 ;  i  <  history - > get_path_size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										String  prop  =  history - > get_path_property ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ERR_FAIL_COND ( prop . is_empty ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										path  + =  " : "  +  prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									path  + =  " : "  +  p_property ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NodePath  np  =  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Locate track.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  inserted  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									make_insert_queue ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  animation - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( animation - > track_get_type ( i )  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( animation - > track_get_path ( i )  ! =  np )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											InsertData  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . path  =  np ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . track_idx  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . value  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . type  =  Animation : : TYPE_VALUE ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 23:53:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											id . query  =  vformat ( TTR ( " property '%s' " ) ,  p_property ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											id . advance  =  p_advance ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Dialog insert.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											_query_insert ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											inserted  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( animation - > track_get_type ( i )  = =  Animation : : TYPE_BEZIER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Variant  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( animation - > track_get_path ( i )  = =  np )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												value  =  p_value ;  // All good.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-12 21:10:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												String  tpath  =  animation - > track_get_path ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-03 15:26:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												int  index  =  tpath . rfind ( " : " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-10 06:22:10 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( NodePath ( tpath . substr ( 0 ,  index  +  1 ) )  = =  np )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													String  subindex  =  tpath . substr ( index  +  1 ,  tpath . length ( )  -  index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													value  =  p_value . get ( subindex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											InsertData  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . path  =  animation - > track_get_path ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . track_idx  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . value  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id . type  =  Animation : : TYPE_BEZIER ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 23:53:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											id . query  =  vformat ( TTR ( " property '%s' " ) ,  p_property ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											id . advance  =  p_advance ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Dialog insert.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											_query_insert ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											inserted  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									commit_insert_queue ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! inserted )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										InsertData  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										id . path  =  np ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										id . track_idx  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										id . value  =  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										id . type  =  Animation : : TYPE_VALUE ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-03 23:53:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										id . query  =  vformat ( TTR ( " property '%s' " ) ,  p_property ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										id . advance  =  p_advance ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Dialog insert.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										_query_insert ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Ref < Animation >  AnimationTrackEditor : : _create_and_get_reset_animation ( )  {  
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AnimationPlayer  * player  =  AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 01:46:03 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( player - > has_animation ( SceneStringNames : : get_singleton ( ) - > RESET ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  player - > get_animation ( SceneStringNames : : get_singleton ( ) - > RESET ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-22 20:37:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Ref < AnimationLibrary >  al ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! player - > has_animation_library ( " " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											al . instantiate ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											player - > add_animation_library ( " " ,  al ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											al  =  player - > get_animation_library ( " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Ref < Animation >  reset_anim ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-17 16:03:09 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										reset_anim . instantiate ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										reset_anim - > set_length ( ANIM_MIN_LENGTH ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-22 20:37:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( al . ptr ( ) ,  " add_animation " ,  SceneStringNames : : get_singleton ( ) - > RESET ,  reset_anim ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( AnimationPlayerEditor : : get_singleton ( ) ,  " _animation_player_changed " ,  player ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-22 20:37:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( al . ptr ( ) ,  " remove_animation " ,  SceneStringNames : : get_singleton ( ) - > RESET ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( AnimationPlayerEditor : : get_singleton ( ) ,  " _animation_player_changed " ,  player ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  reset_anim ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _confirm_insert_list ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-10 21:45:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > create_action ( TTR ( " Animation Insert Key " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  create_reset  =  insert_confirm_reset - > is_visible ( )  & &  insert_confirm_reset - > is_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < Animation >  reset_anim ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( create_reset )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										reset_anim  =  _create_and_get_reset_animation ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TrackIndices  next_tracks ( animation . ptr ( ) ,  reset_anim . ptr ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-23 15:32:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  advance  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									while  ( insert_data . size ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-23 15:32:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( insert_data . front ( ) - > get ( ) . advance )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											advance  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-01 22:24:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										next_tracks  =  _confirm_insert ( insert_data . front ( ) - > get ( ) ,  next_tracks ,  create_reset ,  reset_anim ,  insert_confirm_bezier - > is_pressed ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										insert_data . pop_front ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-23 15:32:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( advance )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_edit_menu_pressed ( EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PropertyInfo  AnimationTrackEditor : : _find_hint_for_track ( int  p_idx ,  NodePath  & r_base_path ,  Variant  * r_current_val )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									r_base_path  =  NodePath ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND_V ( ! animation . is_valid ( ) ,  PropertyInfo ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_INDEX_V ( p_idx ,  animation - > get_track_count ( ) ,  PropertyInfo ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! root )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  PropertyInfo ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NodePath  path  =  animation - > track_get_path ( p_idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! root - > has_node_and_resource ( path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  PropertyInfo ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < Resource >  res ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Vector < StringName >  leftover_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * node  =  root - > get_node_and_resource ( path ,  res ,  leftover_path ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										r_base_path  =  node - > get_path ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( leftover_path . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  ( r_current_val )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( res . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												* r_current_val  =  res ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												* r_current_val  =  node ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  PropertyInfo ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Variant  property_info_base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( res . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										property_info_base  =  res ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( r_current_val )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 15:59:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											* r_current_val  =  res - > get_indexed ( leftover_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										property_info_base  =  node ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( r_current_val )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 15:59:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											* r_current_val  =  node - > get_indexed ( leftover_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  leftover_path . size ( )  -  1 ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-06 22:29:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bool  valid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										property_info_base  =  property_info_base . get_named ( leftover_path [ i ] ,  valid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									List < PropertyInfo >  pinfo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									property_info_base . get_property_list ( & pinfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-24 15:46:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( const  PropertyInfo  & E  :  pinfo )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( E . name  = =  leftover_path [ leftover_path . size ( )  -  1 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  E ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  PropertyInfo ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  Vector < String >  _get_bezier_subindices_for_type ( Variant : : Type  p_type ,  bool  * r_valid  =  nullptr )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Vector < String >  subindices ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( r_valid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										* r_valid  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : INT :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  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-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : VECTOR2 :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 15:59:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											subindices . push_back ( " :x " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :y " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : VECTOR3 :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 15:59:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											subindices . push_back ( " :x " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :y " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :z " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 07:02:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Variant : : QUATERNION :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 15:59:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											subindices . push_back ( " :x " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :y " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :z " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :w " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : COLOR :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 15:59:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											subindices . push_back ( " :r " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :g " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :b " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :a " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Variant : : PLANE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 15:59:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											subindices . push_back ( " :x " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :y " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :z " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices . push_back ( " :d " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( r_valid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												* r_valid  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  subindices ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-17 19:42:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								AnimationTrackEditor : : TrackIndices  AnimationTrackEditor : : _confirm_insert ( InsertData  p_id ,  TrackIndices  p_next_tracks ,  bool  p_reset_wanted ,  Ref < Animation >  p_reset_anim ,  bool  p_create_beziers )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									bool  created  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-17 19:42:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  create_normal_track  =  p_id . track_idx  <  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  create_reset_track  =  p_reset_wanted  & &  track_type_is_resettable ( p_id . type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Animation : : UpdateMode  update_mode  =  Animation : : UPDATE_DISCRETE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( create_normal_track  | |  create_reset_track )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( p_id . type  = =  Animation : : TYPE_VALUE  | |  p_id . type  = =  Animation : : TYPE_BEZIER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Hack.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											NodePath  np ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											animation - > add_track ( p_id . type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											animation - > track_set_path ( animation - > get_track_count ( )  -  1 ,  p_id . path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PropertyInfo  h  =  _find_hint_for_track ( animation - > get_track_count ( )  -  1 ,  np ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											animation - > remove_track ( animation - > get_track_count ( )  -  1 ) ;  // Hack.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( h . type  = =  Variant : : FLOAT  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : VECTOR2  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : RECT2  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : VECTOR3  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : AABB  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : QUATERNION  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : COLOR  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : PLANE  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : TRANSFORM2D  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : TRANSFORM3D )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												update_mode  =  Animation : : UPDATE_CONTINUOUS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-17 19:42:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( create_normal_track )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p_create_beziers )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  valid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Vector < String >  subindices  =  _get_bezier_subindices_for_type ( p_id . value . get_type ( ) ,  & valid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( valid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  subindices . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													InsertData  id  =  p_id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													id . type  =  Animation : : TYPE_BEZIER ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													id . value  =  p_id . value . get ( subindices [ i ] . substr ( 1 ,  subindices [ i ] . length ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													id . path  =  String ( p_id . path )  +  subindices [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-17 19:42:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													p_next_tracks  =  _confirm_insert ( id ,  p_next_tracks ,  p_reset_wanted ,  p_reset_anim ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  p_next_tracks ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										created  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										p_id . track_idx  =  p_next_tracks . normal ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( animation . ptr ( ) ,  " add_track " ,  p_id . type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_path " ,  p_id . track_idx ,  p_id . path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p_id . type  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " value_track_set_update_mode " ,  p_id . track_idx ,  update_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  time  =  timeline - > get_play_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Variant  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_id . type )  { 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_SCALE_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 19:04:35 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : TYPE_BLEND_SHAPE : 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											value  =  p_id . value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_BEZIER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Array  array ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 19:45:30 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											array . resize ( 5 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											array [ 0 ]  =  p_id . value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											array [ 1 ]  =  - 0.25 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											array [ 2 ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											array [ 3 ]  =  0.25 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											array [ 4 ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											value  =  array ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-09 10:05:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bezier_edit_icon - > set_disabled ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											value  =  p_id . value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-09 12:35:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  p_id . track_idx ,  time ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( created )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 22:16:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Just remove the track.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( this ,  " _clear_selection " ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( animation . ptr ( ) ,  " remove_track " ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										p_next_tracks . normal + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  p_id . track_idx ,  time ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  existing  =  animation - > track_find_key ( p_id . track_idx ,  time ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  ( existing  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Variant  v  =  animation - > track_get_key_value ( p_id . track_idx ,  existing ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  trans  =  animation - > track_get_key_transition ( p_id . track_idx ,  existing ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_insert_key " ,  p_id . track_idx ,  time ,  v ,  trans ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-17 19:42:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( create_reset_track )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-01 22:24:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Animation  * reset_anim  =  p_reset_anim . ptr ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  reset_anim - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( reset_anim - > track_get_path ( i )  = =  p_id . path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												create_reset_track  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( create_reset_track )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( reset_anim ,  " add_track " ,  p_id . type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( reset_anim ,  " track_set_path " ,  p_next_tracks . reset ,  p_id . path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-17 19:42:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( p_id . type  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( reset_anim ,  " value_track_set_update_mode " ,  p_next_tracks . reset ,  update_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( reset_anim ,  " track_insert_key " ,  p_next_tracks . reset ,  0.0f ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( reset_anim ,  " remove_track " ,  reset_anim - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_next_tracks . reset + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  p_next_tracks ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : show_select_node_warning ( bool  p_show )  {  
						 
					
						
							
								
									
										
										
										
											2019-09-04 02:20:57 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									info_message - > set_visible ( p_show ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  AnimationTrackEditor : : is_key_selected ( int  p_track ,  int  p_key )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SelectedKey  sk ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sk . key  =  p_key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sk . track  =  p_track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  selection . has ( sk ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  AnimationTrackEditor : : is_selection_active ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  selection . size ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-08-06 01:15:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  AnimationTrackEditor : : is_snap_enabled ( )  const  {  
						 
					
						
							
								
									
										
										
										
											2023-06-08 23:24:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  snap - > is_pressed ( )  ^  Input : : get_singleton ( ) - > is_key_pressed ( Key : : CMD_OR_CTRL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-06 01:15:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _update_tracks ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  selected  =  _get_track_selected ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									while  ( track_vbox - > get_child_count ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										memdelete ( track_vbox - > get_child ( 0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-23 21:59:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									timeline - > set_track_edit ( nullptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									track_edits . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									groups . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( animation . is_null ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bool  file_read_only  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! animation - > get_path ( ) . is_resource_file ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  srpos  =  animation - > get_path ( ) . find ( " :: " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( srpos  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  base  =  animation - > get_path ( ) . substr ( 0 ,  srpos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ResourceLoader : : get_resource_type ( base )  = =  " PackedScene " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! get_tree ( ) - > get_edited_scene_root ( )  | |  get_tree ( ) - > get_edited_scene_root ( ) - > get_scene_file_path ( )  ! =  base )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													file_read_only  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( FileAccess : : exists ( base  +  " .import " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													file_read_only  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( FileAccess : : exists ( animation - > get_path ( )  +  " .import " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											file_read_only  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RBMap < String ,  VBoxContainer  * >  group_sort ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  use_grouping  =  ! view_group - > is_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  use_filter  =  selected_filter - > is_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  animation - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										AnimationTrackEdit  * track_edit  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Find hint and info for plugin.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( use_filter )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											NodePath  path  =  animation - > track_get_path ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( root  & &  root - > has_node ( path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Node  * node  =  root - > get_node ( path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! node )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													continue ;  // No node, no filter.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! EditorNode : : get_singleton ( ) - > get_editor_selection ( ) - > is_selected ( node ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													continue ;  // Skip track due to not selected.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( animation - > track_get_type ( i )  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											NodePath  path  =  animation - > track_get_path ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( root  & &  root - > has_node_and_resource ( path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Ref < Resource >  res ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 15:59:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												NodePath  base_path ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												Vector < StringName >  leftover_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Node  * node  =  root - > get_node_and_resource ( path ,  res ,  leftover_path ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 15:59:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												PropertyInfo  pinfo  =  _find_hint_for_track ( i ,  base_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Object  * object  =  node ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( res . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													object  =  res . ptr ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( object  & &  ! leftover_path . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( pinfo . name . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-18 15:59:13 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														pinfo . name  =  leftover_path [ leftover_path . size ( )  -  1 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( int  j  =  0 ;  j  <  track_edit_plugins . size ( ) ;  j + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 03:11:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														track_edit  =  track_edit_plugins . write [ j ] - > create_value_track_edit ( object ,  pinfo . type ,  pinfo . name ,  pinfo . hint ,  pinfo . hint_string ,  pinfo . usage ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														if  ( track_edit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( animation - > track_get_type ( i )  = =  Animation : : TYPE_AUDIO )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  j  =  0 ;  j  <  track_edit_plugins . size ( ) ;  j + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 03:11:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												track_edit  =  track_edit_plugins . write [ j ] - > create_audio_track_edit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												if  ( track_edit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( animation - > track_get_type ( i )  = =  Animation : : TYPE_ANIMATION )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											NodePath  path  =  animation - > track_get_path ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Node  * node  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											if  ( root  & &  root - > has_node ( path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												node  =  root - > get_node ( path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( node  & &  Object : : cast_to < AnimationPlayer > ( node ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  j  =  0 ;  j  <  track_edit_plugins . size ( ) ;  j + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 03:11:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													track_edit  =  track_edit_plugins . write [ j ] - > create_animation_track_edit ( node ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													if  ( track_edit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( track_edit  = =  nullptr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// No valid plugin_found.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											track_edit  =  memnew ( AnimationTrackEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edits . push_back ( track_edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( use_grouping )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											String  base_path  =  animation - > track_get_path ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											base_path  =  base_path . get_slice ( " : " ,  0 ) ;  // Remove sub-path.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! group_sort . has ( base_path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												AnimationTrackEditGroup  * g  =  memnew ( AnimationTrackEditGroup ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Ref < Texture2D >  icon  =  get_editor_theme_icon ( SNAME ( " Node " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												String  name  =  base_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												String  tooltip ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 15:30:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( root  & &  root - > has_node ( base_path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													Node  * n  =  root - > get_node ( base_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( n )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-19 22:21:30 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														icon  =  EditorNode : : get_singleton ( ) - > get_object_icon ( n ,  " Node " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														name  =  n - > get_name ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														tooltip  =  root - > get_path_to ( n ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												g - > set_type_and_name ( icon ,  name ,  animation - > track_get_path ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												g - > set_root ( root ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												g - > set_tooltip_text ( tooltip ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												g - > set_timeline ( timeline ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												groups . push_back ( g ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												VBoxContainer  * vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 10:14:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												vb - > add_theme_constant_override ( " separation " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												vb - > add_child ( g ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												track_vbox - > add_child ( vb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												group_sort [ base_path ]  =  vb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											track_edit - > set_in_group ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											group_sort [ base_path ] - > add_child ( track_edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											track_edit - > set_in_group ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											track_vbox - > add_child ( track_edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > set_timeline ( timeline ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > set_root ( root ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										track_edit - > set_animation_and_track ( animation ,  i ,  file_read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										track_edit - > set_play_position ( timeline - > get_play_position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > set_editor ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( selected  = =  i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											track_edit - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										track_edit - > connect ( " timeline_changed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _timeline_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:56:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										track_edit - > connect ( " remove_request " ,  callable_mp ( this ,  & AnimationTrackEditor : : _track_remove_request ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > connect ( " dropped " ,  callable_mp ( this ,  & AnimationTrackEditor : : _dropped_track ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > connect ( " insert_key " ,  callable_mp ( this ,  & AnimationTrackEditor : : _insert_key_from_track ) . bind ( i ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > connect ( " select_key " ,  callable_mp ( this ,  & AnimationTrackEditor : : _key_selected ) . bind ( i ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > connect ( " deselect_key " ,  callable_mp ( this ,  & AnimationTrackEditor : : _key_deselected ) . bind ( i ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										track_edit - > connect ( " move_selection_begin " ,  callable_mp ( this ,  & AnimationTrackEditor : : _move_selection_begin ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > connect ( " move_selection " ,  callable_mp ( this ,  & AnimationTrackEditor : : _move_selection ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > connect ( " move_selection_commit " ,  callable_mp ( this ,  & AnimationTrackEditor : : _move_selection_commit ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > connect ( " move_selection_cancel " ,  callable_mp ( this ,  & AnimationTrackEditor : : _move_selection_cancel ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:56:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										track_edit - > connect ( " duplicate_request " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) . bind ( EDIT_DUPLICATE_SELECTION ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > connect ( " duplicate_transpose_request " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) . bind ( EDIT_DUPLICATE_TRANSPOSED ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > connect ( " create_reset_request " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) . bind ( EDIT_ADD_RESET_KEY ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edit - > connect ( " delete_request " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) . bind ( EDIT_DELETE_SELECTION ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _redraw_tracks ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  track_edits . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										track_edits [ i ] - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _redraw_groups ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  groups . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										groups [ i ] - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _animation_changed ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( animation_changing_awaiting_update )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ;  // All will be updated, don't bother with anything.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-11 20:39:02 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_check_bezier_exist ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 19:45:30 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( key_edit )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 12:52:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( key_edit - > setting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// If editing a key, just redraw the edited track, makes refresh less costly.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( key_edit - > track  <  track_edits . size ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( animation - > track_get_type ( key_edit - > track )  = =  Animation : : TYPE_BEZIER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bezier_edit - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													track_edits [ key_edit - > track ] - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 12:52:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_update_key_edit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-14 10:19:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									animation_changing_awaiting_update  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									call_deferred ( SNAME ( " _animation_update " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _snap_mode_changed ( int  p_mode )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > set_use_fps ( p_mode  = =  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( key_edit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										key_edit - > set_use_fps ( p_mode  = =  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_update_step_spinbox ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _update_step_spinbox ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-04-15 00:49:03 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									step - > set_block_signals ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( timeline - > is_using_fps ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( animation - > get_step ( )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											step - > set_value ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											step - > set_value ( 1.0  /  animation - > get_step ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										step - > set_value ( animation - > get_step ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									step - > set_block_signals ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _animation_update ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									timeline - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									timeline - > update_values ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  same  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-11 14:07:07 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( animation . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( track_edits . size ( )  = =  animation - > get_track_count ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Check tracks are the same.
 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  track_edits . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( track_edits [ i ] - > get_path ( )  ! =  animation - > track_get_path ( i ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												same  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										same  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( same )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_redraw_groups ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_update_tracks ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bezier_edit - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_update_step_spinbox ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " animation_step_changed " ) ,  animation - > get_step ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " animation_len_changed " ) ,  animation - > get_length ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-06 10:22:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									animation_changing_awaiting_update  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								MenuButton  * AnimationTrackEditor : : get_edit_menu ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  edit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _notification ( int  p_what )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( p_what )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EditorSettings : : NOTIFICATION_EDITOR_SETTINGS_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 16:43:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											panner - > setup ( ( ViewPanner : : ControlScheme ) EDITOR_GET ( " editors/panning/animation_editors_panning_scheme " ) . operator  int ( ) ,  ED_GET_SHORTCUT ( " canvas_item_editor/pan_view " ) ,  bool ( EDITOR_GET ( " editors/panning/simple_panning " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_ENTER_TREE :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-18 16:43:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											panner - > setup ( ( ViewPanner : : ControlScheme ) EDITOR_GET ( " editors/panning/animation_editors_panning_scheme " ) . operator  int ( ) ,  ED_GET_SHORTCUT ( " canvas_item_editor/pan_view " ) ,  bool ( EDITOR_GET ( " editors/panning/simple_panning " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 11:04:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											[[fallthrough]] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_THEME_CHANGED :  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											zoom_icon - > set_texture ( get_editor_theme_icon ( SNAME ( " Zoom " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bezier_edit_icon - > set_icon ( get_editor_theme_icon ( SNAME ( " EditBezier " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											snap - > set_icon ( get_editor_theme_icon ( SNAME ( " Snap " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											view_group - > set_icon ( get_editor_theme_icon ( view_group - > is_pressed ( )  ?  SNAME ( " AnimationTrackList " )  :  SNAME ( " AnimationTrackGroup " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											selected_filter - > set_icon ( get_editor_theme_icon ( SNAME ( " AnimationFilter " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											imported_anim_warning - > set_icon ( get_editor_theme_icon ( SNAME ( " NodeWarning " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-06 20:09:32 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											main_panel - > add_theme_style_override ( " panel " ,  get_theme_stylebox ( SNAME ( " panel " ) ,  SNAME ( " Tree " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											edit - > get_popup ( ) - > set_item_icon ( edit - > get_popup ( ) - > get_item_index ( EDIT_APPLY_RESET ) ,  get_editor_theme_icon ( SNAME ( " Reload " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_READY :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > get_editor_selection ( ) - > connect ( " selection_changed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _selection_changed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 00:52:32 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  NOTIFICATION_VISIBILITY_CHANGED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											update_keying ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _update_scroll ( double )  {  
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_redraw_groups ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _update_step ( double  p_new_step )  {  
						 
					
						
							
								
									
										
										
										
											2023-04-16 11:08:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( animation . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > create_action ( TTR ( " Change Animation Step " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  step_value  =  p_new_step ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( timeline - > is_using_fps ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( step_value  ! =  0.0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											step_value  =  1.0  /  step_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-17 12:24:48 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										timeline - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_do_method ( animation . ptr ( ) ,  " set_step " ,  step_value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_undo_method ( animation . ptr ( ) ,  " set_step " ,  animation - > get_step ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									step - > set_block_signals ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									step - > set_block_signals ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " animation_step_changed " ) ,  step_value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _update_length ( double  p_new_len )  {  
						 
					
						
							
								
									
										
										
										
											2021-07-17 18:22:52 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " animation_len_changed " ) ,  p_new_len ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _dropped_track ( int  p_from_track ,  int  p_to_track )  {  
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_from_track  = =  p_to_track  | |  p_from_track  = =  p_to_track  -  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_clear_selection ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > create_action ( TTR ( " Rearrange Tracks " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_move_to " ,  p_from_track ,  p_to_track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Take into account that the position of the tracks that come after the one removed will change.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  to_track_real  =  p_to_track  >  p_from_track  ?  p_to_track  -  1  :  p_to_track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_move_to " ,  to_track_real ,  p_to_track  >  p_from_track  ?  p_from_track  :  p_from_track  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_do_method ( this ,  " _track_grab_focus " ,  to_track_real ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_undo_method ( this ,  " _track_grab_focus " ,  p_from_track ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _new_track_node_selected ( NodePath  p_path )  {  
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( root ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Node  * node  =  get_node ( p_path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-09 17:24:40 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ERR_FAIL_NULL ( node ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-19 07:23:38 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									NodePath  path_to  =  root - > get_path_to ( node ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 19:04:35 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( adding_track_type  = =  Animation : : TYPE_BLEND_SHAPE  & &  ! node - > is_class ( " MeshInstance3D " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Blend Shape tracks only apply to MeshInstance3D nodes. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ( adding_track_type  = =  Animation : : TYPE_POSITION_3D  | |  adding_track_type  = =  Animation : : TYPE_ROTATION_3D  | |  adding_track_type  = =  Animation : : TYPE_SCALE_3D )  & &  ! node - > is_class ( " Node3D " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Position/Rotation/Scale 3D tracks only apply to 3D-based nodes. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( adding_track_type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											adding_track_path  =  path_to ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											prop_selector - > set_type_filter ( Vector < Variant : : Type > ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											prop_selector - > select_property_from_instance ( node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 19:04:35 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : TYPE_BLEND_SHAPE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											adding_track_path  =  path_to ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Vector < Variant : : Type >  filter ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											filter . push_back ( Variant : : FLOAT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											prop_selector - > set_type_filter ( filter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											prop_selector - > select_property_from_instance ( node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_SCALE_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_METHOD :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Track " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " add_track " ,  adding_track_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_path " ,  animation - > get_track_count ( ) ,  path_to ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " remove_track " ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_BEZIER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Vector < Variant : : Type >  filter ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											filter . push_back ( Variant : : INT ) ; 
							 
						 
					
						
							
								
									
										
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											filter . push_back ( Variant : : FLOAT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											filter . push_back ( Variant : : VECTOR2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											filter . push_back ( Variant : : VECTOR3 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 07:02:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											filter . push_back ( Variant : : QUATERNION ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											filter . push_back ( Variant : : PLANE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											filter . push_back ( Variant : : COLOR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											adding_track_path  =  path_to ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											prop_selector - > set_type_filter ( filter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											prop_selector - > select_property_from_instance ( node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_AUDIO :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! node - > is_class ( " AudioStreamPlayer " )  & &  ! node - > is_class ( " AudioStreamPlayer2D " )  & &  ! node - > is_class ( " AudioStreamPlayer3D " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Audio tracks can only point to nodes of type: \n -AudioStreamPlayer \n -AudioStreamPlayer2D \n -AudioStreamPlayer3D " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Track " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " add_track " ,  adding_track_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_path " ,  animation - > get_track_count ( ) ,  path_to ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " remove_track " ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! node - > is_class ( " AnimationPlayer " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Animation tracks can only point to AnimationPlayer nodes. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( node  = =  AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-13 13:31:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " AnimationPlayer can't animate itself, only other players. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 13:59:29 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Track " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " add_track " ,  adding_track_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_path " ,  animation - > get_track_count ( ) ,  path_to ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " remove_track " ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _add_track ( int  p_type )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! root )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Not possible to add a new track without a root " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									adding_track_type  =  p_type ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-11 18:45:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pick_track - > popup_scenetree_dialog ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-12 16:40:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pick_track - > get_filter_line_edit ( ) - > clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									pick_track - > get_filter_line_edit ( ) - > grab_focus ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _new_track_property_selected ( String  p_name )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  full_path  =  String ( adding_track_path )  +  " : "  +  p_name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									if  ( adding_track_type  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Animation : : UpdateMode  update_mode  =  Animation : : UPDATE_DISCRETE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Hack.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											NodePath  np ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											animation - > add_track ( Animation : : TYPE_VALUE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											animation - > track_set_path ( animation - > get_track_count ( )  -  1 ,  full_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PropertyInfo  h  =  _find_hint_for_track ( animation - > get_track_count ( )  -  1 ,  np ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											animation - > remove_track ( animation - > get_track_count ( )  -  1 ) ;  // Hack.
 
							 
						 
					
						
							
								
									
										
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( h . type  = =  Variant : : FLOAT  | | 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : VECTOR2  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : RECT2  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : VECTOR3  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : AABB  | | 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-20 07:02:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													h . type  = =  Variant : : QUATERNION  | | 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : COLOR  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : PLANE  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													h . type  = =  Variant : : TRANSFORM2D  | | 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-28 03:36:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													h . type  = =  Variant : : TRANSFORM3D )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												update_mode  =  Animation : : UPDATE_CONTINUOUS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > create_action ( TTR ( " Add Track " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( animation . ptr ( ) ,  " add_track " ,  adding_track_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_path " ,  animation - > get_track_count ( ) ,  full_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( animation . ptr ( ) ,  " value_track_set_update_mode " ,  animation - > get_track_count ( ) ,  update_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( animation . ptr ( ) ,  " remove_track " ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Vector < String >  subindices ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Hack.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											NodePath  np ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											animation - > add_track ( Animation : : TYPE_VALUE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											animation - > track_set_path ( animation - > get_track_count ( )  -  1 ,  full_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PropertyInfo  h  =  _find_hint_for_track ( animation - > get_track_count ( )  -  1 ,  np ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											animation - > remove_track ( animation - > get_track_count ( )  -  1 ) ;  // Hack.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											bool  valid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											subindices  =  _get_bezier_subindices_for_type ( h . type ,  & valid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! valid )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-27 10:31:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Invalid track for Bezier (no suitable sub-properties) " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > create_action ( TTR ( " Add Bezier Track " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										int  base_track  =  animation - > get_track_count ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  subindices . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " add_track " ,  adding_track_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_path " ,  base_track  +  i ,  full_path  +  subindices [ i ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-07 14:46:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " remove_track " ,  base_track ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _timeline_value_changed ( double )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > update_play_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  track_edits . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track_edits [ i ] - > update_play_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_redraw_groups ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-13 23:21:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bezier_edit - > queue_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									bezier_edit - > update_play_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								int  AnimationTrackEditor : : _get_track_selected ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  track_edits . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( track_edits [ i ] - > has_focus ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											return  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _insert_key_from_track ( float  p_ofs ,  int  p_track )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_INDEX ( p_track ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( snap - > is_pressed ( )  & &  step - > get_value ( )  ! =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-15 13:33:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										p_ofs  =  snap_time ( p_ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( animation - > track_find_key ( p_track ,  p_ofs ,  Animation : : FIND_MODE_APPROX )  ! =  - 1 )  {  // Make sure insertion point is valid.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										p_ofs  + =  0.0001 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									switch  ( animation - > track_get_type ( p_track ) )  { 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : TYPE_POSITION_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! root - > has_node ( animation - > track_get_path ( p_track ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Track path is invalid, so can't add a key. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Node3D  * base  =  Object : : cast_to < Node3D > ( root - > get_node ( animation - > track_get_path ( p_track ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! base )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Track is not of type Node3D, can't insert key " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Vector3  pos  =  base - > get_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Position Key " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " position_track_insert_key " ,  p_track ,  p_ofs ,  pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  p_track ,  p_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ROTATION_3D :  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											if  ( ! root - > has_node ( animation - > track_get_path ( p_track ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Track path is invalid, so can't add a key. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Node3D  * base  =  Object : : cast_to < Node3D > ( root - > get_node ( animation - > track_get_path ( p_track ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! base )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-26 18:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Track is not of type Node3D, can't insert key " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Quaternion  rot  =  base - > get_transform ( ) . basis . operator  Quaternion ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Rotation Key " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " rotation_track_insert_key " ,  p_track ,  p_ofs ,  rot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  p_track ,  p_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_SCALE_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! root - > has_node ( animation - > track_get_path ( p_track ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Track path is invalid, so can't add a key. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Node3D  * base  =  Object : : cast_to < Node3D > ( root - > get_node ( animation - > track_get_path ( p_track ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! base )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Track is not of type Node3D, can't insert key " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Scale Key " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " scale_track_insert_key " ,  p_track ,  p_ofs ,  base - > get_scale ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  p_track ,  p_ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 19:04:35 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  Animation : : TYPE_BLEND_SHAPE : 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											NodePath  bp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Variant  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_find_hint_for_track ( p_track ,  bp ,  & value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Track Key " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  p_track ,  p_ofs ,  value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 22:16:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  p_track ,  p_ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_METHOD :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! root - > has_node ( animation - > track_get_path ( p_track ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Track path is invalid, so can't add a method key. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Node  * base  =  root - > get_node ( animation - > track_get_path ( p_track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											method_selector - > select_method_from_instance ( base ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											insert_key_from_track_call_ofs  =  p_ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											insert_key_from_track_call_track  =  p_track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_BEZIER :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											NodePath  bp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Variant  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_find_hint_for_track ( p_track ,  bp ,  & value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Array  arr ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 19:45:30 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											arr . resize ( 5 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											arr [ 0 ]  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											arr [ 1 ]  =  - 0.25 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											arr [ 2 ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											arr [ 3 ]  =  0.25 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											arr [ 4 ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Track Key " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  p_track ,  p_ofs ,  arr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  p_track ,  p_ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_AUDIO :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Dictionary  ak ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ak [ " stream " ]  =  Ref < Resource > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											ak [ " start_offset " ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ak [ " end_offset " ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Track Key " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  p_track ,  p_ofs ,  ak ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  p_track ,  p_ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  Animation : : TYPE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											StringName  anim  =  " [stop] " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Track Key " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  p_track ,  p_ofs ,  anim ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  p_track ,  p_ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _add_method_key ( const  String  & p_method )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! root - > has_node ( animation - > track_get_path ( insert_key_from_track_call_track ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Track path is invalid, so can't add a method key. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * base  =  root - > get_node ( animation - > track_get_path ( insert_key_from_track_call_track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									List < MethodInfo >  minfo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									base - > get_method_list ( & minfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-24 15:46:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( const  MethodInfo  & E  :  minfo )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( E . name  = =  p_method )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											Dictionary  d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											d [ " method " ]  =  p_method ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Array  params ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  first_defarg  =  E . arguments . size ( )  -  E . default_arguments . size ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  E . arguments . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												if  ( i  > =  first_defarg )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Variant  arg  =  E . default_arguments [ i  -  first_defarg ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													params . push_back ( arg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-19 16:27:19 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Callable : : CallError  ce ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-09 00:19:09 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Variant  arg ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Variant : : construct ( E . arguments [ i ] . type ,  arg ,  nullptr ,  0 ,  ce ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													params . push_back ( arg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											d [ " args " ]  =  params ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Add Method Track Key " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  insert_key_from_track_call_track ,  insert_key_from_track_call_ofs ,  d ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  insert_key_from_track_call_track ,  insert_key_from_track_call_ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-06-08 11:42:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Method not found in object: " )  +  "   "  +  p_method ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-10 17:57:08 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _key_selected ( int  p_key ,  bool  p_single ,  int  p_track )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_INDEX ( p_track ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_INDEX ( p_key ,  animation - > track_get_key_count ( p_track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SelectedKey  sk ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sk . key  =  p_key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sk . track  =  p_track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_single )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_clear_selection ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									KeyInfo  ki ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ki . pos  =  animation - > track_get_key_time ( p_track ,  p_key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									selection [ sk ]  =  ki ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									_update_key_edit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _key_deselected ( int  p_key ,  int  p_track )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_INDEX ( p_track ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_INDEX ( p_key ,  animation - > track_get_key_count ( p_track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SelectedKey  sk ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sk . key  =  p_key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sk . track  =  p_track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									selection . erase ( sk ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									_update_key_edit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _move_selection_begin ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									moving_selection  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									moving_selection_offset  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _move_selection ( float  p_offset )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									moving_selection_offset  =  p_offset ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								struct  _AnimMoveRestore  {  
						 
					
						
							
								
									
										
										
										
											2020-11-24 10:12:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  track  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  time  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Variant  key ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-24 10:12:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  transition  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Used for undo/redo.
  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _clear_key_edit ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( key_edit )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// If key edit is the object being inspected, remove it first.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 21:08:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( InspectorDock : : get_inspector_singleton ( ) - > get_edited_object ( )  = =  key_edit )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > push_item ( nullptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 19:21:26 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Then actually delete it.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-24 11:16:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										memdelete ( key_edit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										key_edit  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-24 11:16:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( multi_key_edit )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-17 21:08:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( InspectorDock : : get_inspector_singleton ( ) - > get_edited_object ( )  = =  multi_key_edit )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorNode : : get_singleton ( ) - > push_item ( nullptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-24 11:16:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										memdelete ( multi_key_edit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										multi_key_edit  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 22:16:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _clear_selection ( bool  p_update )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									selection . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 22:16:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( p_update )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-13 22:16:53 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									_clear_key_edit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _update_key_edit ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_clear_key_edit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( selection . size ( )  = =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										key_edit  =  memnew ( AnimationTrackKeyEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										key_edit - > animation  =  animation ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										key_edit - > animation_read_only  =  read_only ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										key_edit - > track  =  selection . front ( ) - > key ( ) . track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										key_edit - > use_fps  =  timeline - > is_using_fps ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 12:52:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  key_id  =  selection . front ( ) - > key ( ) . key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( key_id  > =  animation - > track_get_key_count ( key_edit - > track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_clear_key_edit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ;  // Probably in the process of rearranging the keys.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  ofs  =  animation - > track_get_key_time ( key_edit - > track ,  key_id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										key_edit - > key_ofs  =  ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										key_edit - > root_path  =  root ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										NodePath  np ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										key_edit - > hint  =  _find_hint_for_track ( key_edit - > track ,  np ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										key_edit - > base  =  np ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorNode : : get_singleton ( ) - > push_item ( key_edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  if  ( selection . size ( )  >  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										multi_key_edit  =  memnew ( AnimationMultiTrackKeyEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										multi_key_edit - > animation  =  animation ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										multi_key_edit - > animation_read_only  =  read_only ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RBMap < int ,  List < float > >  key_ofs_map ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RBMap < int ,  NodePath >  base_map ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  first_track  =  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 14:13:42 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( const  KeyValue < SelectedKey ,  KeyInfo >  & E  :  selection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  track  =  E . key . track ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( first_track  <  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												first_track  =  track ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! key_ofs_map . has ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												key_ofs_map [ track ]  =  List < float > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-24 11:16:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												base_map [ track ]  =  NodePath ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 12:52:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  key_id  =  E . key . key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( key_id  > =  animation - > track_get_key_count ( track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												_clear_key_edit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ;  // Probably in the process of rearranging the keys.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 14:13:42 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											key_ofs_map [ track ] . push_back ( animation - > track_get_key_time ( track ,  E . key . key ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										multi_key_edit - > key_ofs_map  =  key_ofs_map ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										multi_key_edit - > base_map  =  base_map ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										multi_key_edit - > hint  =  _find_hint_for_track ( first_track ,  base_map [ first_track ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										multi_key_edit - > use_fps  =  timeline - > is_using_fps ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										multi_key_edit - > root_path  =  root ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EditorNode : : get_singleton ( ) - > push_item ( multi_key_edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _clear_selection_for_anim ( const  Ref < Animation >  & p_anim )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( animation  ! =  p_anim )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									_clear_selection ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _select_at_anim ( const  Ref < Animation >  & p_anim ,  int  p_track ,  float  p_pos )  {  
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( animation  ! =  p_anim )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  idx  =  animation - > track_find_key ( p_track ,  p_pos ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ERR_FAIL_COND ( idx  <  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									SelectedKey  sk ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sk . track  =  p_track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sk . key  =  idx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									KeyInfo  ki ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ki . pos  =  p_pos ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									selection . insert ( sk ,  ki ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 12:52:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_update_key_edit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _move_selection_commit ( )  {  
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-10 21:45:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > create_action ( TTR ( " Animation Move Keys " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									List < _AnimMoveRestore >  to_restore ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  motion  =  moving_selection_offset ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// 1 - remove the keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_remove_key " ,  E - > key ( ) . track ,  E - > key ( ) . key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// 2 - Remove overlapped keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-09 12:35:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  newtime  =  snap_time ( E - > get ( ) . pos  +  motion ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  idx  =  animation - > track_find_key ( E - > key ( ) . track ,  newtime ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( idx  = =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										SelectedKey  sk ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sk . key  =  idx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sk . track  =  E - > key ( ) . track ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( selection . has ( sk ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue ;  // Already in selection, don't save.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  E - > key ( ) . track ,  newtime ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										_AnimMoveRestore  amr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										amr . key  =  animation - > track_get_key_value ( E - > key ( ) . track ,  idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										amr . track  =  E - > key ( ) . track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										amr . time  =  newtime ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										amr . transition  =  animation - > track_get_key_transition ( E - > key ( ) . track ,  idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										to_restore . push_back ( amr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// 3 - Move the keys (Reinsert them).
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-09 12:35:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  newpos  =  snap_time ( E - > get ( ) . pos  +  motion ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  E - > key ( ) . track ,  newpos ,  animation - > track_get_key_value ( E - > key ( ) . track ,  E - > key ( ) . key ) ,  animation - > track_get_key_transition ( E - > key ( ) . track ,  E - > key ( ) . key ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// 4 - (Undo) Remove inserted keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-09 12:35:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  newpos  =  snap_time ( E - > get ( ) . pos  +  motion ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  E - > key ( ) . track ,  newpos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// 5 - (Undo) Reinsert keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_insert_key " ,  E - > key ( ) . track ,  E - > get ( ) . pos ,  animation - > track_get_key_value ( E - > key ( ) . track ,  E - > key ( ) . key ) ,  animation - > track_get_key_transition ( E - > key ( ) . track ,  E - > key ( ) . key ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// 6 - (Undo) Reinsert overlapped keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( _AnimMoveRestore  & amr  :  to_restore )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_insert_key " ,  amr . track ,  amr . time ,  amr . key ,  amr . transition ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_do_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_undo_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// 7 - Reselect.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										float  oldpos  =  E - > get ( ) . pos ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-09 12:35:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  newpos  =  snap_time ( oldpos  +  motion ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-22 03:43:40 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( this ,  " _select_at_anim " ,  animation ,  E - > key ( ) . track ,  newpos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( this ,  " _select_at_anim " ,  animation ,  E - > key ( ) . track ,  oldpos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									moving_selection  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > add_do_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_undo_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _move_selection_cancel ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									moving_selection  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  AnimationTrackEditor : : is_moving_selection ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  moving_selection ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								float  AnimationTrackEditor : : get_moving_selection_offset ( )  const  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  moving_selection_offset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _box_selection_draw ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-08-15 22:17:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  Rect2  selection_rect  =  Rect2 ( Point2 ( ) ,  box_selection - > get_size ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									box_selection - > draw_rect ( selection_rect ,  get_theme_color ( SNAME ( " box_selection_fill_color " ) ,  EditorStringName ( Editor ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									box_selection - > draw_rect ( selection_rect ,  get_theme_color ( SNAME ( " box_selection_stroke_color " ) ,  EditorStringName ( Editor ) ) ,  false ,  Math : : round ( EDSCALE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _scroll_input ( const  Ref < InputEvent >  & p_event )  {  
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( panner - > gui_input ( p_event ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										scroll - > accept_event ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Ref < InputEventMouseButton >  mb  =  p_event ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mb . is_valid ( )  & &  mb - > get_button_index ( )  = =  MouseButton : : LEFT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  ( mb - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											box_selecting  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											box_selecting_from  =  scroll - > get_global_transform ( ) . xform ( mb - > get_position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											box_select_rect  =  Rect2 ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( box_selecting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( box_selection - > is_visible_in_tree ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												// Only if moved.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  track_edits . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Rect2  local_rect  =  box_select_rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													local_rect . position  - =  track_edits [ i ] - > get_global_position ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-02 12:37:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													track_edits [ i ] - > append_to_selection ( local_rect ,  mb - > is_command_or_control_pressed ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( _get_track_selected ( )  = =  - 1  & &  track_edits . size ( )  >  0 )  {  // Minimal hack to make shortcuts work.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													track_edits [ track_edits . size ( )  -  1 ] - > grab_focus ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												_clear_selection ( true ) ;  // Clear it.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											box_selection - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											box_selecting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < InputEventMouseMotion >  mm  =  p_event ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( mm . is_valid ( )  & &  box_selecting )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-08 00:55:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! mm - > get_button_mask ( ) . has_flag ( MouseButtonMask : : LEFT ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// No longer.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											box_selection - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											box_selecting  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! box_selection - > is_visible_in_tree ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-02 12:37:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! mm - > is_command_or_control_pressed ( )  & &  ! mm - > is_shift_pressed ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												_clear_selection ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											box_selection - > show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Vector2  from  =  box_selecting_from ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Vector2  to  =  scroll - > get_global_transform ( ) . xform ( mm - > get_position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( from . x  >  to . x )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											SWAP ( from . x ,  to . x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( from . y  >  to . y )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											SWAP ( from . y ,  to . y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Rect2  rect ( from ,  to  -  from ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Rect2  scroll_rect  =  Rect2 ( scroll - > get_global_position ( ) ,  scroll - > get_size ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-19 12:43:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										rect  =  scroll_rect . intersection ( rect ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										box_selection - > set_position ( rect . position ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										box_selection - > set_size ( rect . size ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										box_select_rect  =  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-09 10:05:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _toggle_bezier_edit ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( bezier_edit - > is_visible ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_cancel_bezier_edit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  track_count  =  animation - > get_track_count ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  track_count ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( animation - > track_get_type ( i )  = =  Animation : : TrackType : : TYPE_BEZIER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												_bezier_edit ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-19 17:50:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _pan_callback ( Vector2  p_scroll_vec ,  Ref < InputEvent >  p_event )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < InputEventWithModifiers >  iewm  =  p_event ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( iewm . is_valid ( )  & &  iewm - > is_alt_pressed ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-23 13:49:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p_scroll_vec . x  <  0  | |  p_scroll_vec . y  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											goto_prev_step ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											goto_next_step ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-19 17:50:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										timeline - > set_value ( timeline - > get_value ( )  -  p_scroll_vec . x  /  timeline - > get_zoom_scale ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										scroll - > set_v_scroll ( scroll - > get_v_scroll ( )  -  p_scroll_vec . y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-23 13:49:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-19 17:50:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _zoom_callback ( float  p_zoom_factor ,  Vector2  p_origin ,  Ref < InputEvent >  p_event )  {  
						 
					
						
							
								
									
										
										
										
											2022-02-12 23:31:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									double  current_zoom_value  =  timeline - > get_zoom ( ) - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-19 17:50:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									timeline - > get_zoom ( ) - > set_value ( MAX ( 0.01 ,  current_zoom_value  *  p_zoom_factor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _cancel_bezier_edit ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scroll - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-09 10:05:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bezier_edit_icon - > set_pressed ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _bezier_edit ( int  p_for_track )  {  
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									_clear_selection ( ) ;  // Bezier probably wants to use a separate selection mode.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									bezier_edit - > set_root ( root ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-04 01:17:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bezier_edit - > set_animation_and_track ( animation ,  p_for_track ,  read_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									scroll - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit - > show ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Search everything within the track and curve - edit it.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 19:45:30 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _bezier_track_set_key_handle_mode ( Animation  * p_anim ,  int  p_track ,  int  p_index ,  Animation : : HandleMode  p_mode ,  Animation : : HandleSetMode  p_set_mode )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! p_anim )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									p_anim - > bezier_track_set_key_handle_mode ( p_track ,  p_index ,  p_mode ,  p_set_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _anim_duplicate_keys ( bool  transpose )  {  
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Duplicait!
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									if  ( selection . size ( )  & &  animation . is_valid ( )  & &  ( ! transpose  | |  ( _get_track_selected ( )  > =  0  & &  _get_track_selected ( )  <  animation - > get_track_count ( ) ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  top_track  =  0x7FFFFFFF ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  top_time  =  1e10 ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											const  SelectedKey  & sk  =  E - > key ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  t  =  animation - > track_get_key_time ( sk . track ,  sk . key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( t  <  top_time )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												top_time  =  t ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( sk . track  <  top_track )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												top_track  =  sk . track ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ERR_FAIL_COND ( top_track  = =  0x7FFFFFFF  | |  top_time  = =  1e10 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										//
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  start_track  =  transpose  ?  _get_track_selected ( )  :  top_track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-10 21:45:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > create_action ( TTR ( " Animation Duplicate Keys " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-17 07:33:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										List < Pair < int ,  float > >  new_selection_values ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											const  SelectedKey  & sk  =  E - > key ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  t  =  animation - > track_get_key_time ( sk . track ,  sk . key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  dst_time  =  t  +  ( timeline - > get_play_position ( )  -  top_time ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  dst_track  =  sk . track  +  ( start_track  -  top_track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( dst_track  <  0  | |  dst_track  > =  animation - > get_track_count ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( animation - > track_get_type ( dst_track )  ! =  animation - > track_get_type ( sk . track ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											int  existing_idx  =  animation - > track_find_key ( dst_track ,  dst_time ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  dst_track ,  dst_time ,  animation - > track_get_key_value ( E - > key ( ) . track ,  E - > key ( ) . key ) ,  animation - > track_get_key_transition ( E - > key ( ) . track ,  E - > key ( ) . key ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  dst_track ,  dst_time ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Pair < int ,  float >  p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p . first  =  dst_track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p . second  =  dst_time ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											new_selection_values . push_back ( p ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( existing_idx  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_insert_key " ,  dst_track ,  dst_time ,  animation - > track_get_key_value ( dst_track ,  existing_idx ) ,  animation - > track_get_key_transition ( dst_track ,  existing_idx ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Reselect duplicated.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RBMap < SelectedKey ,  KeyInfo >  new_selection ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-24 15:46:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( const  Pair < int ,  float >  & E  :  new_selection_values )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _select_at_anim " ,  animation ,  E . first ,  E . second ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _select_at_anim " ,  animation ,  E - > key ( ) . track ,  E - > get ( ) . pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2020-05-14 14:29:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _edit_menu_about_to_popup ( )  {  
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									AnimationPlayer  * player  =  AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > set_item_disabled ( edit - > get_popup ( ) - > get_item_index ( EDIT_APPLY_RESET ) ,  ! player - > can_apply_reset ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : goto_prev_step ( bool  p_from_mouse_event )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( animation . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  anim_step  =  animation - > get_step ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( anim_step  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										anim_step  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_from_mouse_event  & &  Input : : get_singleton ( ) - > is_key_pressed ( Key : : SHIFT ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Use more precise snapping when holding Shift.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// This is used when scrobbling the timeline using Alt + Mouse wheel.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										anim_step  * =  0.25 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  pos  =  timeline - > get_play_position ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pos  =  Math : : snapped ( pos  -  anim_step ,  anim_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( pos  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										pos  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_anim_pos ( pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-23 13:49:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " timeline_changed " ) ,  pos ,  true ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-23 15:32:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : goto_next_step ( bool  p_from_mouse_event ,  bool  p_timeline_only )  {  
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( animation . is_null ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  anim_step  =  animation - > get_step ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( anim_step  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										anim_step  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( p_from_mouse_event  & &  Input : : get_singleton ( ) - > is_key_pressed ( Key : : SHIFT ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Use more precise snapping when holding Shift.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// This is used when scrobbling the timeline using Alt + Mouse wheel.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Do not use precise snapping when using the menu action or keyboard shortcut,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// as the default keyboard shortcut requires pressing Shift.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										anim_step  * =  0.25 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  pos  =  timeline - > get_play_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pos  =  Math : : snapped ( pos  +  anim_step ,  anim_step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( pos  >  animation - > get_length ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										pos  =  animation - > get_length ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_anim_pos ( pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-23 15:32:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									emit_signal ( SNAME ( " timeline_changed " ) ,  pos ,  true ,  p_timeline_only ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _edit_menu_pressed ( int  p_option )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									last_menu_track_opt  =  p_option ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch  ( p_option )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_COPY_TRACKS :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											track_copy_select - > clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											TreeItem  * troot  =  track_copy_select - > create_item ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  animation - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												NodePath  path  =  animation - > track_get_path ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Node  * node  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( root  & &  root - > has_node ( path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													node  =  root - > get_node ( path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												String  text ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Ref < Texture2D >  icon  =  get_editor_theme_icon ( SNAME ( " Node " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												if  ( node )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( has_theme_icon ( node - > get_class ( ) ,  EditorStringName ( EditorIcons ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														icon  =  get_editor_theme_icon ( node - > get_class ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													text  =  node - > get_name ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Vector < StringName >  sn  =  path . get_subnames ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-12 21:10:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( int  j  =  0 ;  j  <  sn . size ( ) ;  j + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														text  + =  " . " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-12 21:10:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														text  + =  sn [ j ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													path  =  NodePath ( node - > get_path ( ) . get_names ( ) ,  path . get_subnames ( ) ,  true ) ;  // Store full path instead for copying.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													text  =  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  sep  =  text . find ( " : " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( sep  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														text  =  text . substr ( sep  +  1 ,  text . length ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-07 21:50:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												String  track_type ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												switch  ( animation - > track_get_type ( i ) )  { 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-07 21:50:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														track_type  =  TTR ( " Position " ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-07 21:50:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														track_type  =  TTR ( " Rotation " ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Remove animation 3D transform track, replace by loc/rot/scale tracks.
* `Animation.TYPE_TRANSFORM3D` track is gone.
* Added POSITION_3D, ROTATION_3D, SCALE_3D tracks.
* GLTF2, Collada, FBX importers will only import the track types found.
* Skeleton3D bone poses are now Pos/Rot/Scale, pose matrix removed.
* AnimationPlayer and AnimationTree animate these tracks separately, only when found.
* Removed BakeReset code, is useless with these changes.
This is the first in a series of commits designed to make the animation system in Godot more useful, which includes:
* Better compatibility with Autodesk products
* Better reusability of animations across models (including retargeting).
* Proper animation compression.
* etc.
*Note* GLTF2 animation saving went broken with this PR, needs to be fixed in a subsequent one.
											 
										 
										
											2021-10-11 19:20:58 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_SCALE_3D : 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-07 21:50:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														track_type  =  TTR ( " Scale " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-10 13:00:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 19:04:35 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													case  Animation : : TYPE_BLEND_SHAPE : 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-07 21:50:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														track_type  =  TTR ( " BlendShape " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-15 19:04:35 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-10 13:00:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													case  Animation : : TYPE_METHOD : 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-07 21:50:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														track_type  =  TTR ( " Methods " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-10 13:00:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_BEZIER : 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-07 21:50:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														track_type  =  TTR ( " Bezier " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-10 13:00:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_AUDIO : 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-07 21:50:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														track_type  =  TTR ( " Audio " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-10 13:00:47 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-09 12:35:49 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-07 21:50:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ! track_type . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													text  + =  vformat ( "  (%s) " ,  track_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TreeItem  * it  =  track_copy_select - > create_item ( troot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												it - > set_editable ( 0 ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												it - > set_selectable ( 0 ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												it - > set_cell_mode ( 0 ,  TreeItem : : CELL_MODE_CHECK ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												it - > set_icon ( 0 ,  icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												it - > set_text ( 0 ,  text ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Dictionary  md ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												md [ " track_idx " ]  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												md [ " path " ]  =  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												it - > set_metadata ( 0 ,  md ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-06 14:00:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											track_copy_dialog - > popup_centered ( Size2 ( 350 ,  500 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_COPY_TRACKS_CONFIRM :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											track_clipboard . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											TreeItem  * tree_root  =  track_copy_select - > get_root ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( tree_root )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TreeItem  * it  =  tree_root - > get_first_child ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												while  ( it )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Dictionary  md  =  it - > get_metadata ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  idx  =  md [ " track_idx " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( it - > is_checked ( 0 )  & &  idx  > =  0  & &  idx  <  animation - > get_track_count ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														TrackClipboard  tc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														tc . base_path  =  animation - > track_get_path ( idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														tc . full_path  =  md [ " path " ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														tc . track_type  =  animation - > track_get_type ( idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														tc . interp_type  =  animation - > track_get_interpolation_type ( idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( tc . track_type  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															tc . update_mode  =  animation - > value_track_get_update_mode ( idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( tc . track_type  = =  Animation : : TYPE_AUDIO )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															tc . use_blend  =  animation - > audio_track_is_use_blend ( idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														tc . loop_wrap  =  animation - > track_get_interpolation_loop_wrap ( idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														tc . enabled  =  animation - > track_is_enabled ( idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														for  ( int  i  =  0 ;  i  <  animation - > track_get_key_count ( idx ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															TrackClipboard : : Key  k ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															k . time  =  animation - > track_get_key_time ( idx ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															k . value  =  animation - > track_get_key_value ( idx ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															k . transition  =  animation - > track_get_key_transition ( idx ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															tc . keys . push_back ( k ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														track_clipboard . push_back ( tc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													it  =  it - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_PASTE_TRACKS :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( track_clipboard . size ( )  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-13 13:31:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " Clipboard is empty! " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  base_track  =  animation - > get_track_count ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 16:41:01 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Paste Tracks " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  track_clipboard . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " add_track " ,  track_clipboard [ i ] . track_type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Node  * exists  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												NodePath  path  =  track_clipboard [ i ] . base_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( root )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													NodePath  np  =  track_clipboard [ i ] . full_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													exists  =  root - > get_node ( np ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( exists )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														path  =  NodePath ( root - > get_path_to ( exists ) . get_names ( ) ,  track_clipboard [ i ] . full_path . get_subnames ( ) ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_path " ,  base_track ,  path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_interpolation_type " ,  base_track ,  track_clipboard [ i ] . interp_type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_interpolation_loop_wrap " ,  base_track ,  track_clipboard [ i ] . loop_wrap ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_enabled " ,  base_track ,  track_clipboard [ i ] . enabled ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( track_clipboard [ i ] . track_type  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( animation . ptr ( ) ,  " value_track_set_update_mode " ,  base_track ,  track_clipboard [ i ] . update_mode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-28 03:25:49 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( track_clipboard [ i ] . track_type  = =  Animation : : TYPE_AUDIO )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( animation . ptr ( ) ,  " audio_track_set_use_blend " ,  base_track ,  track_clipboard [ i ] . use_blend ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  j  =  0 ;  j  <  track_clipboard [ i ] . keys . size ( ) ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  base_track ,  track_clipboard [ i ] . keys [ j ] . time ,  track_clipboard [ i ] . keys [ j ] . value ,  track_clipboard [ i ] . keys [ j ] . transition ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " remove_track " ,  animation - > get_track_count ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												base_track + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_SCALE_SELECTION : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_SCALE_FROM_CURSOR :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											scale_dialog - > popup_centered ( Size2 ( 200 ,  100 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_SCALE_CONFIRM :  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-15 12:04:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( selection . is_empty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  from_t  =  1e20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  to_t  =  - 1e20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  len  =  - 1e20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  pivot  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 14:13:42 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( const  KeyValue < SelectedKey ,  KeyInfo >  & E  :  selection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  t  =  animation - > track_get_key_time ( E . key . track ,  E . key . key ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( t  <  from_t )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													from_t  =  t ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( t  >  to_t )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													to_t  =  t ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											len  =  to_t  -  from_t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( last_menu_track_opt  = =  EDIT_SCALE_FROM_CURSOR )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												pivot  =  timeline - > get_play_position ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												pivot  =  from_t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  s  =  scale - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-25 12:52:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ERR_FAIL_COND_MSG ( s  = =  0 ,  " Can't scale to 0. " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-10 21:45:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Animation Scale Keys " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											List < _AnimMoveRestore >  to_restore ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// 1 - Remove the keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_remove_key " ,  E - > key ( ) . track ,  E - > key ( ) . key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// 2 - Remove overlapped keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												float  newtime  =  ( E - > get ( ) . pos  -  from_t )  *  s  +  from_t ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												int  idx  =  animation - > track_find_key ( E - > key ( ) . track ,  newtime ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( idx  = =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												SelectedKey  sk ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sk . key  =  idx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sk . track  =  E - > key ( ) . track ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( selection . has ( sk ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													continue ;  // Already in selection, don't save.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  E - > key ( ) . track ,  newtime ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												_AnimMoveRestore  amr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												amr . key  =  animation - > track_get_key_value ( E - > key ( ) . track ,  idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												amr . track  =  E - > key ( ) . track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												amr . time  =  newtime ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												amr . transition  =  animation - > track_get_key_transition ( E - > key ( ) . track ,  idx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												to_restore . push_back ( amr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 19:28:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# define NEW_POS(m_ofs) (((s > 0) ? m_ofs : from_t + (len - (m_ofs - from_t))) - pivot) * ABS(s) + from_t 
  
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// 3 - Move the keys (re insert them).
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 19:28:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												float  newpos  =  NEW_POS ( E - > get ( ) . pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  E - > key ( ) . track ,  newpos ,  animation - > track_get_key_value ( E - > key ( ) . track ,  E - > key ( ) . key ) ,  animation - > track_get_key_transition ( E - > key ( ) . track ,  E - > key ( ) . key ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// 4 - (Undo) Remove inserted keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 19:28:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												float  newpos  =  NEW_POS ( E - > get ( ) . pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-05 13:34:39 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  E - > key ( ) . track ,  newpos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// 5 - (Undo) Reinsert keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_insert_key " ,  E - > key ( ) . track ,  E - > get ( ) . pos ,  animation - > track_get_key_value ( E - > key ( ) . track ,  E - > key ( ) . key ) ,  animation - > track_get_key_transition ( E - > key ( ) . track ,  E - > key ( ) . key ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// 6 - (Undo) Reinsert overlapped keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-15 23:45:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( _AnimMoveRestore  & amr  :  to_restore )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_insert_key " ,  amr . track ,  amr . time ,  amr . key ,  amr . transition ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// 7-reselect.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												float  oldpos  =  E - > get ( ) . pos ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 19:28:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												float  newpos  =  NEW_POS ( oldpos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( newpos  > =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( this ,  " _select_at_anim " ,  animation ,  E - > key ( ) . track ,  newpos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _select_at_anim " ,  animation ,  E - > key ( ) . track ,  oldpos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-09 19:28:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# undef NEW_POS 
  
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_EASE_SELECTION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ease_dialog - > popup_centered ( Size2 ( 200 ,  100 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_EASE_CONFIRM :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Make Easing Keys " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Tween : : TransitionType  transition_type  =  static_cast < Tween : : TransitionType > ( transition_selection - > get_selected_id ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Tween : : EaseType  ease_type  =  static_cast < Tween : : EaseType > ( ease_selection - > get_selected_id ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  fps  =  ease_fps - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											double  dur_step  =  1.0  /  fps ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Organize track and key.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											HashMap < int ,  Vector < int > >  keymap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Vector < int >  tracks ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( const  KeyValue < SelectedKey ,  KeyInfo >  & E  :  selection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! tracks . has ( E . key . track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													tracks . append ( E . key . track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  tracks . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												switch  ( animation - > track_get_type ( tracks [ i ] ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_VALUE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_POSITION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_ROTATION_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_SCALE_3D : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  Animation : : TYPE_BLEND_SHAPE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Vector < int >  keys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														for  ( const  KeyValue < SelectedKey ,  KeyInfo >  & E  :  selection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( E . key . track  = =  tracks [ i ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																keys . append ( E . key . key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														keys . sort ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														keymap . insert ( tracks [ i ] ,  keys ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Make easing.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											HashMap < int ,  Vector < int > > : : Iterator  E  =  keymap . begin ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											while  ( E )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  track  =  E - > key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Vector < int >  keys  =  E - > value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  len  =  keys . size ( )  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-26 11:42:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												// Special case for angle interpolation.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												bool  is_using_angle  =  animation - > track_get_interpolation_type ( track )  = =  Animation : : INTERPOLATION_LINEAR_ANGLE  | |  animation - > track_get_interpolation_type ( track )  = =  Animation : : INTERPOLATION_CUBIC_ANGLE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												// Make insert queue.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												Vector < Pair < real_t ,  Variant > >  insert_queue_new ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  len ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Check neighboring keys.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( keys [ i ]  +  1  = =  keys [ i  +  1 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														double  from_t  =  animation - > track_get_key_time ( track ,  keys [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														double  to_t  =  animation - > track_get_key_time ( track ,  keys [ i  +  1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Variant  from_v  =  animation - > track_get_key_value ( track ,  keys [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														Variant  to_v  =  animation - > track_get_key_value ( track ,  keys [ i  +  1 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-26 11:42:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( is_using_angle )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															real_t  a  =  from_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															real_t  b  =  to_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															real_t  to_diff  =  fmod ( b  -  a ,  Math_TAU ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															to_v  =  a  +  fmod ( 2.0  *  to_diff ,  Math_TAU )  -  to_diff ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-06 12:24:06 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														Variant  delta_v  =  Animation : : subtract_variant ( to_v ,  from_v ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														double  duration  =  to_t  -  from_t ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-06 12:24:06 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														double  fixed_duration  =  duration  -  UNIT_EPSILON ;  // Prevent to overwrap keys...
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														for  ( double  delta_t  =  dur_step ;  delta_t  <  fixed_duration ;  delta_t  + =  dur_step )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															Pair < real_t ,  Variant >  keydata ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															keydata . first  =  from_t  +  delta_t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															keydata . second  =  Tween : : interpolate_variant ( from_v ,  delta_v ,  delta_t ,  duration ,  transition_type ,  ease_type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															insert_queue_new . append ( keydata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Do insertion.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  insert_queue_new . size ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  track ,  insert_queue_new [ i ] . first ,  insert_queue_new [ i ] . second ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  track ,  insert_queue_new [ i ] . first ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												+ + E ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_update_key_edit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  EDIT_DUPLICATE_SELECTION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( bezier_edit - > is_visible ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												bezier_edit - > duplicate_selection ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_anim_duplicate_keys ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_DUPLICATE_TRANSPOSED :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( bezier_edit - > is_visible ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												EditorNode : : get_singleton ( ) - > show_warning ( TTR ( " This option does not work for Bezier editing, as it's only a single track. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_anim_duplicate_keys ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  EDIT_ADD_RESET_KEY :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-10 21:45:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Animation Add RESET Keys " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Ref < Animation >  reset  =  _create_and_get_reset_animation ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  reset_tracks  =  reset - > get_track_count ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-19 17:00:06 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											HashSet < int >  tracks_added ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( const  KeyValue < SelectedKey ,  KeyInfo >  & E  :  selection )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  SelectedKey  & sk  =  E . key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// Only add one key per track.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( tracks_added . has ( sk . track ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												tracks_added . insert ( sk . track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  dst_track  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  NodePath  & path  =  animation - > track_get_path ( sk . track ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  ( int  i  =  0 ;  i  <  reset - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( reset - > track_get_path ( i )  = =  path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														dst_track  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 17:36:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												int  existing_idx  =  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( dst_track  = =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// If adding multiple tracks, make sure that correct track is referenced.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													dst_track  =  reset_tracks ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													reset_tracks + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( reset . ptr ( ) ,  " add_track " ,  animation - > track_get_type ( sk . track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( reset . ptr ( ) ,  " track_set_path " ,  dst_track ,  path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_undo_method ( reset . ptr ( ) ,  " remove_track " ,  dst_track ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 17:36:25 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													existing_idx  =  reset - > track_find_key ( dst_track ,  0 ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( reset . ptr ( ) ,  " track_insert_key " ,  dst_track ,  0 ,  animation - > track_get_key_value ( sk . track ,  sk . key ) ,  animation - > track_get_key_transition ( sk . track ,  sk . key ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( reset . ptr ( ) ,  " track_remove_key_at_time " ,  dst_track ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( existing_idx  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_undo_method ( reset . ptr ( ) ,  " track_insert_key " ,  dst_track ,  0 ,  reset - > track_get_key_value ( dst_track ,  existing_idx ) ,  reset - > track_get_key_transition ( dst_track ,  existing_idx ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  EDIT_DELETE_SELECTION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( bezier_edit - > is_visible ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												bezier_edit - > delete_selection ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( selection . size ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-10 21:45:03 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												undo_redo - > create_action ( TTR ( " Animation Delete Keys " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-13 15:04:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( RBMap < SelectedKey ,  KeyInfo > : : Element  * E  =  selection . back ( ) ;  E ;  E  =  E - > prev ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_remove_key " ,  E - > key ( ) . track ,  E - > key ( ) . key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_insert_key " ,  E - > key ( ) . track ,  E - > get ( ) . pos ,  animation - > track_get_key_value ( E - > key ( ) . track ,  E - > key ( ) . key ) ,  animation - > track_get_key_transition ( E - > key ( ) . track ,  E - > key ( ) . key ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												undo_redo - > add_do_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												undo_redo - > add_undo_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												_update_key_edit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-23 15:32:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY : 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  EDIT_GOTO_NEXT_STEP :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-23 15:32:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											goto_next_step ( false ,  p_option  = =  EDIT_GOTO_NEXT_STEP_TIMELINE_ONLY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_GOTO_PREV_STEP :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-10 01:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											goto_prev_step ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  EDIT_APPLY_RESET :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) - > apply_reset ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_BAKE_ANIMATION :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bake_dialog - > popup_centered ( Size2 ( 200 ,  100 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  EDIT_BAKE_ANIMATION_CONFIRM :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-12 18:15:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > create_action ( TTR ( " Bake Animation as Linear Keys " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											int  track_len  =  animation - > get_track_count ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  b_trs  =  bake_trs - > is_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  b_bs  =  bake_blendshape - > is_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bool  b_v  =  bake_value - > is_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											double  anim_len  =  animation - > get_length ( )  +  CMP_EPSILON ;  // For end key.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											float  fps  =  bake_fps - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											double  dur_step  =  1.0  /  fps ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( int  i  =  0 ;  i  <  track_len ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												bool  do_bake  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Animation : : TrackType  type  =  animation - > track_get_type ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												do_bake  | =  b_trs  & &  ( type  = =  Animation : : TYPE_POSITION_3D  | |  type  = =  Animation : : TYPE_ROTATION_3D  | |  type  = =  Animation : : TYPE_SCALE_3D ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												do_bake  | =  b_bs  & &  type  = =  Animation : : TYPE_BLEND_SHAPE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												do_bake  | =  b_v  & &  type  = =  Animation : : TYPE_VALUE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( do_bake  & &  ! animation - > track_is_compressed ( i ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-26 11:42:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Animation : : InterpolationType  it  =  animation - > track_get_interpolation_type ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( it  = =  Animation : : INTERPOLATION_NEAREST )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-22 02:56:16 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														continue ;  // Nearest interpolation cannot be baked.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-26 11:42:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													// Special case for angle interpolation.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bool  is_using_angle  =  it  = =  Animation : : INTERPOLATION_LINEAR_ANGLE  | |  it  = =  Animation : : INTERPOLATION_CUBIC_ANGLE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													// Make insert queue.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													Vector < Pair < real_t ,  Variant > >  insert_queue_new ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													switch  ( type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														case  Animation : : TYPE_POSITION_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( double  delta_t  =  0.0 ;  delta_t  < =  anim_len ;  delta_t  + =  dur_step )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																Pair < real_t ,  Variant >  keydata ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																keydata . first  =  delta_t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																Vector3  v ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-21 11:26:23 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																animation - > try_position_track_interpolate ( i ,  delta_t ,  & v ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																keydata . second  =  v ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																insert_queue_new . append ( keydata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														case  Animation : : TYPE_ROTATION_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( double  delta_t  =  0.0 ;  delta_t  < =  anim_len ;  delta_t  + =  dur_step )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																Pair < real_t ,  Variant >  keydata ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																keydata . first  =  delta_t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																Quaternion  v ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-21 11:26:23 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																animation - > try_rotation_track_interpolate ( i ,  delta_t ,  & v ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																keydata . second  =  v ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																insert_queue_new . append ( keydata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														case  Animation : : TYPE_SCALE_3D :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( double  delta_t  =  0.0 ;  delta_t  < =  anim_len ;  delta_t  + =  dur_step )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																Pair < real_t ,  Variant >  keydata ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																keydata . first  =  delta_t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																Vector3  v ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-21 11:26:23 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																animation - > try_scale_track_interpolate ( i ,  delta_t ,  & v ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																keydata . second  =  v ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																insert_queue_new . append ( keydata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														case  Animation : : TYPE_BLEND_SHAPE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( double  delta_t  =  0.0 ;  delta_t  < =  anim_len ;  delta_t  + =  dur_step )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																Pair < real_t ,  Variant >  keydata ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																keydata . first  =  delta_t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																float  v ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-21 11:26:23 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																animation - > try_blend_shape_track_interpolate ( i ,  delta_t ,  & v ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																keydata . second  =  v ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																insert_queue_new . append ( keydata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														case  Animation : : TYPE_VALUE :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															for  ( double  delta_t  =  0.0 ;  delta_t  <  anim_len ;  delta_t  + =  dur_step )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																Pair < real_t ,  Variant >  keydata ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																keydata . first  =  delta_t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																keydata . second  =  animation - > value_track_interpolate ( i ,  delta_t ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																insert_queue_new . append ( keydata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														default :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Cleanup keys.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													int  key_len  =  animation - > track_get_key_count ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( int  j  =  key_len  -  1 ;  j  > =  0 ;  j - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_remove_key " ,  i ,  j ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Insert keys.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-26 11:42:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_set_interpolation_type " ,  i ,  is_using_angle  ?  Animation : : INTERPOLATION_LINEAR_ANGLE  :  Animation : : INTERPOLATION_LINEAR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( int  j  =  insert_queue_new . size ( )  -  1 ;  j  > =  0 ;  j - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  i ,  insert_queue_new [ j ] . first ,  insert_queue_new [ j ] . second ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  i ,  insert_queue_new [ j ] . first ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													// Undo methods.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_set_interpolation_type " ,  i ,  animation - > track_get_interpolation_type ( i ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( int  j  =  key_len  -  1 ;  j  > =  0 ;  j - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_insert_key " ,  i ,  animation - > track_get_key_time ( i ,  j ) ,  animation - > track_get_key_value ( i ,  j ) ,  animation - > track_get_key_transition ( i ,  j ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( this ,  " _redraw_tracks " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_update_key_edit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										case  EDIT_OPTIMIZE_ANIMATION :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											optimize_dialog - > popup_centered ( Size2 ( 250 ,  180 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_OPTIMIZE_ANIMATION_CONFIRM :  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-07 10:55:37 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											animation - > optimize ( optimize_velocity_error - > get_value ( ) ,  optimize_angular_error - > get_value ( ) ,  optimize_precision_error - > get_value ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											_update_key_edit ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											undo_redo - > clear_history ( true ,  undo_redo - > get_history_id_for_object ( animation . ptr ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > clear_history ( true ,  undo_redo - > get_history_id_for_object ( this ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_CLEAN_UP_ANIMATION :  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-06 14:00:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											cleanup_dialog - > popup_centered ( Size2 ( 300 ,  0 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  EDIT_CLEAN_UP_ANIMATION_CONFIRM :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( cleanup_all - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												List < StringName >  names ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) - > get_animation_list ( & names ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-24 15:46:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( const  StringName  & E  :  names )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-02-04 17:20:26 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													_cleanup_animation ( AnimationPlayerEditor : : get_singleton ( ) - > get_player ( ) - > get_animation ( E ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												_cleanup_animation ( animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _cleanup_animation ( Ref < Animation >  p_animation )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( int  i  =  0 ;  i  <  p_animation - > get_track_count ( ) ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bool  prop_exists  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Variant : : Type  valid_type  =  Variant : : NIL ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-04-02 01:20:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Object  * obj  =  nullptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-03 01:43:50 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Ref < Resource >  res ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										Vector < StringName >  leftover_path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Node  * node  =  root - > get_node_and_resource ( p_animation - > track_get_path ( i ) ,  res ,  leftover_path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( res . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											obj  =  res . ptr ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  if  ( node )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											obj  =  node ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( obj  & &  p_animation - > track_get_type ( i )  = =  Animation : : TYPE_VALUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											valid_type  =  obj - > get_static_property_type_indexed ( leftover_path ,  & prop_exists ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! obj  & &  cleanup_tracks - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_animation - > remove_track ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											i - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! prop_exists  | |  p_animation - > track_get_type ( i )  ! =  Animation : : TYPE_VALUE  | |  ! cleanup_keys - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  j  =  0 ;  j  <  p_animation - > track_get_key_count ( i ) ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Variant  v  =  p_animation - > track_get_key_value ( i ,  j ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! Variant : : can_convert ( v . get_type ( ) ,  valid_type ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												p_animation - > track_remove_key ( i ,  j ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												j - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( p_animation - > track_get_key_count ( i )  = =  0  & &  cleanup_tracks - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											p_animation - > remove_track ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											i - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > clear_history ( true ,  undo_redo - > get_history_id_for_object ( animation . ptr ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > clear_history ( true ,  undo_redo - > get_history_id_for_object ( this ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									_update_tracks ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _view_group_toggle ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_update_tracks ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-13 02:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									view_group - > set_icon ( get_editor_theme_icon ( view_group - > is_pressed ( )  ?  SNAME ( " AnimationTrackList " )  :  SNAME ( " AnimationTrackGroup " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-09 10:05:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bezier_edit - > set_filtered ( selected_filter - > is_pressed ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-25 13:01:44 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  AnimationTrackEditor : : is_grouping_tracks ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! view_group )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ! view_group - > is_pressed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _selection_changed ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( selected_filter - > is_pressed ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_update_tracks ( ) ;  // Needs updatin.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										_redraw_tracks ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_redraw_groups ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-11-17 23:34:36 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								float  AnimationTrackEditor : : snap_time ( float  p_value ,  bool  p_relative )  {  
						 
					
						
							
								
									
										
										
										
											2019-08-06 01:15:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( is_snap_enabled ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-15 13:33:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										double  snap_increment ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( timeline - > is_using_fps ( )  & &  step - > get_value ( )  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-15 13:33:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											snap_increment  =  1.0  /  step - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-15 13:33:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											snap_increment  =  step - > get_value ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-15 13:33:04 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( Input : : get_singleton ( ) - > is_key_pressed ( Key : : SHIFT ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-09 09:54:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Use more precise snapping when holding Shift.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											snap_increment  * =  0.25 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-11-17 23:34:36 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( p_relative )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											double  rel  =  Math : : fmod ( timeline - > get_value ( ) ,  snap_increment ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-21 18:02:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											p_value  =  Math : : snapped ( p_value  +  rel ,  snap_increment )  -  rel ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-17 23:34:36 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-21 18:02:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											p_value  =  Math : : snapped ( p_value ,  snap_increment ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-17 23:34:36 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  p_value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 17:44:59 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _show_imported_anim_warning ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-06-16 22:08:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// It looks terrible on a single line but the TTR extractor doesn't support line breaks yet.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-24 02:25:03 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorNode : : get_singleton ( ) - > show_warning ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											TTR ( " This animation belongs to an imported scene, so changes to imported tracks will not be saved. \n \n To modify this animation, navigate to the scene's Advanced Import settings and select the animation. \n Some options, including looping, are available here. To add custom tracks, enable  \" Save To File \"  and \n \" Keep Custom Tracks \" . " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-23 15:02:34 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											TTR ( " Warning: Editing imported animation " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 14:00:15 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _select_all_tracks_for_copy ( )  {  
						 
					
						
							
								
									
										
										
										
											2021-03-07 21:07:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TreeItem  * track  =  track_copy_select - > get_root ( ) - > get_first_child ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! track )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-21 12:40:23 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-21 12:40:23 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bool  all_selected  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									while  ( track )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! track - > is_checked ( 0 ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-21 12:40:23 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											all_selected  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-14 16:41:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-21 12:40:23 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										track  =  track - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-07 21:07:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									track  =  track_copy_select - > get_root ( ) - > get_first_child ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 14:00:15 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( track )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-21 12:40:23 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										track - > set_checked ( 0 ,  ! all_selected ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 14:00:15 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										track  =  track - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _bind_methods ( )  {  
						 
					
						
							
								
									
										
										
										
											2020-12-06 16:09:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _animation_update " ,  & AnimationTrackEditor : : _animation_update ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _track_grab_focus " ,  & AnimationTrackEditor : : _track_grab_focus ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-08 17:34:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _redraw_tracks " ,  & AnimationTrackEditor : : _redraw_tracks ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-06 16:09:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _clear_selection_for_anim " ,  & AnimationTrackEditor : : _clear_selection_for_anim ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _select_at_anim " ,  & AnimationTrackEditor : : _select_at_anim ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( " _clear_selection " ,  & AnimationTrackEditor : : _clear_selection ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-22 19:45:30 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ClassDB : : bind_method ( D_METHOD ( " _bezier_track_set_key_handle_mode " ,  " animation " ,  " track_idx " ,  " key_idx " ,  " key_handle_mode " ,  " key_handle_set_mode " ) ,  & AnimationTrackEditor : : _bezier_track_set_key_handle_mode ,  DEFVAL ( Animation : : HANDLE_SET_MODE_NONE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 23:26:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-23 13:49:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " timeline_changed " ,  PropertyInfo ( Variant : : FLOAT ,  " position " ) ,  PropertyInfo ( Variant : : BOOL ,  " drag " ) ,  PropertyInfo ( Variant : : BOOL ,  " timeline_only " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " keying_changed " ) ) ; 
							 
						 
					
						
							
								
									
										
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " animation_len_changed " ,  PropertyInfo ( Variant : : FLOAT ,  " len " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ADD_SIGNAL ( MethodInfo ( " animation_step_changed " ,  PropertyInfo ( Variant : : FLOAT ,  " step " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-12 16:40:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _pick_track_filter_text_changed ( const  String  & p_newtext )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TreeItem  * root_item  =  pick_track - > get_scene_tree ( ) - > get_scene_tree ( ) - > get_root ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Vector < Node  * >  select_candidates ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * to_select  =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									String  filter  =  pick_track - > get_filter_line_edit ( ) - > get_text ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									_pick_track_select_recursive ( root_item ,  filter ,  select_candidates ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! select_candidates . is_empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( int  i  =  0 ;  i  <  select_candidates . size ( ) ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Node  * candidate  =  select_candidates [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ( ( String ) candidate - > get_name ( ) ) . to_lower ( ) . begins_with ( filter . to_lower ( ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												to_select  =  candidate ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! to_select )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											to_select  =  select_candidates [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									pick_track - > get_scene_tree ( ) - > set_selected ( to_select ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _pick_track_select_recursive ( TreeItem  * p_item ,  const  String  & p_filter ,  Vector < Node  * >  & p_select_candidates )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! p_item )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NodePath  np  =  p_item - > get_metadata ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Node  * node  =  get_node ( np ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 03:42:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! p_filter . is_empty ( )  & &  ( ( String ) node - > get_name ( ) ) . findn ( p_filter )  ! =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-12 16:40:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										p_select_candidates . push_back ( node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-07 21:07:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TreeItem  * c  =  p_item - > get_first_child ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-12 16:40:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									while  ( c )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_pick_track_select_recursive ( c ,  p_filter ,  p_select_candidates ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										c  =  c - > get_next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackEditor : : _pick_track_filter_input ( const  Ref < InputEvent >  & p_ie )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < InputEventKey >  k  =  p_ie ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( k . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch  ( k - > get_keycode ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  Key : : UP : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Key : : DOWN : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Key : : PAGEUP : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  Key : : PAGEDOWN :  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-22 12:37:22 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												pick_track - > get_scene_tree ( ) - > get_scene_tree ( ) - > gui_input ( k ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-12 16:40:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												pick_track - > get_filter_line_edit ( ) - > accept_event ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-20 13:12:33 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-12 16:40:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								AnimationTrackEditor : : AnimationTrackEditor ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-08 21:03:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									main_panel  =  memnew ( PanelContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									main_panel - > set_focus_mode ( FOCUS_ALL ) ;  // Allow panel to have focus so that shortcuts work as expected.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 21:03:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									add_child ( main_panel ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									main_panel - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									HBoxContainer  * timeline_scroll  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-08 21:03:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									main_panel - > add_child ( timeline_scroll ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									timeline_scroll - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VBoxContainer  * timeline_vbox  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline_scroll - > add_child ( timeline_vbox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline_vbox - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline_vbox - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 10:14:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									timeline_vbox - > add_theme_constant_override ( " separation " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-09-04 02:20:57 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									info_message  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									info_message - > set_text ( TTR ( " Select an AnimationPlayer node to create and edit animations. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-24 20:58:47 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									info_message - > set_vertical_alignment ( VERTICAL_ALIGNMENT_CENTER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									info_message - > set_horizontal_alignment ( HORIZONTAL_ALIGNMENT_CENTER ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-15 11:01:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									info_message - > set_autowrap_mode ( TextServer : : AUTOWRAP_WORD_SMART ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-04 10:12:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									info_message - > set_custom_minimum_size ( Size2 ( 100  *  EDSCALE ,  0 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-18 19:02:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									info_message - > set_anchors_and_offsets_preset ( PRESET_FULL_RECT ,  PRESET_MODE_KEEP_SIZE ,  8  *  EDSCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-04 02:20:57 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									main_panel - > add_child ( info_message ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									timeline  =  memnew ( AnimationTimelineEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline_vbox - > add_child ( timeline ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									timeline - > connect ( " timeline_changed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _timeline_changed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > connect ( " name_limit_changed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _name_limit_changed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > connect ( " track_added " ,  callable_mp ( this ,  & AnimationTrackEditor : : _add_track ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > connect ( " value_changed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _timeline_value_changed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > connect ( " length_changed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _update_length ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									panner . instantiate ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-19 17:50:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									panner - > set_callbacks ( callable_mp ( this ,  & AnimationTrackEditor : : _pan_callback ) ,  callable_mp ( this ,  & AnimationTrackEditor : : _zoom_callback ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 17:19:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									scroll  =  memnew ( ScrollContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline_vbox - > add_child ( scroll ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scroll - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 13:46:36 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VScrollBar  * sb  =  scroll - > get_v_scroll_bar ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									scroll - > remove_child ( sb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									timeline_scroll - > add_child ( sb ) ;  // Move here so timeline and tracks are always aligned.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-19 19:59:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scroll - > set_focus_mode ( FOCUS_CLICK ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scroll - > connect ( " gui_input " ,  callable_mp ( this ,  & AnimationTrackEditor : : _scroll_input ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-19 19:59:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scroll - > connect ( " focus_exited " ,  callable_mp ( panner . ptr ( ) ,  & ViewPanner : : release_pan_key ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit  =  memnew ( AnimationBezierTrackEdit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline_vbox - > add_child ( bezier_edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit - > set_editor ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit - > set_timeline ( timeline ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit - > hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bezier_edit - > connect ( " close_request " ,  callable_mp ( this ,  & AnimationTrackEditor : : _cancel_bezier_edit ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline_vbox - > set_custom_minimum_size ( Size2 ( 0 ,  150 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hscroll  =  memnew ( HScrollBar ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hscroll - > share ( timeline ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 15:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hscroll - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hscroll - > connect ( " value_changed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _update_scroll ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 15:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									timeline_vbox - > add_child ( hscroll ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									timeline - > set_hscroll ( hscroll ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									track_vbox  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scroll - > add_child ( track_vbox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									track_vbox - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-07 17:15:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scroll - > set_horizontal_scroll_mode ( ScrollContainer : : SCROLL_MODE_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 10:14:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									track_vbox - > add_theme_constant_override ( " separation " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									HBoxContainer  * bottom_hb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( bottom_hb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-23 15:02:34 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									imported_anim_warning  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									imported_anim_warning - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-24 02:25:03 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									imported_anim_warning - > set_text ( TTR ( " Imported Scene " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									imported_anim_warning - > set_tooltip_text ( TTR ( " Warning: Editing imported animation " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									imported_anim_warning - > connect ( " pressed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _show_imported_anim_warning ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-23 15:02:34 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bottom_hb - > add_child ( imported_anim_warning ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_spacer ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-11-09 10:05:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bezier_edit_icon  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit_icon - > set_flat ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit_icon - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit_icon - > set_toggle_mode ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bezier_edit_icon - > connect ( " pressed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _toggle_bezier_edit ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bezier_edit_icon - > set_tooltip_text ( TTR ( " Toggle between the bezier curve editor and track editor. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-09 10:05:28 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_child ( bezier_edit_icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 20:49:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									selected_filter  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									selected_filter - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									selected_filter - > connect ( " pressed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _view_group_toggle ) ) ;  // Same function works the same.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									selected_filter - > set_toggle_mode ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									selected_filter - > set_tooltip_text ( TTR ( " Only show tracks from nodes selected in tree. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_child ( selected_filter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 20:49:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									view_group  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									view_group - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									view_group - > connect ( " pressed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _view_group_toggle ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									view_group - > set_toggle_mode ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									view_group - > set_tooltip_text ( TTR ( " Group tracks by node or display them as plain list. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_child ( view_group ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_child ( memnew ( VSeparator ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-06-19 20:49:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									snap  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									snap - > set_flat ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-25 14:03:22 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									snap - > set_text ( TTR ( " Snap: " )  +  "   " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_child ( snap ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									snap - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									snap - > set_toggle_mode ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									snap - > set_pressed ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									step  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									step - > set_min ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									step - > set_max ( 1000000 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									step - > set_step ( 0.0001 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									step - > set_hide_slider ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									step - > set_custom_minimum_size ( Size2 ( 100 ,  0 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									step - > set_tooltip_text ( TTR ( " Animation step value. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_child ( step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									step - > connect ( " value_changed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _update_step ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									step - > set_read_only ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									snap_mode  =  memnew ( OptionButton ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									snap_mode - > add_item ( TTR ( " Seconds " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									snap_mode - > add_item ( TTR ( " FPS " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_child ( snap_mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									snap_mode - > connect ( " item_selected " ,  callable_mp ( this ,  & AnimationTrackEditor : : _snap_mode_changed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-15 00:05:27 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									snap_mode - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-14 16:43:38 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_child ( memnew ( VSeparator ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									zoom_icon  =  memnew ( TextureRect ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									zoom_icon - > set_v_size_flags ( SIZE_SHRINK_CENTER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_child ( zoom_icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									zoom  =  memnew ( HSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									zoom - > set_step ( 0.01 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									zoom - > set_min ( 0.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									zoom - > set_max ( 2.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									zoom - > set_value ( 1.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									zoom - > set_custom_minimum_size ( Size2 ( 200 ,  0 )  *  EDSCALE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									zoom - > set_v_size_flags ( SIZE_SHRINK_CENTER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bottom_hb - > add_child ( zoom ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									timeline - > set_zoom ( zoom ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit  =  memnew ( MenuButton ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-17 11:40:00 +10:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > set_shortcut_context ( this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									edit - > set_text ( TTR ( " Edit " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > set_flat ( false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 15:49:16 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > set_disabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-25 12:42:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > set_tooltip_text ( TTR ( " Animation properties. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_item ( TTR ( " Copy Tracks " ) ,  EDIT_COPY_TRACKS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_item ( TTR ( " Paste Tracks " ) ,  EDIT_PASTE_TRACKS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_separator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_item ( TTR ( " Scale Selection " ) ,  EDIT_SCALE_SELECTION ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_item ( TTR ( " Scale From Cursor " ) ,  EDIT_SCALE_FROM_CURSOR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_item ( TTR ( " Make Easing Selection " ) ,  EDIT_EASE_SELECTION ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-02 12:37:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_shortcut ( ED_SHORTCUT ( " animation_editor/duplicate_selection " ,  TTR ( " Duplicate Selection " ) ,  KeyModifierMask : : CMD_OR_CTRL  |  Key : : D ) ,  EDIT_DUPLICATE_SELECTION ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_shortcut ( ED_SHORTCUT ( " animation_editor/duplicate_selection_transposed " ,  TTR ( " Duplicate Transposed " ) ,  KeyModifierMask : : SHIFT  |  KeyModifierMask : : CMD_OR_CTRL  |  Key : : D ) ,  EDIT_DUPLICATE_TRANSPOSED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 00:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_shortcut ( ED_SHORTCUT ( " animation_editor/add_reset_value " ,  TTR ( " Add RESET Value(s) " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-08-13 16:31:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_shortcut ( ED_SHORTCUT ( " animation_editor/delete_selection " ,  TTR ( " Delete Selection " ) ,  Key : : KEY_DELETE ) ,  EDIT_DELETE_SELECTION ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-02 12:37:48 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_shortcut ( ED_SHORTCUT ( " animation_editor/goto_next_step " ,  TTR ( " Go to Next Step " ) ,  KeyModifierMask : : CMD_OR_CTRL  |  Key : : RIGHT ) ,  EDIT_GOTO_NEXT_STEP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_shortcut ( ED_SHORTCUT ( " animation_editor/goto_prev_step " ,  TTR ( " Go to Previous Step " ) ,  KeyModifierMask : : CMD_OR_CTRL  |  Key : : LEFT ) ,  EDIT_GOTO_PREV_STEP ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_shortcut ( ED_SHORTCUT ( " animation_editor/apply_reset " ,  TTR ( " Apply Reset " ) ) ,  EDIT_APPLY_RESET ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_separator ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_item ( TTR ( " Bake Animation " ) ,  EDIT_BAKE_ANIMATION ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-27 07:55:08 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_item ( TTR ( " Optimize Animation (no undo) " ) ,  EDIT_OPTIMIZE_ANIMATION ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > add_item ( TTR ( " Clean-Up Animation (no undo) " ) ,  EDIT_CLEAN_UP_ANIMATION ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > connect ( " id_pressed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									edit - > get_popup ( ) - > connect ( " about_to_popup " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_about_to_popup ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									pick_track  =  memnew ( SceneTreeDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( pick_track ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-12 16:40:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pick_track - > register_text_enter ( pick_track - > get_filter_line_edit ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-11 18:45:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pick_track - > set_title ( TTR ( " Pick a node to animate: " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pick_track - > connect ( " selected " ,  callable_mp ( this ,  & AnimationTrackEditor : : _new_track_node_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-12 16:40:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									pick_track - > get_filter_line_edit ( ) - > connect ( " text_changed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _pick_track_filter_text_changed ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									pick_track - > get_filter_line_edit ( ) - > connect ( " gui_input " ,  callable_mp ( this ,  & AnimationTrackEditor : : _pick_track_filter_input ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									prop_selector  =  memnew ( PropertySelector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( prop_selector ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									prop_selector - > connect ( " selected " ,  callable_mp ( this ,  & AnimationTrackEditor : : _new_track_property_selected ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									method_selector  =  memnew ( PropertySelector ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( method_selector ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									method_selector - > connect ( " selected " ,  callable_mp ( this ,  & AnimationTrackEditor : : _add_method_key ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									insert_confirm  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( insert_confirm ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									insert_confirm - > connect ( " confirmed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _confirm_insert_list ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									VBoxContainer  * icvb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									insert_confirm - > add_child ( icvb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									insert_confirm_text  =  memnew ( Label ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									icvb - > add_child ( insert_confirm_text ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									HBoxContainer  * ichb  =  memnew ( HBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									icvb - > add_child ( ichb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									insert_confirm_bezier  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									insert_confirm_bezier - > set_text ( TTR ( " Use Bezier Curves " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-20 11:46:44 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									insert_confirm_bezier - > set_pressed ( EDITOR_GET ( " editors/animation/default_create_bezier_tracks " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ichb - > add_child ( insert_confirm_bezier ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									insert_confirm_reset  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									insert_confirm_reset - > set_text ( TTR ( " Create RESET Track(s) " ,  " " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									insert_confirm_reset - > set_pressed ( EDITOR_GET ( " editors/animation/default_create_reset_tracks " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ichb - > add_child ( insert_confirm_reset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									box_selection  =  memnew ( Control ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( box_selection ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-01 03:17:33 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									box_selection - > set_as_top_level ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									box_selection - > set_mouse_filter ( MOUSE_FILTER_IGNORE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									box_selection - > hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									box_selection - > connect ( " draw " ,  callable_mp ( this ,  & AnimationTrackEditor : : _box_selection_draw ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Default Plugins.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Ref < AnimationTrackEditDefaultPlugin >  def_plugin ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-17 16:03:09 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									def_plugin . instantiate ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_track_edit_plugin ( def_plugin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-08-10 12:11:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Dialogs.
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_dialog  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( optimize_dialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-13 11:27:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									optimize_dialog - > set_title ( TTR ( " Animation Optimizer " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									VBoxContainer  * optimize_vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_dialog - > add_child ( optimize_vb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-07 10:55:37 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									optimize_velocity_error  =  memnew ( SpinBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_velocity_error - > set_max ( 1.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_velocity_error - > set_min ( 0.001 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_velocity_error - > set_step ( 0.001 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_velocity_error - > set_value ( 0.01 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-13 11:27:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									optimize_vb - > add_margin_child ( TTR ( " Max Velocity Error: " ) ,  optimize_velocity_error ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									optimize_angular_error  =  memnew ( SpinBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_angular_error - > set_max ( 1.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_angular_error - > set_min ( 0.001 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_angular_error - > set_step ( 0.001 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_angular_error - > set_value ( 0.01 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-13 11:27:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									optimize_vb - > add_margin_child ( TTR ( " Max Angular Error: " ) ,  optimize_angular_error ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-07 10:55:37 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									optimize_precision_error  =  memnew ( SpinBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_precision_error - > set_max ( 6 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_precision_error - > set_min ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_precision_error - > set_step ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									optimize_precision_error - > set_value ( 3 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-13 11:27:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									optimize_vb - > add_margin_child ( TTR ( " Max Precision Error: " ) ,  optimize_precision_error ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-07 19:31:19 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									optimize_dialog - > set_ok_button_text ( TTR ( " Optimize " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:56:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									optimize_dialog - > connect ( " confirmed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) . bind ( EDIT_OPTIMIZE_ANIMATION_CONFIRM ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cleanup_dialog  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( cleanup_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VBoxContainer  * cleanup_vb  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cleanup_dialog - > add_child ( cleanup_vb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-04 17:30:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cleanup_keys  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									cleanup_keys - > set_text ( TTR ( " Remove invalid keys " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cleanup_keys - > set_pressed ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cleanup_vb - > add_child ( cleanup_keys ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-04 17:30:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cleanup_tracks  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									cleanup_tracks - > set_text ( TTR ( " Remove unresolved and empty tracks " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cleanup_tracks - > set_pressed ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cleanup_vb - > add_child ( cleanup_tracks ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-04 17:30:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cleanup_all  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									cleanup_all - > set_text ( TTR ( " Clean-up all animations " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cleanup_vb - > add_child ( cleanup_all ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cleanup_dialog - > set_title ( TTR ( " Clean-Up Animation(s) (NO UNDO!) " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-07 19:31:19 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cleanup_dialog - > set_ok_button_text ( TTR ( " Clean-Up " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:56:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cleanup_dialog - > connect ( " confirmed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) . bind ( EDIT_CLEAN_UP_ANIMATION_CONFIRM ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scale_dialog  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VBoxContainer  * vbc  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scale_dialog - > add_child ( vbc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scale  =  memnew ( SpinBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scale - > set_min ( - 99999 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scale - > set_max ( 99999 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scale - > set_step ( 0.001 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vbc - > add_margin_child ( TTR ( " Scale Ratio: " ) ,  scale ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:56:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scale_dialog - > connect ( " confirmed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) . bind ( EDIT_SCALE_CONFIRM ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									add_child ( scale_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									//
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_dialog  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_dialog - > set_title ( TTR ( " Select Transition and Easing " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_dialog - > connect ( " confirmed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) . bind ( EDIT_EASE_CONFIRM ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( ease_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									GridContainer  * ease_grid  =  memnew ( GridContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_grid - > set_columns ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_dialog - > add_child ( ease_grid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection  =  memnew ( OptionButton ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-13 13:03:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Linear " ,  " Transition Type " ) ,  Tween : : TRANS_LINEAR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Sine " ,  " Transition Type " ) ,  Tween : : TRANS_SINE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Quint " ,  " Transition Type " ) ,  Tween : : TRANS_QUINT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Quart " ,  " Transition Type " ) ,  Tween : : TRANS_QUART ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Quad " ,  " Transition Type " ) ,  Tween : : TRANS_QUAD ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Expo " ,  " Transition Type " ) ,  Tween : : TRANS_EXPO ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Elastic " ,  " Transition Type " ) ,  Tween : : TRANS_ELASTIC ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Cubic " ,  " Transition Type " ) ,  Tween : : TRANS_CUBIC ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Circ " ,  " Transition Type " ) ,  Tween : : TRANS_CIRC ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Bounce " ,  " Transition Type " ) ,  Tween : : TRANS_BOUNCE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Back " ,  " Transition Type " ) ,  Tween : : TRANS_BACK ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-05 05:02:27 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									transition_selection - > add_item ( TTR ( " Spring " ,  " Transition Type " ) ,  Tween : : TRANS_SPRING ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									transition_selection - > select ( Tween : : TRANS_LINEAR ) ;  // Default
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-13 13:03:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									transition_selection - > set_auto_translate ( false ) ;  // Translation context is needed.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_selection  =  memnew ( OptionButton ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-13 13:03:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_selection - > add_item ( TTR ( " In " ,  " Ease Type " ) ,  Tween : : EASE_IN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_selection - > add_item ( TTR ( " Out " ,  " Ease Type " ) ,  Tween : : EASE_OUT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_selection - > add_item ( TTR ( " InOut " ,  " Ease Type " ) ,  Tween : : EASE_IN_OUT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_selection - > add_item ( TTR ( " OutIn " ,  " Ease Type " ) ,  Tween : : EASE_OUT_IN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_selection - > select ( Tween : : EASE_IN_OUT ) ;  // Default
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-13 13:03:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_selection - > set_auto_translate ( false ) ;  // Translation context is needed.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_fps  =  memnew ( SpinBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_fps - > set_min ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_fps - > set_max ( 999 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_fps - > set_step ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ease_fps - > set_value ( 30 ) ;  // Default
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-13 13:03:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_grid - > add_child ( memnew ( Label ( TTR ( " Transition Type: " ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_grid - > add_child ( transition_selection ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-13 13:03:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_grid - > add_child ( memnew ( Label ( TTR ( " Ease Type: " ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_grid - > add_child ( ease_selection ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-13 13:03:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_grid - > add_child ( memnew ( Label ( TTR ( " FPS: " ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ease_grid - > add_child ( ease_fps ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_dialog  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-13 11:27:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_dialog - > set_title ( TTR ( " Animation Baker " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-29 10:44:00 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_dialog - > connect ( " confirmed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) . bind ( EDIT_BAKE_ANIMATION_CONFIRM ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									add_child ( bake_dialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									GridContainer  * bake_grid  =  memnew ( GridContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_grid - > set_columns ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_dialog - > add_child ( bake_grid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_trs  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_trs - > set_pressed ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_blendshape  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_blendshape - > set_pressed ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_value  =  memnew ( CheckBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_value - > set_pressed ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_fps  =  memnew ( SpinBox ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_fps - > set_min ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_fps - > set_max ( 999 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_fps - > set_step ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bake_fps - > set_value ( 30 ) ;  // Default
 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-21 11:26:23 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_grid - > add_child ( memnew ( Label ( TTR ( " 3D Pos/Rot/Scl Track: " ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_grid - > add_child ( bake_trs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-13 13:03:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_grid - > add_child ( memnew ( Label ( TTR ( " Blendshape Track: " ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_grid - > add_child ( bake_blendshape ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-13 13:03:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_grid - > add_child ( memnew ( Label ( TTR ( " Value Track: " ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_grid - > add_child ( bake_value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-13 13:03:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_grid - > add_child ( memnew ( Label ( TTR ( " FPS: " ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-21 09:30:18 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bake_grid - > add_child ( bake_fps ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									track_copy_dialog  =  memnew ( ConfirmationDialog ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( track_copy_dialog ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-21 12:40:23 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									track_copy_dialog - > set_title ( TTR ( " Select Tracks to Copy " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-07 19:31:19 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									track_copy_dialog - > set_ok_button_text ( TTR ( " Copy " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VBoxContainer  * track_copy_vbox  =  memnew ( VBoxContainer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									track_copy_dialog - > add_child ( track_copy_vbox ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 14:00:15 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-21 12:40:23 -03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Button  * select_all_button  =  memnew ( Button ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									select_all_button - > set_text ( TTR ( " Select All/None " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-21 18:28:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									select_all_button - > connect ( " pressed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _select_all_tracks_for_copy ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									track_copy_vbox - > add_child ( select_all_button ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 14:00:15 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									track_copy_select  =  memnew ( Tree ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-19 14:00:15 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									track_copy_select - > set_h_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									track_copy_select - > set_v_size_flags ( SIZE_EXPAND_FILL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									track_copy_select - > set_hide_root ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-29 12:53:28 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									track_copy_vbox - > add_child ( track_copy_select ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-28 22:56:41 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									track_copy_dialog - > connect ( " confirmed " ,  callable_mp ( this ,  & AnimationTrackEditor : : _edit_menu_pressed ) . bind ( EDIT_COPY_TRACKS_CONFIRM ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AnimationTrackEditor : : ~ AnimationTrackEditor ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( key_edit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										memdelete ( key_edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-24 11:16:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( multi_key_edit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										memdelete ( multi_key_edit ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-07 12:46:14 -03:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// AnimationTrackKeyEditEditorPlugin
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackKeyEditEditor : : _time_edit_entered ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  key  =  animation - > track_find_key ( track ,  key_ofs ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( key  = =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									key_data_cache . time  =  animation - > track_get_key_time ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									key_data_cache . transition  =  animation - > track_get_key_transition ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									key_data_cache . value  =  animation - > track_get_key_value ( track ,  key ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  AnimationTrackKeyEditEditor : : _time_edit_exited ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									real_t  new_time  =  spinner - > get_value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( use_fps )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										real_t  fps  =  animation - > get_step ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( fps  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											fps  =  1.0  /  fps ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										new_time  / =  fps ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( Math : : is_equal_approx ( new_time ,  key_data_cache . time ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ;  // No change.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  existing  =  animation - > track_find_key ( track ,  new_time ,  Animation : : FIND_MODE_APPROX ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-23 23:53:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EditorUndoRedoManager  * undo_redo  =  EditorUndoRedoManager : : get_singleton ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-08 21:38:01 +09:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									undo_redo - > create_action ( TTR ( " Animation Change Keyframe Time " ) ,  UndoRedo : : MERGE_ENDS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( existing  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  track ,  animation - > track_get_key_time ( track ,  existing ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  track ,  key_data_cache . time ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_do_method ( animation . ptr ( ) ,  " track_insert_key " ,  track ,  new_time ,  key_data_cache . value ,  key_data_cache . transition ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_remove_key_at_time " ,  track ,  new_time ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_insert_key " ,  track ,  key_data_cache . time ,  key_data_cache . value ,  key_data_cache . transition ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( existing  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										undo_redo - > add_undo_method ( animation . ptr ( ) ,  " track_insert_key " ,  track ,  animation - > track_get_key_time ( track ,  existing ) ,  animation - > track_get_key_value ( track ,  existing ) ,  animation - > track_get_key_transition ( track ,  existing ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Reselect key.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									AnimationPlayerEditor  * ape  =  AnimationPlayerEditor : : get_singleton ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ape )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										AnimationTrackEditor  * ate  =  ape - > get_track_editor ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ate )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( ate ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( ate ,  " _clear_selection_for_anim " ,  animation ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_do_method ( ate ,  " _select_at_anim " ,  animation ,  track ,  new_time ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											undo_redo - > add_undo_method ( ate ,  " _select_at_anim " ,  animation ,  track ,  key_data_cache . time ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									undo_redo - > commit_action ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AnimationTrackKeyEditEditor : : AnimationTrackKeyEditEditor ( Ref < Animation >  p_animation ,  int  p_track ,  real_t  p_key_ofs ,  bool  p_use_fps )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! p_animation . is_valid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									animation  =  p_animation ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									track  =  p_track ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									key_ofs  =  p_key_ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									use_fps  =  p_use_fps ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_label ( " Time " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spinner  =  memnew ( EditorSpinSlider ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spinner - > set_focus_mode ( Control : : FOCUS_CLICK ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spinner - > set_min ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spinner - > set_allow_greater ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spinner - > set_allow_lesser ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( use_fps )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spinner - > set_step ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spinner - > set_hide_slider ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										real_t  fps  =  animation - > get_step ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( fps  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											fps  =  1.0  /  fps ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spinner - > set_value ( key_ofs  *  fps ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spinner - > set_step ( 0.0001 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spinner - > set_value ( key_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										spinner - > set_max ( animation - > get_length ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_child ( spinner ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spinner - > connect ( " grabbed " ,  callable_mp ( this ,  & AnimationTrackKeyEditEditor : : _time_edit_entered ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spinner - > connect ( " ungrabbed " ,  callable_mp ( this ,  & AnimationTrackKeyEditEditor : : _time_edit_exited ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spinner - > connect ( " value_focus_entered " ,  callable_mp ( this ,  & AnimationTrackKeyEditEditor : : _time_edit_entered ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									spinner - > connect ( " value_focus_exited " ,  callable_mp ( this ,  & AnimationTrackKeyEditEditor : : _time_edit_exited ) ,  CONNECT_DEFERRED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								AnimationTrackKeyEditEditor : : ~ AnimationTrackKeyEditEditor ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}