mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 05:31:01 +00:00 
			
		
		
		
	Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
This commit is contained in:
		
							parent
							
								
									03b13e0c69
								
							
						
					
					
						commit
						e956e80c1f
					
				
					 130 changed files with 967 additions and 511 deletions
				
			
		|  | @ -353,7 +353,8 @@ Variant Tween::_get_final_val(const InterpolateData &p_data) const { | |||
| 
 | ||||
| 			// If we're looking at an INT value, instead convert it to a FLOAT
 | ||||
| 			// This is better for interpolation
 | ||||
| 			if (final_val.get_type() == Variant::INT) final_val = final_val.operator real_t(); | ||||
| 			if (final_val.get_type() == Variant::INT) | ||||
| 				final_val = final_val.operator real_t(); | ||||
| 
 | ||||
| 			return final_val; | ||||
| 		} | ||||
|  | @ -395,7 +396,8 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) { | |||
| 
 | ||||
| 			// If we're looking at an INT value, instead convert it to a FLOAT
 | ||||
| 			// This is better for interpolation
 | ||||
| 			if (final_val.get_type() == Variant::INT) final_val = final_val.operator real_t(); | ||||
| 			if (final_val.get_type() == Variant::INT) | ||||
| 				final_val = final_val.operator real_t(); | ||||
| 
 | ||||
| 			// Calculate the delta based on the initial value and the final value
 | ||||
| 			_calc_delta_val(p_data.initial_val, final_val, p_data.delta_val); | ||||
|  | @ -409,7 +411,8 @@ Variant &Tween::_get_delta_val(InterpolateData &p_data) { | |||
| 
 | ||||
| 			// If we're looking at an INT value, instead convert it to a FLOAT
 | ||||
| 			// This is better for interpolation
 | ||||
| 			if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t(); | ||||
| 			if (initial_val.get_type() == Variant::INT) | ||||
| 				initial_val = initial_val.operator real_t(); | ||||
| 
 | ||||
| 			// Calculate the delta based on the initial value and the final value
 | ||||
| 			_calc_delta_val(initial_val, p_data.final_val, p_data.delta_val); | ||||
|  | @ -1334,11 +1337,14 @@ void Tween::interpolate_property(Object *p_object, NodePath p_property, Variant | |||
| 
 | ||||
| 	// If no initial value given, grab the initial value from the object
 | ||||
| 	// TODO: Is this documented? This is very useful and removes a lot of clutter from tweens!
 | ||||
| 	if (p_initial_val.get_type() == Variant::NIL) p_initial_val = p_object->get_indexed(p_property.get_subnames()); | ||||
| 	if (p_initial_val.get_type() == Variant::NIL) | ||||
| 		p_initial_val = p_object->get_indexed(p_property.get_subnames()); | ||||
| 
 | ||||
| 	// Convert any integers into REALs as they are better for interpolation
 | ||||
| 	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_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(); | ||||
| 
 | ||||
| 	// Build the interpolation data
 | ||||
| 	_build_interpolation(INTER_PROPERTY, p_object, &p_property, nullptr, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); | ||||
|  | @ -1352,8 +1358,10 @@ void Tween::interpolate_method(Object *p_object, StringName p_method, Variant p_ | |||
| 	} | ||||
| 
 | ||||
| 	// Convert any integers into REALs as they are better for interpolation
 | ||||
| 	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_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(); | ||||
| 
 | ||||
| 	// Build the interpolation data
 | ||||
| 	_build_interpolation(INTER_METHOD, p_object, nullptr, &p_method, p_initial_val, p_final_val, p_duration, p_trans_type, p_ease_type, p_delay); | ||||
|  | @ -1486,10 +1494,12 @@ void Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini | |||
| 
 | ||||
| 	// If no initial value is given, grab it from the source object
 | ||||
| 	// TODO: Is this documented? It's really helpful for decluttering tweens
 | ||||
| 	if (p_initial_val.get_type() == Variant::NIL) p_initial_val = p_object->get_indexed(p_property.get_subnames()); | ||||
| 	if (p_initial_val.get_type() == Variant::NIL) | ||||
| 		p_initial_val = p_object->get_indexed(p_property.get_subnames()); | ||||
| 
 | ||||
| 	// Convert initial INT values to FLOAT as they are better for interpolation
 | ||||
| 	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(); | ||||
| 
 | ||||
| 	// Confirm the source and target objects are valid
 | ||||
| 	ERR_FAIL_COND(p_object == nullptr); | ||||
|  | @ -1515,7 +1525,8 @@ void Tween::follow_property(Object *p_object, NodePath p_property, Variant p_ini | |||
| 	ERR_FAIL_COND(!target_prop_valid); | ||||
| 
 | ||||
| 	// Convert target INT to FLOAT since it is better for interpolation
 | ||||
| 	if (target_val.get_type() == Variant::INT) target_val = target_val.operator real_t(); | ||||
| 	if (target_val.get_type() == Variant::INT) | ||||
| 		target_val = target_val.operator real_t(); | ||||
| 
 | ||||
| 	// Verify that the target value and initial value are the same type
 | ||||
| 	ERR_FAIL_COND(target_val.get_type() != p_initial_val.get_type()); | ||||
|  | @ -1550,7 +1561,8 @@ void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi | |||
| 		return; | ||||
| 	} | ||||
| 	// Convert initial INT values to FLOAT as they are better for interpolation
 | ||||
| 	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(); | ||||
| 
 | ||||
| 	// Verify the source and target objects are valid
 | ||||
| 	ERR_FAIL_COND(p_object == nullptr); | ||||
|  | @ -1576,7 +1588,8 @@ void Tween::follow_method(Object *p_object, StringName p_method, Variant p_initi | |||
| 	ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK); | ||||
| 
 | ||||
| 	// Convert target INT values to FLOAT as they are better for interpolation
 | ||||
| 	if (target_val.get_type() == Variant::INT) target_val = target_val.operator real_t(); | ||||
| 	if (target_val.get_type() == Variant::INT) | ||||
| 		target_val = target_val.operator real_t(); | ||||
| 	ERR_FAIL_COND(target_val.get_type() != p_initial_val.get_type()); | ||||
| 
 | ||||
| 	// Make the new InterpolateData for the method follow
 | ||||
|  | @ -1613,7 +1626,8 @@ void Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_ | |||
| 	p_initial_property = p_initial_property.get_as_property_path(); | ||||
| 
 | ||||
| 	// Convert the initial INT values to FLOAT as they are better for Interpolation
 | ||||
| 	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(); | ||||
| 
 | ||||
| 	// Verify both objects are valid
 | ||||
| 	ERR_FAIL_COND(p_object == nullptr); | ||||
|  | @ -1639,7 +1653,8 @@ void Tween::targeting_property(Object *p_object, NodePath p_property, Object *p_ | |||
| 	ERR_FAIL_COND(!initial_prop_valid); | ||||
| 
 | ||||
| 	// Convert the initial INT value to FLOAT as it is better for interpolation
 | ||||
| 	if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t(); | ||||
| 	if (initial_val.get_type() == Variant::INT) | ||||
| 		initial_val = initial_val.operator real_t(); | ||||
| 	ERR_FAIL_COND(initial_val.get_type() != p_final_val.get_type()); | ||||
| 
 | ||||
| 	// Build the InterpolateData object
 | ||||
|  | @ -1679,7 +1694,8 @@ void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in | |||
| 	} | ||||
| 
 | ||||
| 	// Convert final INT values to FLOAT as they are better for interpolation
 | ||||
| 	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(); | ||||
| 
 | ||||
| 	// Make sure the given objects are valid
 | ||||
| 	ERR_FAIL_COND(p_object == nullptr); | ||||
|  | @ -1705,7 +1721,8 @@ void Tween::targeting_method(Object *p_object, StringName p_method, Object *p_in | |||
| 	ERR_FAIL_COND(error.error != Callable::CallError::CALL_OK); | ||||
| 
 | ||||
| 	// Convert initial INT values to FLOAT as they aer better for interpolation
 | ||||
| 	if (initial_val.get_type() == Variant::INT) initial_val = initial_val.operator real_t(); | ||||
| 	if (initial_val.get_type() == Variant::INT) | ||||
| 		initial_val = initial_val.operator real_t(); | ||||
| 	ERR_FAIL_COND(initial_val.get_type() != p_final_val.get_type()); | ||||
| 
 | ||||
| 	// Build the new InterpolateData object
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Rémi Verschelde
						Rémi Verschelde