Don't store frame of playing AnimatedSprite

This commit is contained in:
kobewi 2022-09-20 12:49:47 +02:00
parent 0784bff4d9
commit dbce96abd9
2 changed files with 12 additions and 0 deletions

View file

@ -347,6 +347,11 @@ void AnimatedSprite::_validate_property(PropertyInfo &property) const {
}
if (property.name == "frame") {
if (playing) {
property.usage = PROPERTY_USAGE_EDITOR;
return;
}
property.hint = PROPERTY_HINT_RANGE;
if (frames->has_animation(animation) && frames->get_frame_count(animation) > 1) {
property.hint_string = "0," + itos(frames->get_frame_count(animation) - 1) + ",1";
@ -590,6 +595,7 @@ void AnimatedSprite::set_playing(bool p_playing) {
playing = p_playing;
_reset_timeout();
set_process_internal(playing);
property_list_changed_notify();
}
bool AnimatedSprite::is_playing() const {

View file

@ -987,6 +987,11 @@ void AnimatedSprite3D::_validate_property(PropertyInfo &property) const {
}
if (property.name == "frame") {
if (playing) {
property.usage = PROPERTY_USAGE_EDITOR;
return;
}
property.hint = PROPERTY_HINT_RANGE;
if (frames->has_animation(animation) && frames->get_frame_count(animation) > 1) {
property.hint_string = "0," + itos(frames->get_frame_count(animation) - 1) + ",1";
@ -1139,6 +1144,7 @@ void AnimatedSprite3D::_set_playing(bool p_playing) {
playing = p_playing;
_reset_timeout();
set_process_internal(playing);
property_list_changed_notify();
}
bool AnimatedSprite3D::_is_playing() const {