@babylonjs/viewer
Version:
The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.
3 lines (2 loc) • 2.17 kB
JavaScript
import{R as t,d as i}from"./declarationMapper-D_filC93.esm.min.js";import{y as e,u as n}from"./index-BPURObVq.esm.min.js";import{b as o}from"./KHR_interactivity-D4lwBSW9.esm.min.js";import"./objectModelMapping-ClgDmo5Q.esm.min.js";import"./spotLight.pure-5s2DDDIt.esm.min.js";class a extends o{constructor(e){super(e),this.animationGroup=this.registerDataInput("animationGroup",t),this.stopAtFrame=this.registerDataInput("stopAtFrame",i,-1)}_preparePendingTasks(t){const i=this.animationGroup.getValue(t),e=this.stopAtFrame.getValue(t)??-1,n=t._getGlobalContextVariable("pendingStopAnimations",[]);n.push({uniqueId:i.uniqueId,stopAtFrame:e}),t._setGlobalContextVariable("pendingStopAnimations",n)}_cancelPendingTasks(t){const i=this.animationGroup.getValue(t),e=t._getGlobalContextVariable("pendingStopAnimations",[]);for(let n=0;n<e.length;n++)if(e[n].uniqueId===i.uniqueId){e.splice(n,1),t._setGlobalContextVariable("pendingStopAnimations",e);break}}_execute(t){const i=this.animationGroup.getValue(t),n=this.stopAtFrame.getValue(t)??-1;return i?isNaN(n)?this._reportError(t,"Invalid stop time."):(n>0?this._startPendingTasks(t):this._stopAnimation(i,t),void this.out._activateSignal(t)):(e.Warn("No animation group provided to stop."),this._reportError(t,"No animation group provided to stop."))}_executeOnTick(t){const i=this.animationGroup.getValue(t),e=t._getGlobalContextVariable("pendingStopAnimations",[]);for(let n=0;n<e.length;n++)if(e[n].uniqueId===i.uniqueId&&i.getCurrentFrame()>=e[n].stopAtFrame){this._stopAnimation(i,t),e.splice(n,1),t._setGlobalContextVariable("pendingStopAnimations",e),this.done._activateSignal(t),t._removePendingBlock(this);break}}getClassName(){return"FlowGraphStopAnimationBlock"}_stopAnimation(t,i){const e=i._getGlobalContextVariable("currentlyRunningAnimationGroups",[]),n=e.indexOf(t.uniqueId);-1!==n&&(t.stop(),e.splice(n,1),i._setGlobalContextVariable("currentlyRunningAnimationGroups",e))}}let s=!1;function r(){s||(s=!0,n("FlowGraphStopAnimationBlock",a))}r();export{a as FlowGraphStopAnimationBlock,r as RegisterFlowGraphStopAnimationBlock};
//# sourceMappingURL=flowGraphStopAnimationBlock-rdvA8srH.esm.min.js.map