Преглед изворни кода

success/error optional for freez active meshes

Raanan Weber пре 4 година
родитељ
комит
f46e613c4f
1 измењених фајлова са 3 додато и 1 уклоњено
  1. 3 1
      src/scene.ts

+ 3 - 1
src/scene.ts

@@ -3442,9 +3442,10 @@ export class Scene extends AbstractScene implements IAnimatable, IClipPlanesHold
      * @param skipEvaluateActiveMeshes defines an optional boolean indicating that the evaluate active meshes step must be completely skipped
      * @returns the current scene
      */
-    public freezeActiveMeshes(skipEvaluateActiveMeshes = false): Scene {
+    public freezeActiveMeshes(skipEvaluateActiveMeshes = false, onSuccess?: () => void, onError?: (message: string) => void): Scene {
         this.executeWhenReady(() => {
             if (!this.activeCamera) {
+                onError && onError('No active camera found');
                 return;
             }
 
@@ -3459,6 +3460,7 @@ export class Scene extends AbstractScene implements IAnimatable, IClipPlanesHold
             for (var index = 0; index < this._activeMeshes.length; index++) {
                 this._activeMeshes.data[index]._freeze();
             }
+            onSuccess && onSuccess();
         });
         return this;
     }