Hi!
I have a bug reduced to a specific use case :
- Using babylon viewer 5.7.0
- Using the option play-once
- Using a big (but not huge) gltf that loads fine if play-once is not activated
The result is :
index.ts:4 Uncaught RangeError: Maximum call stack size exceeded
at Observer.callback (src/index.ts:4:23)
at Observable.notifyObservers (dev/core/src/Misc/observable.ts:364:49)
at Animatable.animatable.onAnimationEnd (dev/core/src/Animations/animationGroup.ts:366:47)
at Animatable._raiseOnAnimationEnd (dev/core/src/Animations/animatable.ts:305:18)
at Animatable.stop (dev/core/src/Animations/animatable.ts:352:22)
at AnimationGroup.stop (dev/core/src/Animations/animationGroup.ts:478:25)
at GroupModelAnimation.stop (src/index.ts:4:23)
at Observer.callback (src/index.ts:4:23)
at Observable.notifyObservers (dev/core/src/Misc/observable.ts:364:49)
at Animatable.animatable.onAnimationEnd (dev/core/src/Animations/animationGroup.ts:366:47)
I’ve looked at the code, I have made a hackish attempt at a fix which work, in the code of GroupModelAnimation:
@@ -275228,7 +275228,7 @@ class GroupModelAnimation {
this._state = AnimationState.INIT;
this._playMode = AnimationPlayMode.LOOP;
this._animationGroup.onAnimationEndObservable.add(() => {
- this.stop();
+ this.stop(true);
this._state = AnimationState.ENDED;
});
}
@@ -275365,8 +275365,10 @@ class GroupModelAnimation {
* Stop the animation.
* This will fail silently if the animation group is already stopped.
*/
- stop() {
- this._animationGroup.stop();
+ stop(doNotPropagate) {
+ if(doNotPropagate === undefined || doNotPropagate == false) {
+ this._animationGroup.stop();
+ }
This fixes the problem (the idea is : if I get the signal from _animationGroup than animation is ended, then do not ask _animationGroup to stop), but I am not sure this is conceptually correct.
Is there something am I missing? Is this correction in the good direction? Thank you all!