Selaa lähdekoodia

Merge pull request #2685 from assumption/assumption/filesinput-custom-reload

Add onReloadCallback to FilesInput
David Catuhe 8 vuotta sitten
vanhempi
commit
d66af34b95
1 muutettua tiedostoa jossa 10 lisäystä ja 3 poistoa
  1. 10 3
      src/Tools/babylon.filesInput.ts

+ 10 - 3
src/Tools/babylon.filesInput.ts

@@ -8,6 +8,7 @@
         private _additionnalRenderLoopLogicCallback;
         private _additionnalRenderLoopLogicCallback;
         private _textureLoadingCallback;
         private _textureLoadingCallback;
         private _startingProcessingFilesCallback;
         private _startingProcessingFilesCallback;
+        private _onReloadCallback;
         private _elementToMonitor: HTMLElement;
         private _elementToMonitor: HTMLElement;
         public static FilesToLoad: File[] = new Array();
         public static FilesToLoad: File[] = new Array();
 
 
@@ -16,8 +17,8 @@
 
 
         /// Register to core BabylonJS object: engine, scene, rendering canvas, callback function when the scene will be loaded,
         /// Register to core BabylonJS object: engine, scene, rendering canvas, callback function when the scene will be loaded,
         /// loading progress callback and optionnal addionnal logic to call in the rendering loop
         /// loading progress callback and optionnal addionnal logic to call in the rendering loop
-        constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback,
-            p_progressCallback, p_additionnalRenderLoopLogicCallback, p_textureLoadingCallback, p_startingProcessingFilesCallback) {
+        constructor(p_engine: Engine, p_scene: Scene, p_canvas: HTMLCanvasElement, p_sceneLoadedCallback, p_progressCallback,
+            p_additionnalRenderLoopLogicCallback, p_textureLoadingCallback, p_startingProcessingFilesCallback, p_onReloadCallback) {
             this._engine = p_engine;
             this._engine = p_engine;
             this._canvas = p_canvas;
             this._canvas = p_canvas;
             this._currentScene = p_scene;
             this._currentScene = p_scene;
@@ -26,6 +27,7 @@
             this._additionnalRenderLoopLogicCallback = p_additionnalRenderLoopLogicCallback;
             this._additionnalRenderLoopLogicCallback = p_additionnalRenderLoopLogicCallback;
             this._textureLoadingCallback = p_textureLoadingCallback;
             this._textureLoadingCallback = p_textureLoadingCallback;
             this._startingProcessingFilesCallback = p_startingProcessingFilesCallback;
             this._startingProcessingFilesCallback = p_startingProcessingFilesCallback;
+            this._onReloadCallback = p_onReloadCallback;
         }
         }
 
 
         public monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void {
         public monitorElementForDragNDrop(p_elementToMonitor: HTMLElement): void {
@@ -108,7 +110,12 @@
                 }
                 }
             }
             }
 
 
-            this.reload();
+            if (this._onReloadCallback) {
+                this._onReloadCallback(this._sceneFileToLoad);
+            }
+            else {
+                this.reload();
+            }
         }
         }
 
 
         public loadFiles(event): void {
         public loadFiles(event): void {