@babylonjs/core 6.12.5 → 6.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -135,6 +135,15 @@ export declare class AnimationGroup implements IDisposable {
135
135
  */
136
136
  get playOrder(): number;
137
137
  set playOrder(value: number);
138
+ /**
139
+ * Merge the array of animation groups into a new animation group
140
+ * @param animationGroups List of animation groups to merge
141
+ * @param disposeSource If true, animation groups will be disposed after being merged (default: true)
142
+ * @param normalize If true, animation groups will be normalized before being merged, so that all animations have the same "from" and "to" frame (default: false)
143
+ * @param weight Weight for the new animation group. If not provided, it will inherit the weight from the first animation group of the array
144
+ * @returns The new animation group or null if no animation groups were passed
145
+ */
146
+ static MergeAnimationGroups(animationGroups: Array<AnimationGroup>, disposeSource?: boolean, normalize?: boolean, weight?: number): Nullable<AnimationGroup>;
138
147
  /**
139
148
  * Instantiates a new Animation Group.
140
149
  * This helps managing several animations at once.
@@ -152,6 +152,45 @@ export class AnimationGroup {
152
152
  this._scene.sortActiveAnimatables();
153
153
  }
154
154
  }
155
+ /**
156
+ * Merge the array of animation groups into a new animation group
157
+ * @param animationGroups List of animation groups to merge
158
+ * @param disposeSource If true, animation groups will be disposed after being merged (default: true)
159
+ * @param normalize If true, animation groups will be normalized before being merged, so that all animations have the same "from" and "to" frame (default: false)
160
+ * @param weight Weight for the new animation group. If not provided, it will inherit the weight from the first animation group of the array
161
+ * @returns The new animation group or null if no animation groups were passed
162
+ */
163
+ static MergeAnimationGroups(animationGroups, disposeSource = true, normalize = false, weight) {
164
+ if (animationGroups.length === 0) {
165
+ return null;
166
+ }
167
+ weight = weight !== null && weight !== void 0 ? weight : animationGroups[0].weight;
168
+ let beginFrame = Number.MAX_VALUE;
169
+ let endFrame = Number.MIN_VALUE;
170
+ if (normalize) {
171
+ for (const animationGroup of animationGroups) {
172
+ if (animationGroup.from < beginFrame) {
173
+ beginFrame = animationGroup.from;
174
+ }
175
+ if (animationGroup.to > endFrame) {
176
+ endFrame = animationGroup.to;
177
+ }
178
+ }
179
+ }
180
+ const mergedAnimationGroup = new AnimationGroup(animationGroups[0].name + "_merged", animationGroups[0]._scene, weight);
181
+ for (const animationGroup of animationGroups) {
182
+ if (normalize) {
183
+ animationGroup.normalize(beginFrame, endFrame);
184
+ }
185
+ for (const targetedAnimation of animationGroup.targetedAnimations) {
186
+ mergedAnimationGroup.addTargetedAnimation(targetedAnimation.animation, targetedAnimation.target);
187
+ }
188
+ if (disposeSource) {
189
+ animationGroup.dispose();
190
+ }
191
+ }
192
+ return mergedAnimationGroup;
193
+ }
155
194
  /**
156
195
  * Instantiates a new Animation Group.
157
196
  * This helps managing several animations at once.
@@ -1 +1 @@
1
- {"version":3,"file":"animationGroup.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/animationGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAU1B;;;OAGG;IACI,YAAY;QACf,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAQ,EAAE,CAAC;QACpC,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QAC3D,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAE9C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,cAAc;IA0DvB;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,EAAE;QACT,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BAAkB,CAAC,KAAK,CAAC,CAAC;YACpD,SAAS,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;SACvF;QAED,cAAc,CAAC,UAAU,GAAG,IAAI,CAAC;QAEjC,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,WAAqB;QACjC,IAAI,GAAG,GAAG,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;QAC/B,GAAG,IAAI,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACxC,IAAI,WAAW,EAAE;YACb,GAAG,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;YAC/B,GAAG,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC;YAC3B,GAAG,IAAI,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC;YACzC,GAAG,IAAI,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC;YAC3C,GAAG,IAAI,+BAA+B,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;YACzE,GAAG,IAAI,wBAAwB,GAAG,IAAI,CAAC,YAAY,CAAC;SACvD;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ","sourcesContent":["import type { Animatable } from \"./animatable\";\r\nimport { Animation } from \"./animation\";\r\nimport type { IAnimationKey } from \"./animationKey\";\r\n\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\nimport type { AbstractScene } from \"../abstractScene\";\r\nimport { Tags } from \"../Misc/tags\";\r\n\r\n/**\r\n * This class defines the direct association between an animation and a target\r\n */\r\nexport class TargetedAnimation {\r\n /**\r\n * Animation to perform\r\n */\r\n public animation: Animation;\r\n /**\r\n * Target to animate\r\n */\r\n public target: any;\r\n\r\n /**\r\n * Returns the string \"TargetedAnimation\"\r\n * @returns \"TargetedAnimation\"\r\n */\r\n public getClassName(): string {\r\n return \"TargetedAnimation\";\r\n }\r\n\r\n /**\r\n * Serialize the object\r\n * @returns the JSON object representing the current entity\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.animation = this.animation.serialize();\r\n serializationObject.targetId = this.target.id;\r\n\r\n return serializationObject;\r\n }\r\n}\r\n\r\n/**\r\n * Use this class to create coordinated animations on multiple targets\r\n */\r\nexport class AnimationGroup implements IDisposable {\r\n private _scene: Scene;\r\n\r\n private _targetedAnimations = new Array<TargetedAnimation>();\r\n private _animatables = new Array<Animatable>();\r\n private _from = Number.MAX_VALUE;\r\n private _to = -Number.MAX_VALUE;\r\n private _isStarted: boolean;\r\n private _isPaused: boolean;\r\n private _speedRatio = 1;\r\n private _loopAnimation = false;\r\n private _isAdditive = false;\r\n private _weight = -1;\r\n private _playOrder = 0;\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * This observable will notify when one animation have ended\r\n */\r\n public onAnimationEndObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when one animation loops\r\n */\r\n public onAnimationLoopObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when all animations have looped\r\n */\r\n public onAnimationGroupLoopObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have ended.\r\n */\r\n public onAnimationGroupEndObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have paused.\r\n */\r\n public onAnimationGroupPauseObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations are playing.\r\n */\r\n public onAnimationGroupPlayObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n public metadata: any = null;\r\n\r\n /**\r\n * Gets the first frame\r\n */\r\n public get from(): number {\r\n return this._from;\r\n }\r\n\r\n /**\r\n * Gets the last frame\r\n */\r\n public get to(): number {\r\n return this._to;\r\n }\r\n\r\n /**\r\n * Define if the animations are started\r\n */\r\n public get isStarted(): boolean {\r\n return this._isStarted;\r\n }\r\n\r\n /**\r\n * Gets a value indicating that the current group is playing\r\n */\r\n public get isPlaying(): boolean {\r\n return this._isStarted && !this._isPaused;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public get speedRatio(): number {\r\n return this._speedRatio;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public set speedRatio(value: number) {\r\n if (this._speedRatio === value) {\r\n return;\r\n }\r\n\r\n this._speedRatio = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.speedRatio = this._speedRatio;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should loop or not\r\n */\r\n public get loopAnimation(): boolean {\r\n return this._loopAnimation;\r\n }\r\n\r\n public set loopAnimation(value: boolean) {\r\n if (this._loopAnimation === value) {\r\n return;\r\n }\r\n\r\n this._loopAnimation = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.loopAnimation = this._loopAnimation;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should be evaluated additively\r\n */\r\n public get isAdditive(): boolean {\r\n return this._isAdditive;\r\n }\r\n\r\n public set isAdditive(value: boolean) {\r\n if (this._isAdditive === value) {\r\n return;\r\n }\r\n\r\n this._isAdditive = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.isAdditive = this._isAdditive;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the weight to apply to all animations of the group\r\n */\r\n public get weight(): number {\r\n return this._weight;\r\n }\r\n\r\n public set weight(value: number) {\r\n if (this._weight === value) {\r\n return;\r\n }\r\n\r\n this._weight = value;\r\n this.setWeightForAllAnimatables(this._weight);\r\n }\r\n\r\n /**\r\n * Gets the targeted animations for this animation group\r\n */\r\n public get targetedAnimations(): Array<TargetedAnimation> {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * returning the list of animatables controlled by this animation group.\r\n */\r\n public get animatables(): Array<Animatable> {\r\n return this._animatables;\r\n }\r\n\r\n /**\r\n * Gets the list of target animations\r\n */\r\n public get children() {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * Gets or sets the order of play of the animation group (default: 0)\r\n */\r\n public get playOrder() {\r\n return this._playOrder;\r\n }\r\n\r\n public set playOrder(value: number) {\r\n if (this._playOrder === value) {\r\n return;\r\n }\r\n\r\n this._playOrder = value;\r\n\r\n if (this._animatables.length > 0) {\r\n for (let i = 0; i < this._animatables.length; i++) {\r\n this._animatables[i].playOrder = this._playOrder;\r\n }\r\n\r\n this._scene.sortActiveAnimatables();\r\n }\r\n }\r\n\r\n /**\r\n * Instantiates a new Animation Group.\r\n * This helps managing several animations at once.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\r\n * @param name Defines the name of the group\r\n * @param scene Defines the scene the group belongs to\r\n * @param weight Defines the weight to use for animations in the group (-1.0 by default, meaning \"no weight\")\r\n * @param playOrder Defines the order of play of the animation group (default is 0)\r\n */\r\n public constructor(\r\n /** The name of the animation group */\r\n public name: string,\r\n scene: Nullable<Scene> = null,\r\n weight = -1,\r\n playOrder = 0\r\n ) {\r\n this._scene = scene || EngineStore.LastCreatedScene!;\r\n this._weight = weight;\r\n this._playOrder = playOrder;\r\n this.uniqueId = this._scene.getUniqueId();\r\n\r\n this._scene.addAnimationGroup(this);\r\n }\r\n\r\n /**\r\n * Add an animation (with its target) in the group\r\n * @param animation defines the animation we want to add\r\n * @param target defines the target of the animation\r\n * @returns the TargetedAnimation object\r\n */\r\n public addTargetedAnimation(animation: Animation, target: any): TargetedAnimation {\r\n const targetedAnimation = new TargetedAnimation();\r\n targetedAnimation.animation = animation;\r\n targetedAnimation.target = target;\r\n\r\n const keys = animation.getKeys();\r\n if (this._from > keys[0].frame) {\r\n this._from = keys[0].frame;\r\n }\r\n\r\n if (this._to < keys[keys.length - 1].frame) {\r\n this._to = keys[keys.length - 1].frame;\r\n }\r\n\r\n this._targetedAnimations.push(targetedAnimation);\r\n\r\n return targetedAnimation;\r\n }\r\n\r\n /**\r\n * Remove an animation from the group\r\n * @param animation defines the animation we want to remove\r\n */\r\n public removeTargetedAnimation(animation: Animation) {\r\n for (let index = this._targetedAnimations.length - 1; index > -1; index--) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n if (targetedAnimation.animation === animation) {\r\n this._targetedAnimations.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\r\n * It can add constant keys at begin or end\r\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\r\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\r\n * @returns the animation group\r\n */\r\n public normalize(beginFrame: Nullable<number> = null, endFrame: Nullable<number> = null): AnimationGroup {\r\n if (beginFrame == null) {\r\n beginFrame = this._from;\r\n }\r\n if (endFrame == null) {\r\n endFrame = this._to;\r\n }\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const keys = targetedAnimation.animation.getKeys();\r\n const startKey = keys[0];\r\n const endKey = keys[keys.length - 1];\r\n\r\n if (startKey.frame > beginFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: beginFrame,\r\n value: startKey.value,\r\n inTangent: startKey.inTangent,\r\n outTangent: startKey.outTangent,\r\n interpolation: startKey.interpolation,\r\n };\r\n keys.splice(0, 0, newKey);\r\n }\r\n\r\n if (endKey.frame < endFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: endFrame,\r\n value: endKey.value,\r\n inTangent: endKey.inTangent,\r\n outTangent: endKey.outTangent,\r\n interpolation: endKey.interpolation,\r\n };\r\n keys.push(newKey);\r\n }\r\n }\r\n\r\n this._from = beginFrame;\r\n this._to = endFrame;\r\n\r\n return this;\r\n }\r\n\r\n private _animationLoopCount: number;\r\n private _animationLoopFlags: boolean[] = [];\r\n\r\n private _processLoop(animatable: Animatable, targetedAnimation: TargetedAnimation, index: number) {\r\n animatable.onAnimationLoop = () => {\r\n this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\r\n\r\n if (this._animationLoopFlags[index]) {\r\n return;\r\n }\r\n\r\n this._animationLoopFlags[index] = true;\r\n\r\n this._animationLoopCount++;\r\n if (this._animationLoopCount === this._targetedAnimations.length) {\r\n this.onAnimationGroupLoopObservable.notifyObservers(this);\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Start all animations on given targets\r\n * @param loop defines if animations must loop\r\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\r\n * @param from defines the from key (optional)\r\n * @param to defines the to key (optional)\r\n * @param isAdditive defines the additive state for the resulting animatables (optional)\r\n * @returns the current animation group\r\n */\r\n public start(loop = false, speedRatio = 1, from?: number, to?: number, isAdditive?: boolean): AnimationGroup {\r\n if (this._isStarted || this._targetedAnimations.length === 0) {\r\n return this;\r\n }\r\n\r\n this._loopAnimation = loop;\r\n\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const animatable = this._scene.beginDirectAnimation(\r\n targetedAnimation.target,\r\n [targetedAnimation.animation],\r\n from !== undefined ? from : this._from,\r\n to !== undefined ? to : this._to,\r\n loop,\r\n speedRatio,\r\n undefined,\r\n undefined,\r\n isAdditive !== undefined ? isAdditive : this._isAdditive\r\n );\r\n animatable.weight = this._weight;\r\n animatable.playOrder = this._playOrder;\r\n animatable.onAnimationEnd = () => {\r\n this.onAnimationEndObservable.notifyObservers(targetedAnimation);\r\n this._checkAnimationGroupEnded(animatable);\r\n };\r\n\r\n this._processLoop(animatable, targetedAnimation, index);\r\n this._animatables.push(animatable);\r\n }\r\n\r\n this._scene.sortActiveAnimatables();\r\n\r\n this._speedRatio = speedRatio;\r\n\r\n this._isStarted = true;\r\n this._isPaused = false;\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Pause all animations\r\n * @returns the animation group\r\n */\r\n public pause(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n this._isPaused = true;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.pause();\r\n }\r\n\r\n this.onAnimationGroupPauseObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Play all animations to initial state\r\n * This function will start() the animations if they were not started or will restart() them if they were paused\r\n * @param loop defines if animations must loop\r\n * @returns the animation group\r\n */\r\n public play(loop?: boolean): AnimationGroup {\r\n // only if all animatables are ready and exist\r\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\r\n if (loop !== undefined) {\r\n this.loopAnimation = loop;\r\n }\r\n this.restart();\r\n } else {\r\n this.stop();\r\n this.start(loop, this._speedRatio);\r\n }\r\n\r\n this._isPaused = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Reset all animations to initial state\r\n * @returns the animation group\r\n */\r\n public reset(): AnimationGroup {\r\n if (!this._isStarted) {\r\n this.play();\r\n this.goToFrame(0);\r\n this.stop();\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.reset();\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Restart animations from key 0\r\n * @returns the animation group\r\n */\r\n public restart(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.restart();\r\n }\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Stop all animations\r\n * @returns the animation group\r\n */\r\n public stop(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n const list = this._animatables.slice();\r\n for (let index = 0; index < list.length; index++) {\r\n list[index].stop(undefined, undefined, true);\r\n }\r\n\r\n // We will take care of removing all stopped animatables\r\n let curIndex = 0;\r\n for (let index = 0; index < this._scene._activeAnimatables.length; index++) {\r\n const animatable = this._scene._activeAnimatables[index];\r\n if (animatable._runtimeAnimations.length > 0) {\r\n this._scene._activeAnimatables[curIndex++] = animatable;\r\n }\r\n }\r\n this._scene._activeAnimatables.length = curIndex;\r\n\r\n this._isStarted = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Set animation weight for all animatables\r\n *\r\n * @since 6.12.4\r\n * You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created,\r\n * making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started\r\n * @param weight defines the weight to use\r\n * @returns the animationGroup\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\r\n */\r\n public setWeightForAllAnimatables(weight: number): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.weight = weight;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Synchronize and normalize all animatables with a source animatable\r\n * @param root defines the root animatable to synchronize with (null to stop synchronizing)\r\n * @returns the animationGroup\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\r\n */\r\n public syncAllAnimationsWith(root: Nullable<Animatable>): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.syncWith(root);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Goes to a specific frame in this animation group\r\n * @param frame the frame number to go to\r\n * @returns the animationGroup\r\n */\r\n public goToFrame(frame: number): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.goToFrame(frame);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Dispose all associated resources\r\n */\r\n public dispose(): void {\r\n this._targetedAnimations.length = 0;\r\n this._animatables.length = 0;\r\n\r\n // Remove from scene\r\n const index = this._scene.animationGroups.indexOf(this);\r\n\r\n if (index > -1) {\r\n this._scene.animationGroups.splice(index, 1);\r\n }\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.animationGroups.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.animationGroups.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n this.onAnimationEndObservable.clear();\r\n this.onAnimationGroupEndObservable.clear();\r\n this.onAnimationGroupPauseObservable.clear();\r\n this.onAnimationGroupPlayObservable.clear();\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationGroupLoopObservable.clear();\r\n }\r\n\r\n private _checkAnimationGroupEnded(animatable: Animatable) {\r\n // animatable should be taken out of the array\r\n const idx = this._animatables.indexOf(animatable);\r\n if (idx > -1) {\r\n this._animatables.splice(idx, 1);\r\n }\r\n\r\n // all animatables were removed? animation group ended!\r\n if (this._animatables.length === 0) {\r\n this._isStarted = false;\r\n this.onAnimationGroupEndObservable.notifyObservers(this);\r\n }\r\n }\r\n\r\n /**\r\n * Clone the current animation group and returns a copy\r\n * @param newName defines the name of the new group\r\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\r\n * @param cloneAnimations defines if the animations should be cloned or referenced\r\n * @returns the new animation group\r\n */\r\n public clone(newName: string, targetConverter?: (oldTarget: any) => any, cloneAnimations = false): AnimationGroup {\r\n const newGroup = new AnimationGroup(newName || this.name, this._scene);\r\n\r\n for (const targetAnimation of this._targetedAnimations) {\r\n newGroup.addTargetedAnimation(\r\n cloneAnimations ? targetAnimation.animation.clone() : targetAnimation.animation,\r\n targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target\r\n );\r\n }\r\n\r\n return newGroup;\r\n }\r\n\r\n /**\r\n * Serializes the animationGroup to an object\r\n * @returns Serialized object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.from = this.from;\r\n serializationObject.to = this.to;\r\n serializationObject.targetedAnimations = [];\r\n for (let targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\r\n const targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\r\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\r\n }\r\n\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n\r\n // Metadata\r\n if (this.metadata) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Returns a new AnimationGroup object parsed from the source provided.\r\n * @param parsedAnimationGroup defines the source\r\n * @param scene defines the scene that will receive the animationGroup\r\n * @returns a new AnimationGroup\r\n */\r\n public static Parse(parsedAnimationGroup: any, scene: Scene): AnimationGroup {\r\n const animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\r\n for (let i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\r\n const targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\r\n const animation = Animation.Parse(targetedAnimation.animation);\r\n const id = targetedAnimation.targetId;\r\n if (targetedAnimation.animation.property === \"influence\") {\r\n // morph target animation\r\n const morphTarget = scene.getMorphTargetById(id);\r\n if (morphTarget) {\r\n animationGroup.addTargetedAnimation(animation, morphTarget);\r\n }\r\n } else {\r\n const targetNode = scene.getNodeById(id);\r\n\r\n if (targetNode != null) {\r\n animationGroup.addTargetedAnimation(animation, targetNode);\r\n }\r\n }\r\n }\r\n\r\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {\r\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\r\n }\r\n\r\n if (Tags) {\r\n Tags.AddTagsTo(animationGroup, parsedAnimationGroup.tags);\r\n }\r\n\r\n if (parsedAnimationGroup.metadata !== undefined) {\r\n animationGroup.metadata = parsedAnimationGroup.metadata;\r\n }\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\r\n * @param sourceAnimationGroup defines the AnimationGroup containing animations to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the animations in the group to convert\r\n * @param cloneOriginal defines whether or not to clone the group and convert the clone or convert the original group (default is false)\r\n * @param clonedName defines the name of the resulting cloned AnimationGroup if cloneOriginal is true\r\n * @returns a new AnimationGroup if cloneOriginal is true or the original AnimationGroup if cloneOriginal is false\r\n */\r\n public static MakeAnimationAdditive(sourceAnimationGroup: AnimationGroup, referenceFrame = 0, range?: string, cloneOriginal = false, clonedName?: string): AnimationGroup {\r\n let animationGroup = sourceAnimationGroup;\r\n if (cloneOriginal) {\r\n animationGroup = sourceAnimationGroup.clone(clonedName || animationGroup.name);\r\n }\r\n\r\n const targetedAnimations = animationGroup.targetedAnimations;\r\n for (let index = 0; index < targetedAnimations.length; index++) {\r\n const targetedAnimation = targetedAnimations[index];\r\n Animation.MakeAnimationAdditive(targetedAnimation.animation, referenceFrame, range);\r\n }\r\n\r\n animationGroup.isAdditive = true;\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Returns the string \"AnimationGroup\"\r\n * @returns \"AnimationGroup\"\r\n */\r\n public getClassName(): string {\r\n return \"AnimationGroup\";\r\n }\r\n\r\n /**\r\n * Creates a detailed string about the object\r\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\r\n * @returns a string representing the object\r\n */\r\n public toString(fullDetails?: boolean): string {\r\n let ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (fullDetails) {\r\n ret += \", from: \" + this._from;\r\n ret += \", to: \" + this._to;\r\n ret += \", isStarted: \" + this._isStarted;\r\n ret += \", speedRatio: \" + this._speedRatio;\r\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\r\n ret += \", animatables length: \" + this._animatables;\r\n }\r\n return ret;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"animationGroup.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/animationGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAU1B;;;OAGG;IACI,YAAY;QACf,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAQ,EAAE,CAAC;QACpC,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QAC3D,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAE9C,OAAO,mBAAmB,CAAC;IAC/B,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,cAAc;IA0DvB;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,EAAE;QACT,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAW,SA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BAAiB,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;SACvF;QAED,cAAc,CAAC,UAAU,GAAG,IAAI,CAAC;QAEjC,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,QAAQ,CAAC,WAAqB;QACjC,IAAI,GAAG,GAAG,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;QAC/B,GAAG,IAAI,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACxC,IAAI,WAAW,EAAE;YACb,GAAG,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;YAC/B,GAAG,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC;YAC3B,GAAG,IAAI,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC;YACzC,GAAG,IAAI,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC;YAC3C,GAAG,IAAI,+BAA+B,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;YACzE,GAAG,IAAI,wBAAwB,GAAG,IAAI,CAAC,YAAY,CAAC;SACvD;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ","sourcesContent":["import type { Animatable } from \"./animatable\";\r\nimport { Animation } from \"./animation\";\r\nimport type { IAnimationKey } from \"./animationKey\";\r\n\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\nimport type { AbstractScene } from \"../abstractScene\";\r\nimport { Tags } from \"../Misc/tags\";\r\n\r\n/**\r\n * This class defines the direct association between an animation and a target\r\n */\r\nexport class TargetedAnimation {\r\n /**\r\n * Animation to perform\r\n */\r\n public animation: Animation;\r\n /**\r\n * Target to animate\r\n */\r\n public target: any;\r\n\r\n /**\r\n * Returns the string \"TargetedAnimation\"\r\n * @returns \"TargetedAnimation\"\r\n */\r\n public getClassName(): string {\r\n return \"TargetedAnimation\";\r\n }\r\n\r\n /**\r\n * Serialize the object\r\n * @returns the JSON object representing the current entity\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n serializationObject.animation = this.animation.serialize();\r\n serializationObject.targetId = this.target.id;\r\n\r\n return serializationObject;\r\n }\r\n}\r\n\r\n/**\r\n * Use this class to create coordinated animations on multiple targets\r\n */\r\nexport class AnimationGroup implements IDisposable {\r\n private _scene: Scene;\r\n\r\n private _targetedAnimations = new Array<TargetedAnimation>();\r\n private _animatables = new Array<Animatable>();\r\n private _from = Number.MAX_VALUE;\r\n private _to = -Number.MAX_VALUE;\r\n private _isStarted: boolean;\r\n private _isPaused: boolean;\r\n private _speedRatio = 1;\r\n private _loopAnimation = false;\r\n private _isAdditive = false;\r\n private _weight = -1;\r\n private _playOrder = 0;\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * This observable will notify when one animation have ended\r\n */\r\n public onAnimationEndObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when one animation loops\r\n */\r\n public onAnimationLoopObservable = new Observable<TargetedAnimation>();\r\n\r\n /**\r\n * Observer raised when all animations have looped\r\n */\r\n public onAnimationGroupLoopObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have ended.\r\n */\r\n public onAnimationGroupEndObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations have paused.\r\n */\r\n public onAnimationGroupPauseObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * This observable will notify when all animations are playing.\r\n */\r\n public onAnimationGroupPlayObservable = new Observable<AnimationGroup>();\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information for the node\r\n */\r\n public metadata: any = null;\r\n\r\n /**\r\n * Gets the first frame\r\n */\r\n public get from(): number {\r\n return this._from;\r\n }\r\n\r\n /**\r\n * Gets the last frame\r\n */\r\n public get to(): number {\r\n return this._to;\r\n }\r\n\r\n /**\r\n * Define if the animations are started\r\n */\r\n public get isStarted(): boolean {\r\n return this._isStarted;\r\n }\r\n\r\n /**\r\n * Gets a value indicating that the current group is playing\r\n */\r\n public get isPlaying(): boolean {\r\n return this._isStarted && !this._isPaused;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public get speedRatio(): number {\r\n return this._speedRatio;\r\n }\r\n\r\n /**\r\n * Gets or sets the speed ratio to use for all animations\r\n */\r\n public set speedRatio(value: number) {\r\n if (this._speedRatio === value) {\r\n return;\r\n }\r\n\r\n this._speedRatio = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.speedRatio = this._speedRatio;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should loop or not\r\n */\r\n public get loopAnimation(): boolean {\r\n return this._loopAnimation;\r\n }\r\n\r\n public set loopAnimation(value: boolean) {\r\n if (this._loopAnimation === value) {\r\n return;\r\n }\r\n\r\n this._loopAnimation = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.loopAnimation = this._loopAnimation;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets if all animations should be evaluated additively\r\n */\r\n public get isAdditive(): boolean {\r\n return this._isAdditive;\r\n }\r\n\r\n public set isAdditive(value: boolean) {\r\n if (this._isAdditive === value) {\r\n return;\r\n }\r\n\r\n this._isAdditive = value;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.isAdditive = this._isAdditive;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the weight to apply to all animations of the group\r\n */\r\n public get weight(): number {\r\n return this._weight;\r\n }\r\n\r\n public set weight(value: number) {\r\n if (this._weight === value) {\r\n return;\r\n }\r\n\r\n this._weight = value;\r\n this.setWeightForAllAnimatables(this._weight);\r\n }\r\n\r\n /**\r\n * Gets the targeted animations for this animation group\r\n */\r\n public get targetedAnimations(): Array<TargetedAnimation> {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * returning the list of animatables controlled by this animation group.\r\n */\r\n public get animatables(): Array<Animatable> {\r\n return this._animatables;\r\n }\r\n\r\n /**\r\n * Gets the list of target animations\r\n */\r\n public get children() {\r\n return this._targetedAnimations;\r\n }\r\n\r\n /**\r\n * Gets or sets the order of play of the animation group (default: 0)\r\n */\r\n public get playOrder() {\r\n return this._playOrder;\r\n }\r\n\r\n public set playOrder(value: number) {\r\n if (this._playOrder === value) {\r\n return;\r\n }\r\n\r\n this._playOrder = value;\r\n\r\n if (this._animatables.length > 0) {\r\n for (let i = 0; i < this._animatables.length; i++) {\r\n this._animatables[i].playOrder = this._playOrder;\r\n }\r\n\r\n this._scene.sortActiveAnimatables();\r\n }\r\n }\r\n\r\n /**\r\n * Merge the array of animation groups into a new animation group\r\n * @param animationGroups List of animation groups to merge\r\n * @param disposeSource If true, animation groups will be disposed after being merged (default: true)\r\n * @param normalize If true, animation groups will be normalized before being merged, so that all animations have the same \"from\" and \"to\" frame (default: false)\r\n * @param weight Weight for the new animation group. If not provided, it will inherit the weight from the first animation group of the array\r\n * @returns The new animation group or null if no animation groups were passed\r\n */\r\n public static MergeAnimationGroups(animationGroups: Array<AnimationGroup>, disposeSource = true, normalize = false, weight?: number): Nullable<AnimationGroup> {\r\n if (animationGroups.length === 0) {\r\n return null;\r\n }\r\n\r\n weight = weight ?? animationGroups[0].weight;\r\n\r\n let beginFrame = Number.MAX_VALUE;\r\n let endFrame = Number.MIN_VALUE;\r\n\r\n if (normalize) {\r\n for (const animationGroup of animationGroups) {\r\n if (animationGroup.from < beginFrame) {\r\n beginFrame = animationGroup.from;\r\n }\r\n\r\n if (animationGroup.to > endFrame) {\r\n endFrame = animationGroup.to;\r\n }\r\n }\r\n }\r\n\r\n const mergedAnimationGroup = new AnimationGroup(animationGroups[0].name + \"_merged\", animationGroups[0]._scene, weight);\r\n\r\n for (const animationGroup of animationGroups) {\r\n if (normalize) {\r\n animationGroup.normalize(beginFrame, endFrame);\r\n }\r\n\r\n for (const targetedAnimation of animationGroup.targetedAnimations) {\r\n mergedAnimationGroup.addTargetedAnimation(targetedAnimation.animation, targetedAnimation.target);\r\n }\r\n\r\n if (disposeSource) {\r\n animationGroup.dispose();\r\n }\r\n }\r\n\r\n return mergedAnimationGroup;\r\n }\r\n\r\n /**\r\n * Instantiates a new Animation Group.\r\n * This helps managing several animations at once.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\r\n * @param name Defines the name of the group\r\n * @param scene Defines the scene the group belongs to\r\n * @param weight Defines the weight to use for animations in the group (-1.0 by default, meaning \"no weight\")\r\n * @param playOrder Defines the order of play of the animation group (default is 0)\r\n */\r\n public constructor(\r\n /** The name of the animation group */\r\n public name: string,\r\n scene: Nullable<Scene> = null,\r\n weight = -1,\r\n playOrder = 0\r\n ) {\r\n this._scene = scene || EngineStore.LastCreatedScene!;\r\n this._weight = weight;\r\n this._playOrder = playOrder;\r\n this.uniqueId = this._scene.getUniqueId();\r\n\r\n this._scene.addAnimationGroup(this);\r\n }\r\n\r\n /**\r\n * Add an animation (with its target) in the group\r\n * @param animation defines the animation we want to add\r\n * @param target defines the target of the animation\r\n * @returns the TargetedAnimation object\r\n */\r\n public addTargetedAnimation(animation: Animation, target: any): TargetedAnimation {\r\n const targetedAnimation = new TargetedAnimation();\r\n targetedAnimation.animation = animation;\r\n targetedAnimation.target = target;\r\n\r\n const keys = animation.getKeys();\r\n if (this._from > keys[0].frame) {\r\n this._from = keys[0].frame;\r\n }\r\n\r\n if (this._to < keys[keys.length - 1].frame) {\r\n this._to = keys[keys.length - 1].frame;\r\n }\r\n\r\n this._targetedAnimations.push(targetedAnimation);\r\n\r\n return targetedAnimation;\r\n }\r\n\r\n /**\r\n * Remove an animation from the group\r\n * @param animation defines the animation we want to remove\r\n */\r\n public removeTargetedAnimation(animation: Animation) {\r\n for (let index = this._targetedAnimations.length - 1; index > -1; index--) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n if (targetedAnimation.animation === animation) {\r\n this._targetedAnimations.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\r\n * It can add constant keys at begin or end\r\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\r\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\r\n * @returns the animation group\r\n */\r\n public normalize(beginFrame: Nullable<number> = null, endFrame: Nullable<number> = null): AnimationGroup {\r\n if (beginFrame == null) {\r\n beginFrame = this._from;\r\n }\r\n if (endFrame == null) {\r\n endFrame = this._to;\r\n }\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const keys = targetedAnimation.animation.getKeys();\r\n const startKey = keys[0];\r\n const endKey = keys[keys.length - 1];\r\n\r\n if (startKey.frame > beginFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: beginFrame,\r\n value: startKey.value,\r\n inTangent: startKey.inTangent,\r\n outTangent: startKey.outTangent,\r\n interpolation: startKey.interpolation,\r\n };\r\n keys.splice(0, 0, newKey);\r\n }\r\n\r\n if (endKey.frame < endFrame) {\r\n const newKey: IAnimationKey = {\r\n frame: endFrame,\r\n value: endKey.value,\r\n inTangent: endKey.inTangent,\r\n outTangent: endKey.outTangent,\r\n interpolation: endKey.interpolation,\r\n };\r\n keys.push(newKey);\r\n }\r\n }\r\n\r\n this._from = beginFrame;\r\n this._to = endFrame;\r\n\r\n return this;\r\n }\r\n\r\n private _animationLoopCount: number;\r\n private _animationLoopFlags: boolean[] = [];\r\n\r\n private _processLoop(animatable: Animatable, targetedAnimation: TargetedAnimation, index: number) {\r\n animatable.onAnimationLoop = () => {\r\n this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\r\n\r\n if (this._animationLoopFlags[index]) {\r\n return;\r\n }\r\n\r\n this._animationLoopFlags[index] = true;\r\n\r\n this._animationLoopCount++;\r\n if (this._animationLoopCount === this._targetedAnimations.length) {\r\n this.onAnimationGroupLoopObservable.notifyObservers(this);\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Start all animations on given targets\r\n * @param loop defines if animations must loop\r\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\r\n * @param from defines the from key (optional)\r\n * @param to defines the to key (optional)\r\n * @param isAdditive defines the additive state for the resulting animatables (optional)\r\n * @returns the current animation group\r\n */\r\n public start(loop = false, speedRatio = 1, from?: number, to?: number, isAdditive?: boolean): AnimationGroup {\r\n if (this._isStarted || this._targetedAnimations.length === 0) {\r\n return this;\r\n }\r\n\r\n this._loopAnimation = loop;\r\n\r\n this._animationLoopCount = 0;\r\n this._animationLoopFlags.length = 0;\r\n\r\n for (let index = 0; index < this._targetedAnimations.length; index++) {\r\n const targetedAnimation = this._targetedAnimations[index];\r\n const animatable = this._scene.beginDirectAnimation(\r\n targetedAnimation.target,\r\n [targetedAnimation.animation],\r\n from !== undefined ? from : this._from,\r\n to !== undefined ? to : this._to,\r\n loop,\r\n speedRatio,\r\n undefined,\r\n undefined,\r\n isAdditive !== undefined ? isAdditive : this._isAdditive\r\n );\r\n animatable.weight = this._weight;\r\n animatable.playOrder = this._playOrder;\r\n animatable.onAnimationEnd = () => {\r\n this.onAnimationEndObservable.notifyObservers(targetedAnimation);\r\n this._checkAnimationGroupEnded(animatable);\r\n };\r\n\r\n this._processLoop(animatable, targetedAnimation, index);\r\n this._animatables.push(animatable);\r\n }\r\n\r\n this._scene.sortActiveAnimatables();\r\n\r\n this._speedRatio = speedRatio;\r\n\r\n this._isStarted = true;\r\n this._isPaused = false;\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Pause all animations\r\n * @returns the animation group\r\n */\r\n public pause(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n this._isPaused = true;\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.pause();\r\n }\r\n\r\n this.onAnimationGroupPauseObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Play all animations to initial state\r\n * This function will start() the animations if they were not started or will restart() them if they were paused\r\n * @param loop defines if animations must loop\r\n * @returns the animation group\r\n */\r\n public play(loop?: boolean): AnimationGroup {\r\n // only if all animatables are ready and exist\r\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\r\n if (loop !== undefined) {\r\n this.loopAnimation = loop;\r\n }\r\n this.restart();\r\n } else {\r\n this.stop();\r\n this.start(loop, this._speedRatio);\r\n }\r\n\r\n this._isPaused = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Reset all animations to initial state\r\n * @returns the animation group\r\n */\r\n public reset(): AnimationGroup {\r\n if (!this._isStarted) {\r\n this.play();\r\n this.goToFrame(0);\r\n this.stop();\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.reset();\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Restart animations from key 0\r\n * @returns the animation group\r\n */\r\n public restart(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.restart();\r\n }\r\n\r\n this.onAnimationGroupPlayObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Stop all animations\r\n * @returns the animation group\r\n */\r\n public stop(): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n const list = this._animatables.slice();\r\n for (let index = 0; index < list.length; index++) {\r\n list[index].stop(undefined, undefined, true);\r\n }\r\n\r\n // We will take care of removing all stopped animatables\r\n let curIndex = 0;\r\n for (let index = 0; index < this._scene._activeAnimatables.length; index++) {\r\n const animatable = this._scene._activeAnimatables[index];\r\n if (animatable._runtimeAnimations.length > 0) {\r\n this._scene._activeAnimatables[curIndex++] = animatable;\r\n }\r\n }\r\n this._scene._activeAnimatables.length = curIndex;\r\n\r\n this._isStarted = false;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Set animation weight for all animatables\r\n *\r\n * @since 6.12.4\r\n * You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created,\r\n * making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started\r\n * @param weight defines the weight to use\r\n * @returns the animationGroup\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\r\n */\r\n public setWeightForAllAnimatables(weight: number): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.weight = weight;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Synchronize and normalize all animatables with a source animatable\r\n * @param root defines the root animatable to synchronize with (null to stop synchronizing)\r\n * @returns the animationGroup\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\r\n */\r\n public syncAllAnimationsWith(root: Nullable<Animatable>): AnimationGroup {\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.syncWith(root);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Goes to a specific frame in this animation group\r\n * @param frame the frame number to go to\r\n * @returns the animationGroup\r\n */\r\n public goToFrame(frame: number): AnimationGroup {\r\n if (!this._isStarted) {\r\n return this;\r\n }\r\n\r\n for (let index = 0; index < this._animatables.length; index++) {\r\n const animatable = this._animatables[index];\r\n animatable.goToFrame(frame);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Dispose all associated resources\r\n */\r\n public dispose(): void {\r\n this._targetedAnimations.length = 0;\r\n this._animatables.length = 0;\r\n\r\n // Remove from scene\r\n const index = this._scene.animationGroups.indexOf(this);\r\n\r\n if (index > -1) {\r\n this._scene.animationGroups.splice(index, 1);\r\n }\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.animationGroups.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.animationGroups.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n this.onAnimationEndObservable.clear();\r\n this.onAnimationGroupEndObservable.clear();\r\n this.onAnimationGroupPauseObservable.clear();\r\n this.onAnimationGroupPlayObservable.clear();\r\n this.onAnimationLoopObservable.clear();\r\n this.onAnimationGroupLoopObservable.clear();\r\n }\r\n\r\n private _checkAnimationGroupEnded(animatable: Animatable) {\r\n // animatable should be taken out of the array\r\n const idx = this._animatables.indexOf(animatable);\r\n if (idx > -1) {\r\n this._animatables.splice(idx, 1);\r\n }\r\n\r\n // all animatables were removed? animation group ended!\r\n if (this._animatables.length === 0) {\r\n this._isStarted = false;\r\n this.onAnimationGroupEndObservable.notifyObservers(this);\r\n }\r\n }\r\n\r\n /**\r\n * Clone the current animation group and returns a copy\r\n * @param newName defines the name of the new group\r\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\r\n * @param cloneAnimations defines if the animations should be cloned or referenced\r\n * @returns the new animation group\r\n */\r\n public clone(newName: string, targetConverter?: (oldTarget: any) => any, cloneAnimations = false): AnimationGroup {\r\n const newGroup = new AnimationGroup(newName || this.name, this._scene);\r\n\r\n for (const targetAnimation of this._targetedAnimations) {\r\n newGroup.addTargetedAnimation(\r\n cloneAnimations ? targetAnimation.animation.clone() : targetAnimation.animation,\r\n targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target\r\n );\r\n }\r\n\r\n return newGroup;\r\n }\r\n\r\n /**\r\n * Serializes the animationGroup to an object\r\n * @returns Serialized object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.from = this.from;\r\n serializationObject.to = this.to;\r\n serializationObject.targetedAnimations = [];\r\n for (let targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\r\n const targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\r\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\r\n }\r\n\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n\r\n // Metadata\r\n if (this.metadata) {\r\n serializationObject.metadata = this.metadata;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n /**\r\n * Returns a new AnimationGroup object parsed from the source provided.\r\n * @param parsedAnimationGroup defines the source\r\n * @param scene defines the scene that will receive the animationGroup\r\n * @returns a new AnimationGroup\r\n */\r\n public static Parse(parsedAnimationGroup: any, scene: Scene): AnimationGroup {\r\n const animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);\r\n for (let i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\r\n const targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\r\n const animation = Animation.Parse(targetedAnimation.animation);\r\n const id = targetedAnimation.targetId;\r\n if (targetedAnimation.animation.property === \"influence\") {\r\n // morph target animation\r\n const morphTarget = scene.getMorphTargetById(id);\r\n if (morphTarget) {\r\n animationGroup.addTargetedAnimation(animation, morphTarget);\r\n }\r\n } else {\r\n const targetNode = scene.getNodeById(id);\r\n\r\n if (targetNode != null) {\r\n animationGroup.addTargetedAnimation(animation, targetNode);\r\n }\r\n }\r\n }\r\n\r\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {\r\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\r\n }\r\n\r\n if (Tags) {\r\n Tags.AddTagsTo(animationGroup, parsedAnimationGroup.tags);\r\n }\r\n\r\n if (parsedAnimationGroup.metadata !== undefined) {\r\n animationGroup.metadata = parsedAnimationGroup.metadata;\r\n }\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Convert the keyframes for all animations belonging to the group to be relative to a given reference frame.\r\n * @param sourceAnimationGroup defines the AnimationGroup containing animations to convert\r\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\r\n * @param range defines the name of the AnimationRange belonging to the animations in the group to convert\r\n * @param cloneOriginal defines whether or not to clone the group and convert the clone or convert the original group (default is false)\r\n * @param clonedName defines the name of the resulting cloned AnimationGroup if cloneOriginal is true\r\n * @returns a new AnimationGroup if cloneOriginal is true or the original AnimationGroup if cloneOriginal is false\r\n */\r\n public static MakeAnimationAdditive(sourceAnimationGroup: AnimationGroup, referenceFrame = 0, range?: string, cloneOriginal = false, clonedName?: string): AnimationGroup {\r\n let animationGroup = sourceAnimationGroup;\r\n if (cloneOriginal) {\r\n animationGroup = sourceAnimationGroup.clone(clonedName || animationGroup.name);\r\n }\r\n\r\n const targetedAnimations = animationGroup.targetedAnimations;\r\n for (let index = 0; index < targetedAnimations.length; index++) {\r\n const targetedAnimation = targetedAnimations[index];\r\n Animation.MakeAnimationAdditive(targetedAnimation.animation, referenceFrame, range);\r\n }\r\n\r\n animationGroup.isAdditive = true;\r\n\r\n return animationGroup;\r\n }\r\n\r\n /**\r\n * Returns the string \"AnimationGroup\"\r\n * @returns \"AnimationGroup\"\r\n */\r\n public getClassName(): string {\r\n return \"AnimationGroup\";\r\n }\r\n\r\n /**\r\n * Creates a detailed string about the object\r\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\r\n * @returns a string representing the object\r\n */\r\n public toString(fullDetails?: boolean): string {\r\n let ret = \"Name: \" + this.name;\r\n ret += \", type: \" + this.getClassName();\r\n if (fullDetails) {\r\n ret += \", from: \" + this._from;\r\n ret += \", to: \" + this._to;\r\n ret += \", isStarted: \" + this._isStarted;\r\n ret += \", speedRatio: \" + this._speedRatio;\r\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\r\n ret += \", animatables length: \" + this._animatables;\r\n }\r\n return ret;\r\n }\r\n}\r\n"]}
@@ -195,6 +195,7 @@ export class FreeCameraMouseInput {
195
195
  this._onMouseMove = null;
196
196
  this._previousPosition = null;
197
197
  }
198
+ this._activePointerId = -1;
198
199
  this._currentActiveButton = -1;
199
200
  }
200
201
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"freeCameraMouseInput.js","sourceRoot":"","sources":["../../../../../dev/core/src/Cameras/Inputs/freeCameraMouseInput.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAqC7B;;;;OAIG;IACH;IACI;;OAEG;IACI,eAAe,IAAI;QAAnB,iBAAY,GAAZ,YAAY,CAAO;QAxC9B;;WAEG;QAEI,YAAO,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAE3B;;WAEG;QAEI,uBAAkB,GAAG,MAAM,CAAC;QAK3B,sBAAiB,GAAuC,IAAI,CAAC;QAErE;;WAEG;QACI,6BAAwB,GAAG,IAAI,UAAU,EAAwC,CAAC;QACzF;;;WAGG;QACI,yBAAoB,GAAG,IAAI,CAAC;QAE3B,yBAAoB,GAAW,CAAC,CAAC,CAAC;QAClC,qBAAgB,GAAW,CAAC,CAAC,CAAC;IAanC,CAAC;IAEJ;;;OAGG;IACI,aAAa,CAAC,gBAA0B;QAC3C,8CAA8C;QAC9C,gBAAgB,GAAG,KAAK,CAAC,gCAAgC,CAAC,SAAS,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACvC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OAIG;IACI,aAAa,CAAC,GAAiB;QAClC,GAAG,CAAC,cAAc,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACI,aAAa;QAChB,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,aAAa,CAAC,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAElF,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBACvB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;gBACvC,MAAM,OAAO,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;gBACzC,OAAO,IAAI,OAAO,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;aAChF;YAED,IAAI,IAAI,CAAC,wBAAwB,EAAE;gBAC/B,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;aACzC;YAED,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;SACjC;QAED,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAED;;;OAGG;IACI,aAAa;QAChB,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA7OU;IADN,SAAS,EAAE;qDACe;AAMpB;IADN,SAAS,EAAE;gEACuB;AAyOjC,gBAAiB,CAAC,sBAAsB,CAAC,GAAG,oBAAoB,CAAC","sourcesContent":["import type { Observer, EventState } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICameraInput } from \"../../Cameras/cameraInputsManager\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport type { FreeCamera } from \"../../Cameras/freeCamera\";\r\nimport type { PointerInfo } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { IMouseEvent, IPointerEvent } from \"../../Events/deviceInputEvents\";\r\n/**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\r\n */\r\nexport class FreeCameraMouseInput implements ICameraInput<FreeCamera> {\r\n /**\r\n * Defines the camera the input is attached to.\r\n */\r\n public camera: FreeCamera;\r\n\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n @serialize()\r\n public buttons = [0, 1, 2];\r\n\r\n /**\r\n * Defines the pointer angular sensibility along the X and Y axis or how fast is the camera rotating.\r\n */\r\n @serialize()\r\n public angularSensibility = 2000.0;\r\n\r\n private _pointerInput: (p: PointerInfo, s: EventState) => void;\r\n private _onMouseMove: Nullable<(e: IMouseEvent) => any>;\r\n private _observer: Nullable<Observer<PointerInfo>>;\r\n private _previousPosition: Nullable<{ x: number; y: number }> = null;\r\n\r\n /**\r\n * Observable for when a pointer move event occurs containing the move offset\r\n */\r\n public onPointerMovedObservable = new Observable<{ offsetX: number; offsetY: number }>();\r\n /**\r\n * @internal\r\n * If the camera should be rotated automatically based on pointer movement\r\n */\r\n public _allowCameraRotation = true;\r\n\r\n private _currentActiveButton: number = -1;\r\n private _activePointerId: number = -1;\r\n private _contextMenuBind: () => void;\r\n\r\n /**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\r\n * @param touchEnabled Defines if touch is enabled or not\r\n */\r\n constructor(\r\n /**\r\n * Define if touch is enabled in the mouse input\r\n */\r\n public touchEnabled = true\r\n ) {}\r\n\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n public attachControl(noPreventDefault?: boolean): void {\r\n // eslint-disable-next-line prefer-rest-params\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n const engine = this.camera.getEngine();\r\n const element = engine.getInputElement();\r\n\r\n if (!this._pointerInput) {\r\n this._pointerInput = (p) => {\r\n const evt = <IPointerEvent>p.event;\r\n const isTouch = evt.pointerType === \"touch\";\r\n\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n\r\n if (!this.touchEnabled && isTouch) {\r\n return;\r\n }\r\n\r\n if (p.type !== PointerEventTypes.POINTERMOVE && this.buttons.indexOf(evt.button) === -1) {\r\n return;\r\n }\r\n\r\n const srcElement = <HTMLElement>evt.target;\r\n\r\n if (p.type === PointerEventTypes.POINTERDOWN) {\r\n // If the input is touch with more than one touch OR if the input is mouse and there is already an active button, return\r\n if ((isTouch && this._activePointerId !== -1) || (!isTouch && this._currentActiveButton !== -1)) {\r\n return;\r\n }\r\n\r\n this._activePointerId = evt.pointerId;\r\n try {\r\n srcElement?.setPointerCapture(evt.pointerId);\r\n } catch (e) {\r\n //Nothing to do with the error. Execution will continue.\r\n }\r\n\r\n if (this._currentActiveButton === -1) {\r\n this._currentActiveButton = evt.button;\r\n }\r\n\r\n this._previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n element && element.focus();\r\n }\r\n\r\n // This is required to move while pointer button is down\r\n if (engine.isPointerLock && this._onMouseMove) {\r\n this._onMouseMove(p.event);\r\n }\r\n } else if (p.type === PointerEventTypes.POINTERUP) {\r\n // If input is touch with a different touch id OR if input is mouse with a different button, return\r\n if ((isTouch && this._activePointerId !== evt.pointerId) || (!isTouch && this._currentActiveButton !== evt.button)) {\r\n return;\r\n }\r\n\r\n try {\r\n srcElement?.releasePointerCapture(evt.pointerId);\r\n } catch (e) {\r\n //Nothing to do with the error.\r\n }\r\n this._currentActiveButton = -1;\r\n\r\n this._previousPosition = null;\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n\r\n this._activePointerId = -1;\r\n } else if (p.type === PointerEventTypes.POINTERMOVE && (this._activePointerId === evt.pointerId || !isTouch)) {\r\n if (engine.isPointerLock && this._onMouseMove) {\r\n this._onMouseMove(p.event);\r\n } else if (this._previousPosition) {\r\n let offsetX = evt.clientX - this._previousPosition.x;\r\n const offsetY = evt.clientY - this._previousPosition.y;\r\n if (this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (this.camera.parent && this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n\r\n if (this._allowCameraRotation) {\r\n this.camera.cameraRotation.y += offsetX / this.angularSensibility;\r\n this.camera.cameraRotation.x += offsetY / this.angularSensibility;\r\n }\r\n this.onPointerMovedObservable.notifyObservers({ offsetX: offsetX, offsetY: offsetY });\r\n\r\n this._previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n };\r\n }\r\n\r\n this._onMouseMove = (evt) => {\r\n if (!engine.isPointerLock) {\r\n return;\r\n }\r\n\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n\r\n let offsetX = evt.movementX;\r\n if (this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (this.camera.parent && this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n this.camera.cameraRotation.y += offsetX / this.angularSensibility;\r\n\r\n const offsetY = evt.movementY;\r\n this.camera.cameraRotation.x += offsetY / this.angularSensibility;\r\n\r\n this._previousPosition = null;\r\n\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n };\r\n\r\n this._observer = this.camera\r\n .getScene()\r\n ._inputManager._addCameraPointerObserver(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);\r\n\r\n if (element) {\r\n this._contextMenuBind = this.onContextMenu.bind(this);\r\n element.addEventListener(\"contextmenu\", this._contextMenuBind, false); // TODO: We need to figure out how to handle this for Native\r\n }\r\n }\r\n\r\n /**\r\n * Called on JS contextmenu event.\r\n * Override this method to provide functionality.\r\n * @param evt\r\n */\r\n public onContextMenu(evt: PointerEvent): void {\r\n evt.preventDefault();\r\n }\r\n\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n */\r\n public detachControl(): void {\r\n if (this._observer) {\r\n this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer);\r\n\r\n if (this._contextMenuBind) {\r\n const engine = this.camera.getEngine();\r\n const element = engine.getInputElement();\r\n element && element.removeEventListener(\"contextmenu\", this._contextMenuBind);\r\n }\r\n\r\n if (this.onPointerMovedObservable) {\r\n this.onPointerMovedObservable.clear();\r\n }\r\n\r\n this._observer = null;\r\n this._onMouseMove = null;\r\n this._previousPosition = null;\r\n }\r\n\r\n this._currentActiveButton = -1;\r\n }\r\n\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"FreeCameraMouseInput\";\r\n }\r\n\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n public getSimpleName(): string {\r\n return \"mouse\";\r\n }\r\n}\r\n\r\n(<any>CameraInputTypes)[\"FreeCameraMouseInput\"] = FreeCameraMouseInput;\r\n"]}
1
+ {"version":3,"file":"freeCameraMouseInput.js","sourceRoot":"","sources":["../../../../../dev/core/src/Cameras/Inputs/freeCameraMouseInput.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAA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AmB,CAAC,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;aAChF;YAED,IAAI,IAAI,CAAC,wBAAwB,EAAE;gBAC/B,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;aACzC;YAED,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;SACjC;QAED,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAED;;;OAGG;IACI,aAAa;QAChB,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA9OU;IADN,SAAS,EAAE;qDACe;AAMpB;IADN,SAAS,EAAE;gEACuB;AA0OjC,gBAAiB,CAAC,sBAAsB,CAAC,GAAG,oBAAoB,CAAC","sourcesContent":["import type { Observer, EventState } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICameraInput } from \"../../Cameras/cameraInputsManager\";\r\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager\";\r\nimport type { FreeCamera } from \"../../Cameras/freeCamera\";\r\nimport type { PointerInfo } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { IMouseEvent, IPointerEvent } from \"../../Events/deviceInputEvents\";\r\n/**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\r\n */\r\nexport class FreeCameraMouseInput implements ICameraInput<FreeCamera> {\r\n /**\r\n * Defines the camera the input is attached to.\r\n */\r\n public camera: FreeCamera;\r\n\r\n /**\r\n * Defines the buttons associated with the input to handle camera move.\r\n */\r\n @serialize()\r\n public buttons = [0, 1, 2];\r\n\r\n /**\r\n * Defines the pointer angular sensibility along the X and Y axis or how fast is the camera rotating.\r\n */\r\n @serialize()\r\n public angularSensibility = 2000.0;\r\n\r\n private _pointerInput: (p: PointerInfo, s: EventState) => void;\r\n private _onMouseMove: Nullable<(e: IMouseEvent) => any>;\r\n private _observer: Nullable<Observer<PointerInfo>>;\r\n private _previousPosition: Nullable<{ x: number; y: number }> = null;\r\n\r\n /**\r\n * Observable for when a pointer move event occurs containing the move offset\r\n */\r\n public onPointerMovedObservable = new Observable<{ offsetX: number; offsetY: number }>();\r\n /**\r\n * @internal\r\n * If the camera should be rotated automatically based on pointer movement\r\n */\r\n public _allowCameraRotation = true;\r\n\r\n private _currentActiveButton: number = -1;\r\n private _activePointerId: number = -1;\r\n private _contextMenuBind: () => void;\r\n\r\n /**\r\n * Manage the mouse inputs to control the movement of a free camera.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\r\n * @param touchEnabled Defines if touch is enabled or not\r\n */\r\n constructor(\r\n /**\r\n * Define if touch is enabled in the mouse input\r\n */\r\n public touchEnabled = true\r\n ) {}\r\n\r\n /**\r\n * Attach the input controls to a specific dom element to get the input from.\r\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\r\n */\r\n public attachControl(noPreventDefault?: boolean): void {\r\n // eslint-disable-next-line prefer-rest-params\r\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\r\n const engine = this.camera.getEngine();\r\n const element = engine.getInputElement();\r\n\r\n if (!this._pointerInput) {\r\n this._pointerInput = (p) => {\r\n const evt = <IPointerEvent>p.event;\r\n const isTouch = evt.pointerType === \"touch\";\r\n\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n\r\n if (!this.touchEnabled && isTouch) {\r\n return;\r\n }\r\n\r\n if (p.type !== PointerEventTypes.POINTERMOVE && this.buttons.indexOf(evt.button) === -1) {\r\n return;\r\n }\r\n\r\n const srcElement = <HTMLElement>evt.target;\r\n\r\n if (p.type === PointerEventTypes.POINTERDOWN) {\r\n // If the input is touch with more than one touch OR if the input is mouse and there is already an active button, return\r\n if ((isTouch && this._activePointerId !== -1) || (!isTouch && this._currentActiveButton !== -1)) {\r\n return;\r\n }\r\n\r\n this._activePointerId = evt.pointerId;\r\n try {\r\n srcElement?.setPointerCapture(evt.pointerId);\r\n } catch (e) {\r\n //Nothing to do with the error. Execution will continue.\r\n }\r\n\r\n if (this._currentActiveButton === -1) {\r\n this._currentActiveButton = evt.button;\r\n }\r\n\r\n this._previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n element && element.focus();\r\n }\r\n\r\n // This is required to move while pointer button is down\r\n if (engine.isPointerLock && this._onMouseMove) {\r\n this._onMouseMove(p.event);\r\n }\r\n } else if (p.type === PointerEventTypes.POINTERUP) {\r\n // If input is touch with a different touch id OR if input is mouse with a different button, return\r\n if ((isTouch && this._activePointerId !== evt.pointerId) || (!isTouch && this._currentActiveButton !== evt.button)) {\r\n return;\r\n }\r\n\r\n try {\r\n srcElement?.releasePointerCapture(evt.pointerId);\r\n } catch (e) {\r\n //Nothing to do with the error.\r\n }\r\n this._currentActiveButton = -1;\r\n\r\n this._previousPosition = null;\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n\r\n this._activePointerId = -1;\r\n } else if (p.type === PointerEventTypes.POINTERMOVE && (this._activePointerId === evt.pointerId || !isTouch)) {\r\n if (engine.isPointerLock && this._onMouseMove) {\r\n this._onMouseMove(p.event);\r\n } else if (this._previousPosition) {\r\n let offsetX = evt.clientX - this._previousPosition.x;\r\n const offsetY = evt.clientY - this._previousPosition.y;\r\n if (this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (this.camera.parent && this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n\r\n if (this._allowCameraRotation) {\r\n this.camera.cameraRotation.y += offsetX / this.angularSensibility;\r\n this.camera.cameraRotation.x += offsetY / this.angularSensibility;\r\n }\r\n this.onPointerMovedObservable.notifyObservers({ offsetX: offsetX, offsetY: offsetY });\r\n\r\n this._previousPosition = {\r\n x: evt.clientX,\r\n y: evt.clientY,\r\n };\r\n\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n }\r\n }\r\n };\r\n }\r\n\r\n this._onMouseMove = (evt) => {\r\n if (!engine.isPointerLock) {\r\n return;\r\n }\r\n\r\n if (engine.isInVRExclusivePointerMode) {\r\n return;\r\n }\r\n\r\n let offsetX = evt.movementX;\r\n if (this.camera.getScene().useRightHandedSystem) {\r\n offsetX *= -1;\r\n }\r\n if (this.camera.parent && this.camera.parent._getWorldMatrixDeterminant() < 0) {\r\n offsetX *= -1;\r\n }\r\n this.camera.cameraRotation.y += offsetX / this.angularSensibility;\r\n\r\n const offsetY = evt.movementY;\r\n this.camera.cameraRotation.x += offsetY / this.angularSensibility;\r\n\r\n this._previousPosition = null;\r\n\r\n if (!noPreventDefault) {\r\n evt.preventDefault();\r\n }\r\n };\r\n\r\n this._observer = this.camera\r\n .getScene()\r\n ._inputManager._addCameraPointerObserver(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);\r\n\r\n if (element) {\r\n this._contextMenuBind = this.onContextMenu.bind(this);\r\n element.addEventListener(\"contextmenu\", this._contextMenuBind, false); // TODO: We need to figure out how to handle this for Native\r\n }\r\n }\r\n\r\n /**\r\n * Called on JS contextmenu event.\r\n * Override this method to provide functionality.\r\n * @param evt\r\n */\r\n public onContextMenu(evt: PointerEvent): void {\r\n evt.preventDefault();\r\n }\r\n\r\n /**\r\n * Detach the current controls from the specified dom element.\r\n */\r\n public detachControl(): void {\r\n if (this._observer) {\r\n this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer);\r\n\r\n if (this._contextMenuBind) {\r\n const engine = this.camera.getEngine();\r\n const element = engine.getInputElement();\r\n element && element.removeEventListener(\"contextmenu\", this._contextMenuBind);\r\n }\r\n\r\n if (this.onPointerMovedObservable) {\r\n this.onPointerMovedObservable.clear();\r\n }\r\n\r\n this._observer = null;\r\n this._onMouseMove = null;\r\n this._previousPosition = null;\r\n }\r\n\r\n this._activePointerId = -1;\r\n this._currentActiveButton = -1;\r\n }\r\n\r\n /**\r\n * Gets the class name of the current input.\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"FreeCameraMouseInput\";\r\n }\r\n\r\n /**\r\n * Get the friendly name associated with the input class.\r\n * @returns the input friendly name\r\n */\r\n public getSimpleName(): string {\r\n return \"mouse\";\r\n }\r\n}\r\n\r\n(<any>CameraInputTypes)[\"FreeCameraMouseInput\"] = FreeCameraMouseInput;\r\n"]}
@@ -34,13 +34,13 @@ export class ThinEngine {
34
34
  */
35
35
  // Not mixed with Version for tooling purpose.
36
36
  static get NpmPackage() {
37
- return "babylonjs@6.12.5";
37
+ return "babylonjs@6.13.0";
38
38
  }
39
39
  /**
40
40
  * Returns the current version of the framework
41
41
  */
42
42
  static get Version() {
43
- return "6.12.5";
43
+ return "6.13.0";
44
44
  }
45
45
  /**
46
46
  * Returns a string describing the current engine