跟随导出效果

This commit is contained in:
tianmo committed 2026-11-04 17:45:21 +08:00
1 parent 517e92a00b
commit 8977463861
9 files changed
+69 -28

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
interface ExportTimelineStore {
systems: Array<{ frames?: unknown[] }>
timeline: { playing: boolean; frame: number; recorded: boolean }
recalcTotalFrames(): unknown
}
/** Resume before yielding so the paused fallback bake cannot bypass emitter following. */
export function prepareTimelineForExport(store: ExportTimelineStore) {
store.timeline.playing = false
store.timeline.frame = 0
store.timeline.recorded = false
for (const system of store.systems) system.frames = undefined
store.recalcTotalFrames()
store.timeline.playing = true
}
@@ -25,6 +25,7 @@ import {
type SpineConnectorHealth,
} from '../../export/spineConnectorClient'
import { automaticLoopTransitionFrames } from '../../core/loopSegmentTiming'
import { prepareTimelineForExport } from '../../editor/exportTimeline'
export function useParticleExport(store: ReturnType<typeof useParticleStore>) {
@@ -110,13 +111,8 @@ function nextPaint() {
}
async function prepareExportFrames(onProgress?: (progress: number) => void) {
store.timeline.playing = false
store.timeline.frame = 0
store.timeline.recorded = false
for (const system of store.systems) system.frames = undefined
store.recalcTotalFrames()
prepareTimelineForExport(store)
await nextPaint()
store.timeline.playing = true
const expectedMs = store.timeline.totalFrames / Math.max(1, store.timeline.fps) * 1000
const deadline = performance.now() + Math.max(8000, expectedMs * 2.5 + 3000)
while (!store.timeline.recorded) {