Jelajahi Sumber

[cpp] Port of commit 9d49999: Changed SequenceTimeline to match AttachmentTimeline behavior.

Mario Zechner 10 bulan lalu
induk
melakukan
90f6bfe49e
1 mengubah file dengan 9 tambahan dan 4 penghapusan
  1. 9 4
      spine-cpp/spine-cpp/src/spine/SequenceTimeline.cpp

+ 9 - 4
spine-cpp/spine-cpp/src/spine/SequenceTimeline.cpp

@@ -74,6 +74,15 @@ void SequenceTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vec
 	if (slotAttachment != _attachment) {
 		if (slotAttachment == NULL || !slotAttachment->getRTTI().instanceOf(VertexAttachment::rtti) || ((VertexAttachment *) slotAttachment)->getTimelineAttachment() != _attachment) return;
 	}
+	Sequence *sequence = NULL;
+	if (_attachment->getRTTI().instanceOf(RegionAttachment::rtti)) sequence = ((RegionAttachment *) _attachment)->getSequence();
+	if (_attachment->getRTTI().instanceOf(MeshAttachment::rtti)) sequence = ((MeshAttachment *) _attachment)->getSequence();
+	if (!sequence) return;
+
+	if (direction == MixDirection_Out) {
+		if (blend == MixBlend_Setup) slot->setSequenceIndex(-1);
+		return;
+	}
 
 	Vector<float> &frames = this->_frames;
 	if (time < frames[0]) {// Time is before first frame.
@@ -86,10 +95,6 @@ void SequenceTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vec
 	int modeAndIndex = (int) frames[i + MODE];
 	float delay = frames[i + DELAY];
 
-	Sequence *sequence = NULL;
-	if (_attachment->getRTTI().instanceOf(RegionAttachment::rtti)) sequence = ((RegionAttachment *) _attachment)->getSequence();
-	if (_attachment->getRTTI().instanceOf(MeshAttachment::rtti)) sequence = ((MeshAttachment *) _attachment)->getSequence();
-	if (!sequence) return;
 	int index = modeAndIndex >> 4, count = (int) sequence->getRegions().size();
 	int mode = modeAndIndex & 0xf;
 	if (mode != SequenceMode::hold) {