mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Make Tween::interpolate_property's able to get() the initial value
To use this behavior, pass `null` in place of the initial_value parameter.
This commit is contained in:
		
							parent
							
								
									2fce0010f0
								
							
						
					
					
						commit
						7bbde636e8
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -998,6 +998,8 @@ bool Tween::interpolate_property(Object *p_object, String p_property, Variant p_ | ||||||
| 		_add_pending_command("interpolate_property", p_object, p_property, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); | 		_add_pending_command("interpolate_property", p_object, p_property, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|  | 	if (p_initial_val.get_type() == Variant::NIL) p_initial_val = p_object->get(p_property); | ||||||
|  | 
 | ||||||
| 	// convert INT to REAL is better for interpolaters
 | 	// convert INT to REAL is better for interpolaters
 | ||||||
| 	if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); | 	if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); | ||||||
| 	if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); | 	if (p_final_val.get_type() == Variant::INT) p_final_val = p_final_val.operator real_t(); | ||||||
|  | @ -1188,6 +1190,8 @@ bool Tween::follow_property(Object *p_object, String p_property, Variant p_initi | ||||||
| 		_add_pending_command("follow_property", p_object, p_property, p_initial_val, p_target, p_target_property, p_duration, p_trans_type, p_ease_type, p_delay); | 		_add_pending_command("follow_property", p_object, p_property, p_initial_val, p_target, p_target_property, p_duration, p_trans_type, p_ease_type, p_delay); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|  | 	if (p_initial_val.get_type() == Variant::NIL) p_initial_val = p_object->get(p_initial_val); | ||||||
|  | 
 | ||||||
| 	// convert INT to REAL is better for interpolaters
 | 	// convert INT to REAL is better for interpolaters
 | ||||||
| 	if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); | 	if (p_initial_val.get_type() == Variant::INT) p_initial_val = p_initial_val.operator real_t(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Bojidar Marinov
						Bojidar Marinov