@@ -19,7 +19,9 @@ import {
1919import { useEntitiesStore } from "@/store/next/entities" ;
2020import {
2121 buildWorkflowSteps ,
22+ getWorkflowStepCaptureSettings ,
2223 type BuildWorkflowStepsInput ,
24+ type WorkflowCaptureSettings ,
2325 type WorkflowStep ,
2426} from "@/utils/workflows" ;
2527import {
@@ -198,7 +200,11 @@ async function setStepAnimation(
198200 if ( ! clip ) return ;
199201
200202 if ( options ?. forceAnimationsInPlace ) {
201- modelState . forceCurrentAnimationInPlace ( step . modelUuid , step . animationName ) ;
203+ modelState . forceCurrentAnimationInPlace (
204+ step . modelUuid ,
205+ step . animationName ,
206+ options . forceAnimationsInPlaceMode ,
207+ ) ;
202208 }
203209
204210 const currentAnimation = modelState . animations [ step . modelUuid ] ;
@@ -208,10 +214,6 @@ async function setStepAnimation(
208214 : Promise . resolve ( ) ;
209215
210216 modelState . setAnimation ( step . modelUuid , step . animationName ) ;
211- modelState . setDuration ( step . modelUuid , step . animationName , [
212- 0 ,
213- clip . clip . duration ,
214- ] ) ;
215217 modelState . mixerRef [ step . modelUuid ] ?. setTime ( 0 ) ;
216218
217219 await waiter ;
@@ -295,8 +297,10 @@ export const useWorkflow = () => {
295297
296298 const cameraDistance = useSettingsStore . getState ( ) . cameraDistance ;
297299 const cameraAngle = useSettingsStore . getState ( ) . cameraAngle ;
298- const intervals = useImagesStore . getState ( ) . intervals ;
299- const iterations = useImagesStore . getState ( ) . iterations ;
300+ const defaultCaptureSettings : WorkflowCaptureSettings = {
301+ frameIntervalMs : useImagesStore . getState ( ) . intervals ,
302+ frameCount : useImagesStore . getState ( ) . iterations ,
303+ } ;
300304 const cameraUUID = useCamerasStore . getState ( ) . mainCamera ;
301305 const mainCameraType = cameraUUID
302306 ? useCamerasStore . getState ( ) . cameras [ cameraUUID ] ?. type
@@ -314,7 +318,7 @@ export const useWorkflow = () => {
314318 currentStep : 0 ,
315319 totalSteps : steps . length ,
316320 currentFrame : 0 ,
317- expectedFrames : iterations ,
321+ expectedFrames : defaultCaptureSettings . frameCount ,
318322 currentLabel : "" ,
319323 currentAnimation : "" ,
320324 currentDirection : "" ,
@@ -327,12 +331,17 @@ export const useWorkflow = () => {
327331
328332 const step = steps [ index ] ;
329333 const dir = getDirectionForStep ( workflow , step ) ;
334+ const captureSettings = getWorkflowStepCaptureSettings (
335+ step ,
336+ options ?. captureSettingsByAnimation ,
337+ defaultCaptureSettings ,
338+ ) ;
330339
331340 setWorkflowState ( ( prev ) => ( {
332341 ...prev ,
333342 currentStep : index + 1 ,
334343 currentFrame : 0 ,
335- expectedFrames : iterations ,
344+ expectedFrames : captureSettings . frameCount ,
336345 currentLabel : step . rowLabel ,
337346 currentAnimation : step . animationName ,
338347 currentDirection : step . directionLabel ,
@@ -377,14 +386,18 @@ export const useWorkflow = () => {
377386 const captureDone = waitForCaptureDone ( {
378387 label : step . rowLabel ,
379388 workflowRunId,
380- timeoutMs : intervals * iterations + CAPTURE_TIMEOUT_BUFFER_MS ,
389+ timeoutMs :
390+ captureSettings . frameIntervalMs * captureSettings . frameCount +
391+ CAPTURE_TIMEOUT_BUFFER_MS ,
381392 } ) ;
382393
383394 PubSub . emit ( EventType . START_ASSETS_CREATION , {
384395 label : step . rowLabel ,
385396 workflowRunId,
386397 stepIndex : index + 1 ,
387398 totalSteps : steps . length ,
399+ frameIntervalMs : captureSettings . frameIntervalMs ,
400+ frameCount : captureSettings . frameCount ,
388401 rowMetadata : {
389402 workflow : {
390403 workflowId : workflow . id ,
0 commit comments