Repository: godotengine/godot
File: scene/animation/animation_mixer.cpp (C++)

Code before:

void AnimationMixer::_init_root_motion_cache() {
	root_motion_cache.loc = Vector3(0, 0, 0);
	root_motion_cache.rot = Quaternion(0, 0, 0, 1);
	root_motion_cache.scale = Vector3(1, 1, 1);
	root_motion_position = Vector3(0, 0, 0);
	root_motion_rotation = Quaternion(0, 0, 0, 1);
	root_motion_scale = Vector3(0, 0, 0);
	root_motion_position_accumulator = Vector3(0, 0, 0);
	root_motion_rotation_accumulator = Quaternion(0, 0, 0, 1);
	root_motion_scale_accumulator = Vector3(1, 1, 1);
}

bool AnimationMixer::_update_caches() {
	setup_pass++;

	root_motion_cache.loc = Vector3(0, 0, 0);
	root_motion_cache.rot = Quaternion(0, 0, 0, 1);
	root_motion_cache.scale = Vector3(1, 1, 1);

	List<StringName> sname;
	get_animation_list(&sname);

	Node *parent = get_node_or_null(root_node);
	if (!parent) {
		cache_valid = false;
		return false;
	}

#ifdef TOOLS_ENABLED
	String mixer_name = "AnimationMixer";
	const Node *owner = get_owner();
	if (owner) {
		const String scene_path = owner->get_scene_file_path();
		if (!scene_path.is_empty()) {
			mixer_name += vformat(" (at: %s)", scene_path.get_file());
		}
	}
#else
	const String mixer_name = "AnimationMixer";
#endif

	Ref<Animation> reset_anim;
	bool has_reset_anim = has_animation(SceneStringNames::get_singleton()->RESET);
	if (has_reset_anim) {
		reset_anim = get_animation(SceneStringNames::get_singleton()->RESET);
	}
	for (const StringName &E : sname) {
		Ref<Animation> anim = get_animation(E);
		for (int i = 0; i < anim->get_track_count(); i++) {
			NodePath path = anim->track_get_path(i);

Review comment (suggestion):
```suggestion
	bool check_path = GLOBAL_GET("animation/warnings/check_invalid_track_paths");
	bool check_angle_interpolation = GLOBAL_GET("animation/warnings/check_angle_interpolation_type_conflicting");
```
Explicit conversion is not required when assigning.

Code after:
}

void AnimationMixer::_init_root_motion_cache() {
	root_motion_cache.loc = Vector3(0, 0, 0);
	root_motion_cache.rot = Quaternion(0, 0, 0, 1);
	root_motion_cache.scale = Vector3(1, 1, 1);
	root_motion_position = Vector3(0, 0, 0);
	root_motion_rotation = Quaternion(0, 0, 0, 1);
	root_motion_scale = Vector3(0, 0, 0);
	root_motion_position_accumulator = Vector3(0, 0, 0);
	root_motion_rotation_accumulator = Quaternion(0, 0, 0, 1);
	root_motion_scale_accumulator = Vector3(1, 1, 1);
}

bool AnimationMixer::_update_caches() {
	setup_pass++;

	root_motion_cache.loc = Vector3(0, 0, 0);
	root_motion_cache.rot = Quaternion(0, 0, 0, 1);
	root_motion_cache.scale = Vector3(1, 1, 1);

	List<StringName> sname;
	get_animation_list(&sname);

	bool check_path = GLOBAL_GET("animation/warnings/check_invalid_track_paths");
	bool check_angle_interpolation = GLOBAL_GET("animation/warnings/check_angle_interpolation_type_conflicting");

	Node *parent = get_node_or_null(root_node);
	if (!parent) {
		cache_valid = false;
		return false;
	}

#ifdef TOOLS_ENABLED
	String mixer_name = "AnimationMixer";
	const Node *owner = get_owner();
	if (owner) {
		const String scene_path = owner->get_scene_file_path();
		if (!scene_path.is_empty()) {
			mixer_name += vformat(" (at: %s)", scene_path.get_file());
		}
	}
#else
	const String mixer_name = "AnimationMixer";
#endif

	Ref<Animation> reset_anim;
	bool has_reset_anim = has_animation(SceneStringNames::get_singleton()->RESET);
	if (has_reset_anim) {
		reset_anim = get_animation(SceneStringNames::get_singleton()->RESET);
	}