-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
在处理 RotateTimeline 的逻辑中:
- 3.8
SpineSkeletonDataConverter/spine/spine-cpp-38/src/spine/AnimationState.cpp
Lines 722 to 743 in 0a4d1d2
float lastTotal, lastDiff; if (firstFrame) { lastTotal = 0; lastDiff = diff; } else { lastTotal = timelinesRotation[i]; // Angle and direction of mix, including loops. lastDiff = timelinesRotation[i + 1]; // Difference between bones. } bool current = diff > 0, dir = lastTotal >= 0; // Detect cross at 0 (not 180). if (MathUtil::sign(lastDiff) != MathUtil::sign(diff) && MathUtil::abs(lastDiff) <= 90) { // A cross after a 360 rotation is a loop. if (MathUtil::abs(lastTotal) > 180) lastTotal += 360 * MathUtil::sign(lastTotal); dir = current; } total = diff + lastTotal - MathUtil::fmod(lastTotal, 360); // Store loops as part of lastTotal. if (dir != current) { total += 360 * MathUtil::sign(lastTotal); } timelinesRotation[i] = total; - 4.2
SpineSkeletonDataConverter/spine/spine-cpp-42/src/spine/AnimationState.cpp
Lines 763 to 786 in 0a4d1d2
float lastTotal, lastDiff; if (firstFrame) { lastTotal = 0; lastDiff = diff; } else { lastTotal = timelinesRotation[i]; lastDiff = timelinesRotation[i + 1]; } float loops = lastTotal - MathUtil::fmod(lastTotal, 360.f); total = diff + loops; bool current = diff >= 0, dir = lastTotal >= 0; if (MathUtil::abs(lastDiff) <= 90 && MathUtil::sign(lastDiff) != MathUtil::sign(diff)) { if (MathUtil::abs(lastTotal - loops) > 180) { total += 360.f * MathUtil::sign(lastTotal); dir = current; } else if (loops != 0) total -= 360.f * MathUtil::sign(lastTotal); else dir = current; } if (dir != current) { total += 360 * MathUtil::sign(lastTotal); } timelinesRotation[i] = total;
两者在 处理序列 [0, 180, 0] 或者 [180, 0, 180] 的场合会有差异。
- 在 3.8 上视为 [0,180, 360]
- 在 4.2 上视为 [0, 180, 0]
而在读取/写入过程中,对于 rotate 的 timeline 并未专门进行处理,这会导致最终转换行为产生的动画效果并不相同。
Metadata
Metadata
Assignees
Labels
No labels