Don't store frame of playing AnimatedSprite

This commit is contained in:
kobewi 2022-09-20 12:49:47 +02:00 committed by Relintai
parent 9762395888
commit 903c9932e5
2 changed files with 12 additions and 0 deletions

View File

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

View File

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