Explorar o código

Merge pull request #66155 from KoBeWi/animat3d_diff

[3.x] Don't store frame of playing AnimatedSprite
Rémi Verschelde %!s(int64=2) %!d(string=hai) anos
pai
achega
90f6baf26c
Modificáronse 2 ficheiros con 12 adicións e 0 borrados
  1. 6 0
      scene/2d/animated_sprite.cpp
  2. 6 0
      scene/3d/sprite_3d.cpp

+ 6 - 0
scene/2d/animated_sprite.cpp

@@ -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 {

+ 6 - 0
scene/3d/sprite_3d.cpp

@@ -881,6 +881,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";
@@ -1033,6 +1038,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 {