Add shorthand for using singleton string names
This commit is contained in:
@ -628,9 +628,9 @@ bool AnimationMixer::_update_caches() {
|
||||
#endif
|
||||
|
||||
Ref<Animation> reset_anim;
|
||||
bool has_reset_anim = has_animation(SceneStringNames::get_singleton()->RESET);
|
||||
bool has_reset_anim = has_animation(SceneStringName(RESET));
|
||||
if (has_reset_anim) {
|
||||
reset_anim = get_animation(SceneStringNames::get_singleton()->RESET);
|
||||
reset_anim = get_animation(SceneStringName(RESET));
|
||||
}
|
||||
for (const StringName &E : sname) {
|
||||
Ref<Animation> anim = get_animation(E);
|
||||
@ -1926,7 +1926,7 @@ bool AnimationMixer::is_reset_on_save_enabled() const {
|
||||
}
|
||||
|
||||
bool AnimationMixer::can_apply_reset() const {
|
||||
return has_animation(SceneStringNames::get_singleton()->RESET);
|
||||
return has_animation(SceneStringName(RESET));
|
||||
}
|
||||
|
||||
void AnimationMixer::_build_backup_track_cache() {
|
||||
@ -2013,7 +2013,7 @@ Ref<AnimatedValuesBackup> AnimationMixer::make_backup() {
|
||||
Ref<AnimatedValuesBackup> backup;
|
||||
backup.instantiate();
|
||||
|
||||
Ref<Animation> reset_anim = animation_set[SceneStringNames::get_singleton()->RESET].animation;
|
||||
Ref<Animation> reset_anim = animation_set[SceneStringName(RESET)].animation;
|
||||
ERR_FAIL_COND_V(reset_anim.is_null(), Ref<AnimatedValuesBackup>());
|
||||
|
||||
_blend_init();
|
||||
@ -2022,7 +2022,7 @@ Ref<AnimatedValuesBackup> AnimationMixer::make_backup() {
|
||||
pi.delta = 0;
|
||||
pi.seeked = true;
|
||||
pi.weight = 1.0;
|
||||
make_animation_instance(SceneStringNames::get_singleton()->RESET, pi);
|
||||
make_animation_instance(SceneStringName(RESET), pi);
|
||||
_build_backup_track_cache();
|
||||
|
||||
backup->set_data(track_cache);
|
||||
@ -2034,7 +2034,7 @@ Ref<AnimatedValuesBackup> AnimationMixer::make_backup() {
|
||||
void AnimationMixer::reset() {
|
||||
ERR_FAIL_COND(!can_apply_reset());
|
||||
|
||||
Ref<Animation> reset_anim = animation_set[SceneStringNames::get_singleton()->RESET].animation;
|
||||
Ref<Animation> reset_anim = animation_set[SceneStringName(RESET)].animation;
|
||||
ERR_FAIL_COND(reset_anim.is_null());
|
||||
|
||||
Node *root_node_object = get_node_or_null(root_node);
|
||||
@ -2044,11 +2044,11 @@ void AnimationMixer::reset() {
|
||||
root_node_object->add_child(aux_player);
|
||||
Ref<AnimationLibrary> al;
|
||||
al.instantiate();
|
||||
al->add_animation(SceneStringNames::get_singleton()->RESET, reset_anim);
|
||||
al->add_animation(SceneStringName(RESET), reset_anim);
|
||||
aux_player->set_reset_on_save_enabled(false);
|
||||
aux_player->set_root_node(aux_player->get_path_to(root_node_object));
|
||||
aux_player->add_animation_library("", al);
|
||||
aux_player->set_assigned_animation(SceneStringNames::get_singleton()->RESET);
|
||||
aux_player->set_assigned_animation(SceneStringName(RESET));
|
||||
aux_player->seek(0.0f, true);
|
||||
aux_player->queue_free();
|
||||
}
|
||||
@ -2068,7 +2068,7 @@ Ref<AnimatedValuesBackup> AnimationMixer::apply_reset(bool p_user_initiated) {
|
||||
}
|
||||
ERR_FAIL_COND_V(!can_apply_reset(), Ref<AnimatedValuesBackup>());
|
||||
|
||||
Ref<Animation> reset_anim = animation_set[SceneStringNames::get_singleton()->RESET].animation;
|
||||
Ref<Animation> reset_anim = animation_set[SceneStringName(RESET)].animation;
|
||||
ERR_FAIL_COND_V(reset_anim.is_null(), Ref<AnimatedValuesBackup>());
|
||||
|
||||
Ref<AnimatedValuesBackup> backup_current = make_backup();
|
||||
@ -2286,7 +2286,7 @@ void AnimationMixer::_bind_methods() {
|
||||
}
|
||||
|
||||
AnimationMixer::AnimationMixer() {
|
||||
root_node = SceneStringNames::get_singleton()->path_pp;
|
||||
root_node = SceneStringName(path_pp);
|
||||
}
|
||||
|
||||
AnimationMixer::~AnimationMixer() {
|
||||
|
||||
Reference in New Issue
Block a user