瀏覽代碼

Merge pull request #85221 from TokageItLab/clear-seek-flg

Clear seeked/started flag after seeking/advancing in AnimationPlayer
Rémi Verschelde 1 年之前
父節點
當前提交
1524972aa5
共有 2 個文件被更改,包括 9 次插入0 次删除
  1. 7 0
      scene/animation/animation_player.cpp
  2. 2 0
      scene/animation/animation_player.h

+ 7 - 0
scene/animation/animation_player.cpp

@@ -534,12 +534,19 @@ void AnimationPlayer::seek(double p_time, bool p_update, bool p_update_only) {
 		}
 	}
 
+	playback.started = false; // Start has already gone by seeking, delta does not need to be 0 in the internal process.
 	playback.seeked = true;
 	if (p_update) {
 		_process_animation(0, p_update_only);
+		playback.seeked = false; // If animation was proceeded here, no more seek in internal process.
 	}
 }
 
+void AnimationPlayer::advance(double p_time) {
+	playback.started = false; // Start has already gone by advancing, delta does not need to be 0 in the internal process.
+	AnimationMixer::advance(p_time);
+}
+
 bool AnimationPlayer::is_valid() const {
 	return (playback.current.from);
 }

+ 2 - 0
scene/animation/animation_player.h

@@ -183,6 +183,8 @@ public:
 
 	void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
 
+	virtual void advance(double p_time) override;
+
 	AnimationPlayer();
 	~AnimationPlayer();
 };