Class FilesInput
Constructors
constructor
-
new FilesInput(
engine: AbstractEngine,
scene: Nullable<Scene>,
sceneLoadedCallback: Nullable<(sceneFile: File, scene: Scene) => void>,
progressCallback: Nullable<(progress: ISceneLoaderProgressEvent) => void>,
additionalRenderLoopLogicCallback: Nullable<() => void>,
textureLoadingCallback: Nullable<(remaining: number) => void>,
startingProcessingFilesCallback: Nullable<(files?: File[]) => void>,
onReloadCallback: Nullable<(sceneFile: File) => void>,
errorCallback: Nullable<
(sceneFile: File, scene: Nullable<Scene>, message: string) => void,
>,
useAppend?: boolean,
dontInjectRenderLoop?: boolean,
): FilesInputCreates a new FilesInput
Parameters
- engine: AbstractEngine
defines the rendering engine
- scene: Nullable<Scene>
defines the hosting scene
- sceneLoadedCallback: Nullable<(sceneFile: File, scene: Scene) => void>
callback called when scene (files provided) is loaded
- progressCallback: Nullable<(progress: ISceneLoaderProgressEvent) => void>
callback called to track progress
- additionalRenderLoopLogicCallback: Nullable<() => void>
callback called to add user logic to the rendering loop
- textureLoadingCallback: Nullable<(remaining: number) => void>
callback called when a texture is loading
- startingProcessingFilesCallback: Nullable<(files?: File[]) => void>
callback called when the system is about to process all files
- onReloadCallback: Nullable<(sceneFile: File) => void>
callback called when a reload is requested
- errorCallback: Nullable<(sceneFile: File, scene: Nullable<Scene>, message: string) => void>
callback call if an error occurs
- useAppend: boolean = false
defines if the file loaded must be appended (true) or have the scene replaced (false, default behavior)
- dontInjectRenderLoop: boolean = false
defines if the render loop mustn't be injected into engine (default is false). Used only if useAppend is false.
Returns FilesInput
- engine: AbstractEngine
Properties
display Loading UI
If a loading UI should be displayed while loading a file
Readonlydont Inject Render Loop
defines if the render loop mustn't be injected into engine (default is false). Used only if useAppend is false.
load Async
sceneFile: File,
onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void>,
) => Promise<Scene> = ...
Function used when loading the scene file
Type Declaration
-
- (
sceneFile: File,
onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void>,
): Promise<Scene> -
Parameters
- sceneFile: File
defines the file to load
- onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void>
onProgress callback called while loading the file
Returns Promise<Scene>
a promise completing when the load is complete
- sceneFile: File
- (
on Process File Callback
file: File,
name: string,
extension: string,
setSceneFileToLoad: (sceneFile: File) => void,
) => boolean = ...
Callback called when a file is processed
Type Declaration
-
- (
file: File,
name: string,
extension: string,
setSceneFileToLoad: (sceneFile: File) => void,
): boolean -
Parameters
- file: File
- name: string
- extension: string
- setSceneFileToLoad: (sceneFile: File) => void
Returns boolean
false to abort the process
- (
on Process Files Error Callback
Callback called when an accepted file selection does not contain a loadable scene.
Readonlyuse Append
defines if the file loaded must be appended (true) or have the scene replaced (false, default behavior)
Accessors
files To Load
-
get filesToLoad(): File[]
Gets the current list of files to load
Returns File[]
StaticFiles To Load
-
get FilesToLoad(): { [key: string]: File }
List of files ready to be loaded
Returns { [key: string]: File }
Methods
clear File Selection
-
Clears the files and scene selection associated with the current load.
Parameters
- cancelActiveLoad: boolean = true
whether an in-progress replacement load should be canceled, restoring FilesInput-managed loading UI and rendering
Returns void
- cancelActiveLoad: boolean = true
dispose
-
Release all associated resources
Returns void
load Files
-
Load files from a drop event
Parameters
- event: any
defines the drop event to use as source
Returns void
- event: any
monitor Element For Drag N Drop
-
Calls this function to listen to drag'n'drop events on a specific DOM element
Parameters
- elementToMonitor: HTMLElement
defines the DOM element to track
Returns void
- elementToMonitor: HTMLElement
reload
-
Reload the current scene from the loaded files
Returns void
Class used to help managing file picking and drag-n-drop