@onerjs/core 8.35.3 → 8.35.5

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.
@@ -229,7 +229,7 @@ async function loadDataAsync(fileInfo, scene, onSuccess, onProgress, onError, on
229
229
  }
230
230
  request = plugin.loadFile
231
231
  ? plugin.loadFile(scene, fileInfo.rawData || fileInfo.file || fileInfo.url, fileInfo.rootUrl, dataCallback, onProgress, useArrayBuffer, errorCallback, name)
232
- : scene._loadFile(fileInfo.file || fileInfo.url, dataCallback, onProgress, true, useArrayBuffer, errorCallback);
232
+ : scene._loadFile(fileInfo.jsonData || fileInfo.file || fileInfo.url, dataCallback, onProgress, true, useArrayBuffer, errorCallback);
233
233
  };
234
234
  const engine = scene.getEngine();
235
235
  let canUseOfflineSupport = engine.enableOfflineSupport;
@@ -1 +1 @@
1
- {"version":3,"file":"sceneLoader.js","sourceRoot":"","sources":["../../../../dev/core/src/Loading/sceneLoader.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAA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ChD,6DAA6D;IAC7D,SAA4C,EAC5C,UAAiE;IACjE,6DAA6D;IAC7D,OAA4E,EAC5E,eAAkC,EAClC,IAAa;QAEb,OAAO,MAAM,2BAA2B,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;IAChL,CAAC;;AAxYD;;GAEG;AACoB,sBAAU,GAAG,SAAS,CAAC,sBAAsB,CAAC;AAErE;;GAEG;AACoB,2BAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC;AAE/E;;GAEG;AACoB,2BAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC;AAE/E;;GAEG;AACoB,4BAAgB,GAAG,SAAS,CAAC,4BAA4B,CAAC;AAiDjF,UAAU;AAEV;;GAEG;AACoB,uCAA2B,GAAG,2BAA2B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { DeepImmutable, Nullable } from \"../types\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { AnimationGroup } from \"../Animations/animationGroup\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport type { IParticleSystem } from \"../Particles/IParticleSystem\";\r\nimport type { Skeleton } from \"../Bones/skeleton\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { SceneLoaderFlags } from \"./sceneLoaderFlags\";\r\nimport type { IFileRequest } from \"../Misc/fileRequest\";\r\nimport type { WebRequest } from \"../Misc/webRequest\";\r\nimport type { LoadFileError } from \"../Misc/fileTools\";\r\nimport { IsBase64DataUrl } from \"../Misc/fileTools\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Geometry } from \"../Meshes/geometry\";\r\nimport type { Light } from \"../Lights/light\";\r\nimport { RuntimeError, ErrorCodes } from \"../Misc/error\";\r\nimport type { ISpriteManager } from \"../Sprites/spriteManager\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { _FetchAsync } from \"core/Misc/webRequest.fetch\";\r\n\r\n/**\r\n * Type used for the success callback of ImportMesh\r\n */\r\nexport type SceneLoaderSuccessCallback = (\r\n meshes: AbstractMesh[],\r\n particleSystems: IParticleSystem[],\r\n skeletons: Skeleton[],\r\n animationGroups: AnimationGroup[],\r\n transformNodes: TransformNode[],\r\n geometries: Geometry[],\r\n lights: Light[],\r\n spriteManagers: ISpriteManager[]\r\n) => void;\r\n\r\n/**\r\n * Interface used for the result of ImportMeshAsync\r\n */\r\nexport interface ISceneLoaderAsyncResult {\r\n /**\r\n * The array of loaded meshes\r\n */\r\n readonly meshes: AbstractMesh[];\r\n\r\n /**\r\n * The array of loaded particle systems\r\n */\r\n readonly particleSystems: IParticleSystem[];\r\n\r\n /**\r\n * The array of loaded skeletons\r\n */\r\n readonly skeletons: Skeleton[];\r\n\r\n /**\r\n * The array of loaded animation groups\r\n */\r\n readonly animationGroups: AnimationGroup[];\r\n\r\n /**\r\n * The array of loaded transform nodes\r\n */\r\n readonly transformNodes: TransformNode[];\r\n\r\n /**\r\n * The array of loaded geometries\r\n */\r\n readonly geometries: Geometry[];\r\n\r\n /**\r\n * The array of loaded lights\r\n */\r\n readonly lights: Light[];\r\n\r\n /**\r\n * The array of loaded sprite managers\r\n */\r\n readonly spriteManagers: ISpriteManager[];\r\n}\r\n\r\n/**\r\n * Interface used to represent data loading progression\r\n */\r\nexport interface ISceneLoaderProgressEvent {\r\n /**\r\n * Defines if data length to load can be evaluated\r\n */\r\n readonly lengthComputable: boolean;\r\n\r\n /**\r\n * Defines the loaded data length\r\n */\r\n readonly loaded: number;\r\n\r\n /**\r\n * Defines the data length to load\r\n */\r\n readonly total: number;\r\n}\r\n\r\n/**\r\n * Interface used by SceneLoader plugins to define supported file extensions\r\n */\r\nexport interface ISceneLoaderPluginExtensions {\r\n /**\r\n * Defines the list of supported extensions\r\n */\r\n readonly [extension: string]: {\r\n readonly isBinary: boolean;\r\n readonly mimeType?: string;\r\n };\r\n}\r\n\r\n/**\r\n * Metadata for a SceneLoader plugin that must also be provided by a plugin factory\r\n */\r\nexport interface ISceneLoaderPluginMetadata {\r\n /**\r\n * The friendly name of the plugin.\r\n */\r\n readonly name: string;\r\n\r\n /**\r\n * The file extensions supported by the plugin.\r\n */\r\n readonly extensions: string | ISceneLoaderPluginExtensions;\r\n\r\n /**\r\n * The callback that returns true if the data can be directly loaded.\r\n * @param data string containing the file data\r\n * @returns if the data can be loaded directly\r\n */\r\n canDirectLoad?(data: string): boolean;\r\n}\r\n\r\n/**\r\n * Interface used by SceneLoader plugin factory\r\n */\r\nexport interface ISceneLoaderPluginFactory extends ISceneLoaderPluginMetadata {\r\n /**\r\n * Function called to create a new plugin\r\n * @param options plugin options that were passed to the SceneLoader operation\r\n * @returns the new plugin\r\n */\r\n createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPlugin | ISceneLoaderPluginAsync | Promise<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;\r\n}\r\n\r\n/**\r\n * Interface used to define the base of ISceneLoaderPlugin and ISceneLoaderPluginAsync\r\n */\r\nexport interface ISceneLoaderPluginBase extends ISceneLoaderPluginMetadata {\r\n /**\r\n * The callback called when loading from a url.\r\n * @param scene scene loading this url\r\n * @param fileOrUrl file or url to load\r\n * @param rootUrl root url to use to load assets\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param name defines the name of the file when loading a binary file\r\n * @returns a file request object\r\n */\r\n loadFile?(\r\n scene: Scene,\r\n fileOrUrl: File | string | ArrayBufferView,\r\n rootUrl: string,\r\n onSuccess: (data: unknown, responseURL?: string) => void,\r\n onProgress?: (ev: ISceneLoaderProgressEvent) => void,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n name?: string\r\n ): Nullable<IFileRequest>;\r\n\r\n /**\r\n * The callback that returns the data to pass to the plugin if the data can be directly loaded.\r\n * @param scene scene loading this data\r\n * @param data string containing the data\r\n * @returns data to pass to the plugin\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\r\n directLoad?(scene: Scene, data: string): unknown | Promise<unknown>;\r\n\r\n /**\r\n * The callback that allows custom handling of the root url based on the response url.\r\n * @param rootUrl the original root url\r\n * @param responseURL the response url if available\r\n * @returns the new root url\r\n */\r\n rewriteRootURL?(rootUrl: string, responseURL?: string): string;\r\n}\r\n\r\n/**\r\n * Interface used to define a SceneLoader plugin\r\n */\r\nexport interface ISceneLoaderPlugin extends ISceneLoaderPluginBase {\r\n /**\r\n * Import meshes into a scene.\r\n * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param scene The scene to import into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param meshes The meshes array to import into\r\n * @param particleSystems The particle systems array to import into\r\n * @param skeletons The skeletons array to import into\r\n * @param onError The callback when import fails\r\n * @returns True if successful or false otherwise\r\n */\r\n importMesh(\r\n meshesNames: string | readonly string[] | null | undefined,\r\n scene: Scene,\r\n data: unknown,\r\n rootUrl: string,\r\n meshes: AbstractMesh[],\r\n particleSystems: IParticleSystem[],\r\n skeletons: Skeleton[],\r\n onError?: (message: string, exception?: any) => void\r\n ): boolean;\r\n\r\n /**\r\n * Load into a scene.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onError The callback when import fails\r\n * @returns True if successful or false otherwise\r\n */\r\n load(scene: Scene, data: unknown, rootUrl: string, onError?: (message: string, exception?: any) => void): boolean;\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onError The callback when import fails\r\n * @returns The loaded asset container\r\n */\r\n loadAssetContainer(scene: Scene, data: unknown, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;\r\n}\r\n\r\n/**\r\n * Interface used to define an async SceneLoader plugin\r\n */\r\nexport interface ISceneLoaderPluginAsync extends ISceneLoaderPluginBase {\r\n /**\r\n * Import meshes into a scene.\r\n * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param scene The scene to import into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns The loaded objects (e.g. meshes, particle systems, skeletons, animation groups, etc.)\r\n */\r\n importMeshAsync(\r\n meshesNames: string | readonly string[] | null | undefined,\r\n scene: Scene,\r\n data: unknown,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n fileName?: string\r\n ): Promise<ISceneLoaderAsyncResult>;\r\n\r\n /**\r\n * Load into a scene.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns Nothing\r\n */\r\n loadAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns The loaded asset container\r\n */\r\n loadAssetContainerAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;\r\n}\r\n\r\n/**\r\n * Mode that determines how to handle old animation groups before loading new ones.\r\n */\r\nexport const enum SceneLoaderAnimationGroupLoadingMode {\r\n /**\r\n * Reset all old animations to initial state then dispose them.\r\n */\r\n Clean = 0,\r\n\r\n /**\r\n * Stop all old animations.\r\n */\r\n Stop = 1,\r\n\r\n /**\r\n * Restart old animations from first frame.\r\n */\r\n Sync = 2,\r\n\r\n /**\r\n * Old animations remains untouched.\r\n */\r\n NoSync = 3,\r\n}\r\n\r\n/**\r\n * Defines internal only plugin members.\r\n */\r\ninterface ISceneLoaderPluginInternal {\r\n /**\r\n * An optional observable to notify when the plugin is disposed\r\n */\r\n readonly onDisposeObservable: Observable<void>;\r\n}\r\n\r\n/**\r\n * Defines a plugin registered by the SceneLoader\r\n */\r\ninterface IRegisteredPlugin {\r\n /**\r\n * Defines the plugin to use\r\n */\r\n plugin: ((ISceneLoaderPlugin | ISceneLoaderPluginAsync) & Partial<ISceneLoaderPluginInternal>) | ISceneLoaderPluginFactory;\r\n /**\r\n * Defines if the plugin supports binary data\r\n */\r\n isBinary: boolean;\r\n mimeType?: string;\r\n}\r\n\r\nfunction IsFactory(pluginOrFactory: IRegisteredPlugin[\"plugin\"]): pluginOrFactory is ISceneLoaderPluginFactory {\r\n return !!(pluginOrFactory as ISceneLoaderPluginFactory).createPlugin;\r\n}\r\n\r\n/**\r\n * Defines file information\r\n */\r\ninterface IFileInfo {\r\n /**\r\n * Gets the file url\r\n */\r\n url: string;\r\n /**\r\n * Gets the root url\r\n */\r\n rootUrl: string;\r\n /**\r\n * Gets filename\r\n */\r\n name: string;\r\n /**\r\n * Gets the file\r\n */\r\n file: Nullable<File>;\r\n\r\n /**\r\n * Gets raw binary data.\r\n */\r\n rawData: Nullable<ArrayBufferView>;\r\n /**\r\n * Gets raw parsed json object\r\n */\r\n jsonData: Nullable<object>;\r\n}\r\n\r\n/**\r\n * Defines options for SceneLoader plugins. This interface is extended by specific plugins.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/naming-convention\r\nexport interface SceneLoaderPluginOptions extends Record<string, Record<string, unknown> | undefined> {}\r\n\r\n/**\r\n * Adds default/implicit options to plugin specific options.\r\n */\r\ntype DefaultPluginOptions<BasePluginOptions> = {\r\n /**\r\n * Defines if the plugin is enabled\r\n */\r\n enabled?: boolean;\r\n} & BasePluginOptions;\r\n\r\n// This captures the type defined inline for the pluginOptions property, which is just SceneLoaderPluginOptions wrapped with DefaultPluginOptions.\r\n// We do it this way rather than explicitly defining the type here and then using it in SceneLoaderOptions because we want the full expanded type\r\n// to show up in the user's intellisense to make it easier to understand what options are available.\r\nexport type PluginOptions = ISceneLoaderOptions[\"pluginOptions\"];\r\n\r\ntype SceneSource = string | File | ArrayBufferView | object;\r\n\r\n/**\r\n * Defines common options for loading operations performed by SceneLoader.\r\n */\r\ninterface ISceneLoaderOptions {\r\n /**\r\n * A string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n */\r\n rootUrl?: string;\r\n\r\n /**\r\n * A callback with a progress event for each file being loaded\r\n */\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void;\r\n\r\n /**\r\n * The extension used to determine the plugin\r\n */\r\n pluginExtension?: string;\r\n\r\n /**\r\n * Defines the filename, if the data is binary\r\n */\r\n name?: string;\r\n\r\n /**\r\n * Defines options for the registered plugins\r\n */\r\n pluginOptions?: {\r\n // NOTE: This type is doing two things:\r\n // 1. Adding an implicit 'enabled' property to the options for each plugin.\r\n // 2. Creating a mapped type of all the options of all the plugins to make it just look like a consolidated plain object in intellisense for the user.\r\n [Plugin in keyof SceneLoaderPluginOptions]?: {\r\n [Option in keyof DefaultPluginOptions<SceneLoaderPluginOptions[Plugin]>]: DefaultPluginOptions<SceneLoaderPluginOptions[Plugin]>[Option];\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Defines options for ImportMeshAsync.\r\n */\r\nexport interface ImportMeshOptions extends ISceneLoaderOptions {\r\n /**\r\n * An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n */\r\n meshNames?: string | readonly string[] | null | undefined;\r\n}\r\n\r\n/**\r\n * Defines options for LoadAsync.\r\n */\r\nexport interface LoadOptions extends ISceneLoaderOptions {}\r\n\r\n/**\r\n * Defines options for AppendAsync.\r\n */\r\nexport interface AppendOptions extends ISceneLoaderOptions {}\r\n\r\n/**\r\n * Defines options for LoadAssetContainerAsync.\r\n */\r\nexport interface LoadAssetContainerOptions extends ISceneLoaderOptions {}\r\n\r\n/**\r\n * Defines options for ImportAnimationsAsync.\r\n */\r\nexport interface ImportAnimationsOptions extends ISceneLoaderOptions {\r\n /**\r\n * When true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n */\r\n overwriteAnimations?: boolean;\r\n\r\n /**\r\n * Defines how to handle old animations groups before importing new ones\r\n */\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode;\r\n\r\n /**\r\n * defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n */\r\n targetConverter?: Nullable<(target: unknown) => unknown>;\r\n}\r\n\r\nfunction isFile(value: unknown): value is File {\r\n return !!(value as File).name;\r\n}\r\n\r\nconst onPluginActivatedObservable = new Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>();\r\nconst registeredPlugins: { [extension: string]: IRegisteredPlugin } = {};\r\nlet showingLoadingScreen = false;\r\n\r\nfunction getDefaultPlugin(): IRegisteredPlugin | undefined {\r\n return registeredPlugins[\".babylon\"];\r\n}\r\n\r\nfunction getPluginForMimeType(mimeType: string): IRegisteredPlugin | undefined {\r\n for (const registeredPluginKey in registeredPlugins) {\r\n const registeredPlugin = registeredPlugins[registeredPluginKey];\r\n if (registeredPlugin.mimeType === mimeType) {\r\n return registeredPlugin;\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getPluginForExtension(extension: string, returnDefault: boolean): IRegisteredPlugin | undefined {\r\n const registeredPlugin = registeredPlugins[extension];\r\n if (registeredPlugin) {\r\n return registeredPlugin;\r\n }\r\n Logger.Warn(\r\n \"Unable to find a plugin to load \" +\r\n extension +\r\n \" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes\"\r\n );\r\n return returnDefault ? getDefaultPlugin() : undefined;\r\n}\r\n\r\nfunction isPluginForExtensionAvailable(extension: string): boolean {\r\n return !!registeredPlugins[extension];\r\n}\r\n\r\nfunction getPluginForDirectLoad(data: string): IRegisteredPlugin | undefined {\r\n for (const extension in registeredPlugins) {\r\n const plugin = registeredPlugins[extension].plugin;\r\n\r\n if (plugin.canDirectLoad && plugin.canDirectLoad(data)) {\r\n return registeredPlugins[extension];\r\n }\r\n }\r\n\r\n return getDefaultPlugin();\r\n}\r\n\r\nfunction getFilenameExtension(sceneFilename: string): string {\r\n const queryStringPosition = sceneFilename.indexOf(\"?\");\r\n\r\n if (queryStringPosition !== -1) {\r\n sceneFilename = sceneFilename.substring(0, queryStringPosition);\r\n }\r\n\r\n const dotPosition = sceneFilename.lastIndexOf(\".\");\r\n\r\n return sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();\r\n}\r\n\r\nfunction getDirectLoad(sceneFilename: string): Nullable<string> {\r\n if (sceneFilename.substring(0, 5) === \"data:\") {\r\n return sceneFilename.substring(5);\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction formatErrorMessage(fileInfo: IFileInfo, message?: string, exception?: any): string {\r\n const fromLoad = fileInfo.rawData ? \"binary data\" : fileInfo.url;\r\n let errorMessage = \"Unable to load from \" + fromLoad;\r\n\r\n if (message) {\r\n errorMessage += `: ${message}`;\r\n } else if (exception) {\r\n errorMessage += `: ${exception}`;\r\n }\r\n\r\n return errorMessage;\r\n}\r\n\r\nasync function loadDataAsync(\r\n fileInfo: IFileInfo,\r\n scene: Scene,\r\n onSuccess: (plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync, data: unknown, responseURL?: string) => void,\r\n onProgress: ((event: ISceneLoaderProgressEvent) => void) | undefined,\r\n onError: (message?: string, exception?: any) => void,\r\n onDispose: () => void,\r\n pluginExtension: Nullable<string>,\r\n name: string,\r\n pluginOptions: PluginOptions\r\n): Promise<Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>> {\r\n const directLoad = getDirectLoad(fileInfo.url);\r\n\r\n if (fileInfo.rawData && !pluginExtension) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"When using ArrayBufferView to load data the file extension must be provided.\";\r\n }\r\n\r\n if (fileInfo.jsonData && !pluginExtension) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"When using object to load data the file extension must be provided.\";\r\n }\r\n\r\n const fileExtension = !directLoad && !pluginExtension ? getFilenameExtension(fileInfo.url) : \"\";\r\n\r\n let registeredPlugin = pluginExtension\r\n ? getPluginForExtension(pluginExtension, true)\r\n : directLoad\r\n ? getPluginForDirectLoad(fileInfo.url)\r\n : getPluginForExtension(fileExtension, false);\r\n\r\n if (!registeredPlugin && fileExtension) {\r\n if (fileInfo.url && !fileInfo.url.startsWith(\"blob:\")) {\r\n // Fetching head content to get the mime type\r\n const response = await _FetchAsync(fileInfo.url, { method: \"HEAD\", responseHeaders: [\"Content-Type\"] });\r\n const mimeType = response.headerValues ? response.headerValues[\"Content-Type\"] : \"\";\r\n if (mimeType) {\r\n // eslint-disable-next-line require-atomic-updates\r\n registeredPlugin = getPluginForMimeType(mimeType);\r\n }\r\n }\r\n\r\n if (!registeredPlugin) {\r\n registeredPlugin = getDefaultPlugin();\r\n }\r\n }\r\n\r\n if (!registeredPlugin) {\r\n throw new Error(`No plugin or fallback for ${pluginExtension ?? fileInfo.url}`);\r\n }\r\n\r\n if (pluginOptions?.[registeredPlugin.plugin.name]?.enabled === false) {\r\n throw new Error(`The '${registeredPlugin.plugin.name}' plugin is disabled via the loader options passed to the loading operation.`);\r\n }\r\n\r\n if (fileInfo.rawData && !registeredPlugin.isBinary) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Loading from ArrayBufferView can not be used with plugins that don't support binary loading.\";\r\n }\r\n\r\n const getPluginInstance = (callback: (plugin: (ISceneLoaderPlugin | ISceneLoaderPluginAsync) & Partial<ISceneLoaderPluginInternal>) => void) => {\r\n // For plugin factories, the plugin is instantiated on each SceneLoader operation. This makes options handling\r\n // much simpler as we can just pass the options to the factory, rather than passing options through to every possible\r\n // plugin call. Given this, options are only supported for plugins that provide a factory function.\r\n if (IsFactory(registeredPlugin.plugin)) {\r\n const pluginFactory = registeredPlugin.plugin;\r\n const partialPlugin = pluginFactory.createPlugin(pluginOptions ?? {});\r\n if (partialPlugin instanceof Promise) {\r\n // eslint-disable-next-line github/no-then\r\n partialPlugin.then(callback).catch((error) => {\r\n onError(\"Error instantiating plugin.\", error);\r\n });\r\n // When async factories are used, the plugin instance cannot be returned synchronously.\r\n // In this case, the legacy loader functions will return null.\r\n return null;\r\n } else {\r\n callback(partialPlugin);\r\n return partialPlugin;\r\n }\r\n } else {\r\n callback(registeredPlugin.plugin);\r\n return registeredPlugin.plugin;\r\n }\r\n };\r\n\r\n return getPluginInstance((plugin) => {\r\n if (!plugin) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw `The loader plugin corresponding to the '${pluginExtension}' file type has not been found. If using es6, please import the plugin you wish to use before.`;\r\n }\r\n\r\n onPluginActivatedObservable.notifyObservers(plugin);\r\n\r\n // Check if we have a direct load url. If the plugin is registered to handle\r\n // it or it's not a base64 data url, then pass it through the direct load path.\r\n if (directLoad && ((plugin.canDirectLoad && plugin.canDirectLoad(fileInfo.url)) || !IsBase64DataUrl(fileInfo.url))) {\r\n if (plugin.directLoad) {\r\n const result = plugin.directLoad(scene, directLoad);\r\n if (result instanceof Promise) {\r\n result\r\n // eslint-disable-next-line github/no-then\r\n .then((data: unknown) => {\r\n onSuccess(plugin, data);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((error: any) => {\r\n onError(\"Error in directLoad of _loadData: \" + error, error);\r\n });\r\n } else {\r\n onSuccess(plugin, result);\r\n }\r\n } else {\r\n onSuccess(plugin, directLoad);\r\n }\r\n return;\r\n }\r\n\r\n const useArrayBuffer = registeredPlugin.isBinary;\r\n\r\n const dataCallback = (data: unknown, responseURL?: string) => {\r\n if (scene.isDisposed) {\r\n onError(\"Scene has been disposed\");\r\n return;\r\n }\r\n\r\n onSuccess(plugin, data, responseURL);\r\n };\r\n\r\n let request: Nullable<IFileRequest> = null;\r\n let pluginDisposed = false;\r\n plugin.onDisposeObservable?.add(() => {\r\n pluginDisposed = true;\r\n\r\n if (request) {\r\n request.abort();\r\n request = null;\r\n }\r\n\r\n onDispose();\r\n });\r\n\r\n const manifestChecked = () => {\r\n if (pluginDisposed) {\r\n return;\r\n }\r\n\r\n const errorCallback = (request?: WebRequest, exception?: LoadFileError) => {\r\n onError(request?.statusText, exception);\r\n };\r\n\r\n if (!plugin.loadFile && fileInfo.rawData) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Plugin does not support loading ArrayBufferView.\";\r\n }\r\n\r\n request = plugin.loadFile\r\n ? plugin.loadFile(scene, fileInfo.rawData || fileInfo.file || fileInfo.url, fileInfo.rootUrl, dataCallback, onProgress, useArrayBuffer, errorCallback, name)\r\n : scene._loadFile(fileInfo.file || fileInfo.url, dataCallback, onProgress, true, useArrayBuffer, errorCallback);\r\n };\r\n\r\n const engine = scene.getEngine();\r\n let canUseOfflineSupport = engine.enableOfflineSupport;\r\n if (canUseOfflineSupport) {\r\n // Also check for exceptions\r\n let exceptionFound = false;\r\n for (const regex of scene.disableOfflineSupportExceptionRules) {\r\n if (regex.test(fileInfo.url)) {\r\n exceptionFound = true;\r\n break;\r\n }\r\n }\r\n\r\n canUseOfflineSupport = !exceptionFound;\r\n }\r\n\r\n if (canUseOfflineSupport && AbstractEngine.OfflineProviderFactory) {\r\n // Checking if a manifest file has been set for this scene and if offline mode has been requested\r\n scene.offlineProvider = AbstractEngine.OfflineProviderFactory(fileInfo.url, manifestChecked, engine.disableManifestCheck);\r\n } else {\r\n manifestChecked();\r\n }\r\n });\r\n}\r\n\r\nfunction GetFileInfo(rootUrl: string, sceneSource: SceneSource): Nullable<IFileInfo> {\r\n let url: string;\r\n let name: string;\r\n let file: Nullable<File> = null;\r\n let rawData: Nullable<ArrayBufferView> = null;\r\n let jsonData: Nullable<object> = null;\r\n\r\n if (!sceneSource) {\r\n url = rootUrl;\r\n name = Tools.GetFilename(rootUrl);\r\n rootUrl = Tools.GetFolderPath(rootUrl);\r\n } else if (isFile(sceneSource)) {\r\n url = `file:${sceneSource.name}`;\r\n name = sceneSource.name;\r\n file = sceneSource;\r\n } else if (ArrayBuffer.isView(sceneSource)) {\r\n url = \"\";\r\n name = RandomGUID();\r\n rawData = sceneSource;\r\n } else if (typeof sceneSource === \"object\") {\r\n url = \"\";\r\n name = RandomGUID();\r\n jsonData = sceneSource;\r\n } else if (sceneSource.startsWith(\"data:\")) {\r\n url = sceneSource;\r\n name = \"\";\r\n } else if (rootUrl) {\r\n const filename = sceneSource;\r\n if (filename.substring(0, 1) === \"/\") {\r\n Tools.Error(\"Wrong sceneFilename parameter\");\r\n return null;\r\n }\r\n\r\n url = rootUrl + filename;\r\n name = filename;\r\n } else {\r\n url = sceneSource;\r\n name = Tools.GetFilename(sceneSource);\r\n rootUrl = Tools.GetFolderPath(sceneSource);\r\n }\r\n\r\n return {\r\n url: url,\r\n rootUrl: rootUrl,\r\n name: name,\r\n file: file,\r\n rawData,\r\n jsonData,\r\n };\r\n}\r\n\r\n/**\r\n * Adds a new plugin to the list of registered plugins\r\n * @param plugin defines the plugin to add\r\n */\r\nexport function RegisterSceneLoaderPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory): void {\r\n if (typeof plugin.extensions === \"string\") {\r\n const extension = plugin.extensions;\r\n registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: false,\r\n };\r\n } else {\r\n const extensions = plugin.extensions;\r\n const keys = Object.keys(extensions);\r\n for (const extension of keys) {\r\n registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: extensions[extension].isBinary,\r\n mimeType: extensions[extension].mimeType,\r\n };\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Adds a new plugin to the list of registered plugins\r\n * @deprecated Please use {@link RegisterSceneLoaderPlugin} instead.\r\n * @param plugin defines the plugin to add\r\n */\r\nexport function registerSceneLoaderPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory): void {\r\n RegisterSceneLoaderPlugin(plugin);\r\n}\r\n\r\n/**\r\n * Gets metadata for all currently registered scene loader plugins.\r\n * @returns An array where each entry has metadata for a single scene loader plugin.\r\n */\r\nexport function GetRegisteredSceneLoaderPluginMetadata(): DeepImmutable<\r\n Array<\r\n Pick<ISceneLoaderPluginMetadata, \"name\"> & {\r\n /**\r\n * The extensions supported by the plugin.\r\n */\r\n extensions: ({\r\n /**\r\n * The file extension.\r\n */\r\n extension: string;\r\n } & ISceneLoaderPluginExtensions[string])[];\r\n }\r\n >\r\n> {\r\n return Array.from(\r\n Object.entries(registeredPlugins).reduce((pluginMap, [extension, extensionRegistration]) => {\r\n let pluginMetadata = pluginMap.get(extensionRegistration.plugin.name);\r\n if (!pluginMetadata) {\r\n pluginMap.set(extensionRegistration.plugin.name, (pluginMetadata = []));\r\n }\r\n pluginMetadata.push({ extension, isBinary: extensionRegistration.isBinary, mimeType: extensionRegistration.mimeType });\r\n return pluginMap;\r\n }, new Map<string, ({ extension: string } & ISceneLoaderPluginExtensions[string])[]>())\r\n ).map(([name, extensions]) => ({ name, extensions }));\r\n}\r\n\r\n/**\r\n * Import meshes into a scene\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\nexport async function ImportMeshAsync(source: SceneSource, scene: Scene, options?: ImportMeshOptions): Promise<ISceneLoaderAsyncResult> {\r\n const { meshNames, rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = options ?? {};\r\n return await importMeshAsyncCoreAsync(meshNames, rootUrl, source, scene, onProgress, pluginExtension, name, pluginOptions);\r\n}\r\n\r\nasync function importMeshAsync(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<SceneLoaderSuccessCallback> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n): Promise<Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to import mesh to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = formatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback: \" + e, e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler: SceneLoaderSuccessCallback = (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers) => {\r\n scene.importedMeshesFiles.push(fileInfo.url);\r\n\r\n if (onSuccess) {\r\n try {\r\n onSuccess(meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback: \" + e, e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return await loadDataAsync(\r\n fileInfo,\r\n scene,\r\n (plugin, data, responseURL) => {\r\n if (plugin.rewriteRootURL) {\r\n fileInfo.rootUrl = plugin.rewriteRootURL(fileInfo.rootUrl, responseURL);\r\n }\r\n\r\n if ((plugin as ISceneLoaderPlugin).importMesh) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n const meshes: AbstractMesh[] = [];\r\n const particleSystems: IParticleSystem[] = [];\r\n const skeletons: Skeleton[] = [];\r\n\r\n if (!syncedPlugin.importMesh(meshNames, scene, data, fileInfo.rootUrl, meshes, particleSystems, skeletons, errorHandler)) {\r\n return;\r\n }\r\n\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(meshes, particleSystems, skeletons, [], [], [], [], []);\r\n } else {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .importMeshAsync(meshNames, scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n // eslint-disable-next-line github/no-then\r\n .then((result) => {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(\r\n result.meshes,\r\n result.particleSystems,\r\n result.skeletons,\r\n result.animationGroups,\r\n result.transformNodes,\r\n result.geometries,\r\n result.lights,\r\n result.spriteManagers\r\n );\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n}\r\n\r\nasync function importMeshAsyncCoreAsync(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n): Promise<ISceneLoaderAsyncResult> {\r\n return await new Promise((resolve, reject) => {\r\n try {\r\n importMeshAsync(\r\n meshNames,\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers) => {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: particleSystems,\r\n skeletons: skeletons,\r\n animationGroups: animationGroups,\r\n transformNodes: transformNodes,\r\n geometries: geometries,\r\n lights: lights,\r\n spriteManagers: spriteManagers,\r\n });\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n // eslint-disable-next-line github/no-then\r\n ).catch(reject);\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(error);\r\n }\r\n });\r\n}\r\n\r\n// This is the core implementation of load scene\r\nasync function loadSceneImplAsync(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n engine: Nullable<AbstractEngine> = EngineStore.LastCreatedEngine,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n): Promise<void> {\r\n if (!engine) {\r\n Tools.Error(\"No engine available\");\r\n return;\r\n }\r\n\r\n await appendSceneImplAsync(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Load a scene\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded scene\r\n */\r\nexport async function LoadSceneAsync(source: SceneSource, engine: AbstractEngine, options?: LoadOptions): Promise<Scene> {\r\n const { rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = options ?? {};\r\n return await loadSceneSharedAsync(rootUrl, source, engine, onProgress, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Load a scene\r\n * @deprecated Please use {@link LoadSceneAsync} instead.\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded scene\r\n */\r\nexport async function loadSceneAsync(source: SceneSource, engine: AbstractEngine, options?: LoadOptions): Promise<Scene> {\r\n return await LoadSceneAsync(source, engine, options);\r\n}\r\n\r\n// This function is shared between the new module level loadSceneAsync and the legacy SceneLoader.LoadAsync\r\nasync function loadSceneSharedAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n engine?: Nullable<AbstractEngine>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n): Promise<Scene> {\r\n return await new Promise((resolve, reject) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n loadSceneImplAsync(\r\n rootUrl,\r\n sceneFilename,\r\n engine,\r\n (scene) => {\r\n resolve(scene);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n });\r\n}\r\n\r\n// This is the core implementation of append scene\r\nasync function appendSceneImplAsync(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n): Promise<Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to append to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n if (SceneLoaderFlags.ShowLoadingScreen && !showingLoadingScreen) {\r\n showingLoadingScreen = true;\r\n scene.getEngine().displayLoadingUI();\r\n scene.executeWhenReady(() => {\r\n scene.getEngine().hideLoadingUI();\r\n showingLoadingScreen = false;\r\n });\r\n }\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = formatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler = () => {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(scene);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return await loadDataAsync(\r\n fileInfo,\r\n scene,\r\n (plugin, data) => {\r\n if ((plugin as ISceneLoaderPlugin).load) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n if (!syncedPlugin.load(scene, data, fileInfo.rootUrl, errorHandler)) {\r\n return;\r\n }\r\n\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n } else {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .loadAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n // eslint-disable-next-line github/no-then\r\n .then(() => {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n}\r\n\r\n/**\r\n * Append a scene\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns A promise that resolves when the scene is appended\r\n */\r\nexport async function AppendSceneAsync(source: SceneSource, scene: Scene, options?: AppendOptions): Promise<void> {\r\n const { rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = options ?? {};\r\n await appendSceneSharedAsync(rootUrl, source, scene, onProgress, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Append a scene\r\n * @deprecated Please use {@link AppendSceneAsync} instead.\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns A promise that resolves when the scene is appended\r\n */\r\nexport async function appendSceneAsync(source: SceneSource, scene: Scene, options?: AppendOptions): Promise<void> {\r\n return await AppendSceneAsync(source, scene, options);\r\n}\r\n\r\n// This function is shared between the new module level appendSceneAsync and the legacy SceneLoader.AppendAsync\r\nasync function appendSceneSharedAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n): Promise<Scene> {\r\n return await new Promise((resolve, reject) => {\r\n try {\r\n appendSceneImplAsync(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (scene) => {\r\n resolve(scene);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n // eslint-disable-next-line github/no-then\r\n ).catch(reject);\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(error);\r\n }\r\n });\r\n}\r\n\r\n// This is the core implementation of load asset container\r\nasync function loadAssetContainerImplAsync(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<(assets: AssetContainer) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n): Promise<Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load asset container to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = formatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler = (assets: AssetContainer) => {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(assets);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return await loadDataAsync(\r\n fileInfo,\r\n scene,\r\n (plugin, data) => {\r\n if ((plugin as ISceneLoaderPlugin).loadAssetContainer) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n const assetContainer = syncedPlugin.loadAssetContainer(scene, data, fileInfo.rootUrl, errorHandler);\r\n if (!assetContainer) {\r\n return;\r\n }\r\n assetContainer.populateRootNodes();\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n } else if ((plugin as ISceneLoaderPluginAsync).loadAssetContainerAsync) {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .loadAssetContainerAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n // eslint-disable-next-line github/no-then\r\n .then((assetContainer) => {\r\n assetContainer.populateRootNodes();\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n } else {\r\n errorHandler(\"LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.\");\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n}\r\n\r\n/**\r\n * Load a scene into an asset container\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded asset container\r\n */\r\nexport async function LoadAssetContainerAsync(source: SceneSource, scene: Scene, options?: LoadAssetContainerOptions): Promise<AssetContainer> {\r\n const { rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = options ?? {};\r\n return await loadAssetContainerSharedAsync(rootUrl, source, scene, onProgress, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Load a scene into an asset container\r\n * @deprecated Please use {@link LoadAssetContainerAsync} instead.\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded asset container\r\n */\r\nexport async function loadAssetContainerAsync(source: SceneSource, scene: Scene, options?: LoadAssetContainerOptions): Promise<AssetContainer> {\r\n return await LoadAssetContainerAsync(source, scene, options);\r\n}\r\n\r\n// This function is shared between the new module level loadAssetContainerAsync and the legacy SceneLoader.LoadAssetContainerAsync\r\nasync function loadAssetContainerSharedAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n): Promise<AssetContainer> {\r\n return await new Promise((resolve, reject) => {\r\n try {\r\n loadAssetContainerImplAsync(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (assets) => {\r\n resolve(assets);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n // eslint-disable-next-line github/no-then\r\n ).catch(reject);\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(error);\r\n }\r\n });\r\n}\r\n\r\n// This is the core implementation of import animations\r\nasync function importAnimationsImplAsync(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n overwriteAnimations = true,\r\n animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean,\r\n targetConverter: Nullable<(target: any) => any> = null,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n): Promise<void> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load animations to\");\r\n return;\r\n }\r\n\r\n if (overwriteAnimations) {\r\n // Reset, stop and dispose all animations before loading new ones\r\n for (const animatable of scene.animatables) {\r\n animatable.reset();\r\n }\r\n scene.stopAllAnimations();\r\n const animationGroups = scene.animationGroups.slice();\r\n for (const animationGroup of animationGroups) {\r\n animationGroup.dispose();\r\n }\r\n const nodes = scene.getNodes();\r\n for (const node of nodes) {\r\n if (node.animations) {\r\n node.animations = [];\r\n }\r\n }\r\n } else {\r\n switch (animationGroupLoadingMode as number) {\r\n case SceneLoaderAnimationGroupLoadingMode.Clean:\r\n const animationGroups = scene.animationGroups.slice();\r\n for (const animationGroup of animationGroups) {\r\n animationGroup.dispose();\r\n }\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Stop:\r\n for (const animationGroup of scene.animationGroups) {\r\n animationGroup.stop();\r\n }\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Sync:\r\n for (const animationGroup of scene.animationGroups) {\r\n animationGroup.reset();\r\n animationGroup.restart();\r\n }\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.NoSync:\r\n // nothing to do\r\n break;\r\n default:\r\n Logger.Error(\"Unknown animation group loading mode value '\" + animationGroupLoadingMode + \"'\");\r\n return;\r\n }\r\n }\r\n\r\n const startingIndexForNewAnimatables = scene.animatables.length;\r\n\r\n const onAssetContainerLoaded = (container: AssetContainer) => {\r\n container.mergeAnimationsTo(scene, scene.animatables.slice(startingIndexForNewAnimatables), targetConverter);\r\n\r\n container.dispose();\r\n\r\n scene.onAnimationFileImportedObservable.notifyObservers(scene);\r\n\r\n if (onSuccess) {\r\n onSuccess(scene);\r\n }\r\n };\r\n\r\n await loadAssetContainerImplAsync(rootUrl, sceneFilename, scene, onAssetContainerLoaded, onProgress, onError, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Import animations from a file into a scene\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns A promise that resolves when the animations are imported\r\n */\r\nexport async function ImportAnimationsAsync(source: SceneSource, scene: Scene, options?: ImportAnimationsOptions): Promise<void> {\r\n const { rootUrl = \"\", overwriteAnimations, animationGroupLoadingMode, targetConverter, onProgress, pluginExtension, name, pluginOptions } = options ?? {};\r\n await importAnimationsSharedAsync(rootUrl, source, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, onProgress, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Import animations from a file into a scene\r\n * @deprecated Please use {@link ImportAnimationsAsync} instead.\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns A promise that resolves when the animations are imported\r\n */\r\nexport async function importAnimationsAsync(source: SceneSource, scene: Scene, options?: ImportAnimationsOptions): Promise<void> {\r\n return await ImportAnimationsAsync(source, scene, options);\r\n}\r\n\r\n// This function is shared between the new module level importAnimationsAsync and the legacy SceneLoader.ImportAnimationsAsync\r\nasync function importAnimationsSharedAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n overwriteAnimations?: boolean,\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode,\r\n targetConverter?: Nullable<(target: any) => any>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n): Promise<Scene> {\r\n return await new Promise((resolve, reject) => {\r\n try {\r\n importAnimationsImplAsync(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n overwriteAnimations,\r\n animationGroupLoadingMode,\r\n targetConverter,\r\n (scene) => {\r\n resolve(scene);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n // eslint-disable-next-line github/no-then\r\n ).catch(reject);\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(error);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Class used to load scene from various file formats using registered plugins\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes\r\n * @deprecated The module level functions are more efficient for bundler tree shaking and allow plugin options to be passed through. Future improvements to scene loading will primarily be in the module level functions. The SceneLoader class will remain available, but it will be beneficial to prefer the module level functions.\r\n * @see {@link ImportMeshAsync}, {@link LoadSceneAsync}, {@link AppendSceneAsync}, {@link ImportAnimationsAsync}, {@link LoadAssetContainerAsync}\r\n */\r\nexport class SceneLoader {\r\n /**\r\n * No logging while loading\r\n */\r\n public static readonly NO_LOGGING = Constants.SCENELOADER_NO_LOGGING;\r\n\r\n /**\r\n * Minimal logging while loading\r\n */\r\n public static readonly MINIMAL_LOGGING = Constants.SCENELOADER_MINIMAL_LOGGING;\r\n\r\n /**\r\n * Summary logging while loading\r\n */\r\n public static readonly SUMMARY_LOGGING = Constants.SCENELOADER_SUMMARY_LOGGING;\r\n\r\n /**\r\n * Detailed logging while loading\r\n */\r\n public static readonly DETAILED_LOGGING = Constants.SCENELOADER_DETAILED_LOGGING;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n public static get ForceFullSceneLoadingForIncremental() {\r\n return SceneLoaderFlags.ForceFullSceneLoadingForIncremental;\r\n }\r\n\r\n public static set ForceFullSceneLoadingForIncremental(value: boolean) {\r\n SceneLoaderFlags.ForceFullSceneLoadingForIncremental = value;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n public static get ShowLoadingScreen(): boolean {\r\n return SceneLoaderFlags.ShowLoadingScreen;\r\n }\r\n\r\n public static set ShowLoadingScreen(value: boolean) {\r\n SceneLoaderFlags.ShowLoadingScreen = value;\r\n }\r\n\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static get loggingLevel(): number {\r\n return SceneLoaderFlags.loggingLevel;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static set loggingLevel(value: number) {\r\n SceneLoaderFlags.loggingLevel = value;\r\n }\r\n\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n public static get CleanBoneMatrixWeights(): boolean {\r\n return SceneLoaderFlags.CleanBoneMatrixWeights;\r\n }\r\n\r\n public static set CleanBoneMatrixWeights(value: boolean) {\r\n SceneLoaderFlags.CleanBoneMatrixWeights = value;\r\n }\r\n\r\n // Members\r\n\r\n /**\r\n * Event raised when a plugin is used to load a scene\r\n */\r\n public static readonly OnPluginActivatedObservable = onPluginActivatedObservable;\r\n\r\n /**\r\n * Gets the default plugin (used to load Babylon files)\r\n * @returns the .babylon plugin\r\n */\r\n public static GetDefaultPlugin(): IRegisteredPlugin | undefined {\r\n return getDefaultPlugin();\r\n }\r\n\r\n // Public functions\r\n\r\n /**\r\n * Gets a plugin that can load the given extension\r\n * @param extension defines the extension to load\r\n * @returns a plugin or null if none works\r\n */\r\n public static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory | undefined {\r\n return getPluginForExtension(extension, true)?.plugin;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the given extension can be loaded\r\n * @param extension defines the extension to load\r\n * @returns true if the extension is supported\r\n */\r\n public static IsPluginForExtensionAvailable(extension: string): boolean {\r\n return isPluginForExtensionAvailable(extension);\r\n }\r\n\r\n /**\r\n * Adds a new plugin to the list of registered plugins\r\n * @param plugin defines the plugin to add\r\n */\r\n public static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory): void {\r\n RegisterSceneLoaderPlugin(plugin);\r\n }\r\n\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with a list of imported meshes, particleSystems, skeletons, and animationGroups when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @param pluginOptions defines the options to use with the plugin\r\n * @deprecated Please use the module level {@link ImportMeshAsync} instead\r\n */\r\n public static ImportMesh(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onSuccess?: Nullable<SceneLoaderSuccessCallback>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n ): void {\r\n // eslint-disable-next-line github/no-then\r\n importMeshAsync(meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name, pluginOptions).catch((error) =>\r\n onError?.(EngineStore.LastCreatedScene!, error?.message, error)\r\n );\r\n }\r\n\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n * @deprecated Please use the module level {@link ImportMeshAsync} instead\r\n */\r\n public static async ImportMeshAsync(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n return await importMeshAsyncCoreAsync(meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension, name);\r\n }\r\n\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @deprecated Please use the module level {@link LoadSceneAsync} instead\r\n */\r\n public static Load(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n engine?: Nullable<AbstractEngine>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ) {\r\n // eslint-disable-next-line github/no-then\r\n loadSceneImplAsync(rootUrl, sceneFilename, engine, onSuccess, onProgress, onError, pluginExtension, name).catch((error) =>\r\n onError?.(EngineStore.LastCreatedScene!, error?.message, error)\r\n );\r\n }\r\n\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded scene\r\n * @deprecated Please use the module level {@link LoadSceneAsync} instead\r\n */\r\n public static async LoadAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n engine?: Nullable<AbstractEngine>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<Scene> {\r\n return await loadSceneSharedAsync(rootUrl, sceneFilename, engine, onProgress, pluginExtension, name);\r\n }\r\n\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @deprecated Please use the module level {@link AppendSceneAsync} instead\r\n */\r\n public static Append(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ) {\r\n // eslint-disable-next-line github/no-then\r\n appendSceneImplAsync(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name).catch((error) =>\r\n onError?.((scene ?? EngineStore.LastCreatedScene)!, error?.message, error)\r\n );\r\n }\r\n\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @returns The given scene\r\n * @deprecated Please use the module level {@link AppendSceneAsync} instead\r\n */\r\n public static async AppendAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<Scene> {\r\n return await appendSceneSharedAsync(rootUrl, sceneFilename, scene, onProgress, pluginExtension, name);\r\n }\r\n\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @deprecated Please use the module level {@link LoadAssetContainerAsync} instead\r\n */\r\n public static LoadAssetContainer(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onSuccess?: Nullable<(assets: AssetContainer) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ) {\r\n // eslint-disable-next-line github/no-then\r\n loadAssetContainerImplAsync(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name).catch((error) =>\r\n onError?.((scene ?? EngineStore.LastCreatedScene)!, error?.message, error)\r\n );\r\n }\r\n\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene (default: empty string)\r\n * @param scene is the instance of Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded asset container\r\n * @deprecated Please use the module level {@link LoadAssetContainerAsync} instead\r\n */\r\n public static async LoadAssetContainerAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<AssetContainer> {\r\n return await loadAssetContainerSharedAsync(rootUrl, sceneFilename, scene, onProgress, pluginExtension, name);\r\n }\r\n\r\n /**\r\n * Import animations from a file into a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @deprecated Please use the module level {@link ImportAnimationsAsync} instead\r\n */\r\n public static ImportAnimations(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n overwriteAnimations?: boolean,\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode,\r\n targetConverter?: Nullable<(target: any) => any>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): void {\r\n importAnimationsImplAsync(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n overwriteAnimations,\r\n animationGroupLoadingMode,\r\n targetConverter,\r\n onSuccess,\r\n onProgress,\r\n onError,\r\n pluginExtension,\r\n name\r\n // eslint-disable-next-line github/no-then\r\n ).catch((error) => onError?.((scene ?? EngineStore.LastCreatedScene)!, error?.message, error));\r\n }\r\n\r\n /**\r\n * Import animations from a file into a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns the updated scene with imported animations\r\n * @deprecated Please use the module level {@link ImportAnimationsAsync} instead\r\n */\r\n public static async ImportAnimationsAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n overwriteAnimations?: boolean,\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode,\r\n targetConverter?: Nullable<(target: any) => any>,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<Scene> {\r\n return await importAnimationsSharedAsync(rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, onProgress, pluginExtension, name);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"sceneLoader.js","sourceRoot":"","sources":["../../../../dev/core/src/Loading/sceneLoader.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,oCAAmC;AA2QzD;;GAEG;AACH,MAAM,CAAN,IAAkB,oCAoBjB;AApBD,WAAkB,oCAAoC;IAClD;;OAEG;IACH,iGAAS,CAAA;IAET;;OAEG;IACH,+FAAQ,CAAA;IAER;;OAEG;IACH,+FAAQ,CAAA;IAER;;OAEG;IACH,mGAAU,CAAA;AACd,CAAC,EApBiB,oCAAoC,KAApC,oCAAoC,QAoBrD;AA2BD,SAAS,SAAS,CAAC,eAA4C;IAC3D,OAAO,CAAC,CAAE,eAA6C,CAAC,YAAY,CAAC;AACzE,CAAC;AA0ID,SAAS,MAAM,CAAC,KAAc;IAC1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,CAAC,2BAA2B,CAAC;AAE/E;;GAEG;AACoB,2BAAe,GAAG,SAAS,CAAC,2BAA2B,CAAC;AAE/E;;GAEG;AACoB,4BAAgB,GAAG,SAAS,CAAC,4BAA4B,CAAC;AAiDjF,UAAU;AAEV;;GAEG;AACoB,uCAA2B,GAAG,2BAA2B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { DeepImmutable, Nullable } from \"../types\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { AnimationGroup } from \"../Animations/animationGroup\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport type { IParticleSystem } from \"../Particles/IParticleSystem\";\r\nimport type { Skeleton } from \"../Bones/skeleton\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { SceneLoaderFlags } from \"./sceneLoaderFlags\";\r\nimport type { IFileRequest } from \"../Misc/fileRequest\";\r\nimport type { WebRequest } from \"../Misc/webRequest\";\r\nimport type { LoadFileError } from \"../Misc/fileTools\";\r\nimport { IsBase64DataUrl } from \"../Misc/fileTools\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Geometry } from \"../Meshes/geometry\";\r\nimport type { Light } from \"../Lights/light\";\r\nimport { RuntimeError, ErrorCodes } from \"../Misc/error\";\r\nimport type { ISpriteManager } from \"../Sprites/spriteManager\";\r\nimport { RandomGUID } from \"../Misc/guid\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { _FetchAsync } from \"core/Misc/webRequest.fetch\";\r\n\r\n/**\r\n * Type used for the success callback of ImportMesh\r\n */\r\nexport type SceneLoaderSuccessCallback = (\r\n meshes: AbstractMesh[],\r\n particleSystems: IParticleSystem[],\r\n skeletons: Skeleton[],\r\n animationGroups: AnimationGroup[],\r\n transformNodes: TransformNode[],\r\n geometries: Geometry[],\r\n lights: Light[],\r\n spriteManagers: ISpriteManager[]\r\n) => void;\r\n\r\n/**\r\n * Interface used for the result of ImportMeshAsync\r\n */\r\nexport interface ISceneLoaderAsyncResult {\r\n /**\r\n * The array of loaded meshes\r\n */\r\n readonly meshes: AbstractMesh[];\r\n\r\n /**\r\n * The array of loaded particle systems\r\n */\r\n readonly particleSystems: IParticleSystem[];\r\n\r\n /**\r\n * The array of loaded skeletons\r\n */\r\n readonly skeletons: Skeleton[];\r\n\r\n /**\r\n * The array of loaded animation groups\r\n */\r\n readonly animationGroups: AnimationGroup[];\r\n\r\n /**\r\n * The array of loaded transform nodes\r\n */\r\n readonly transformNodes: TransformNode[];\r\n\r\n /**\r\n * The array of loaded geometries\r\n */\r\n readonly geometries: Geometry[];\r\n\r\n /**\r\n * The array of loaded lights\r\n */\r\n readonly lights: Light[];\r\n\r\n /**\r\n * The array of loaded sprite managers\r\n */\r\n readonly spriteManagers: ISpriteManager[];\r\n}\r\n\r\n/**\r\n * Interface used to represent data loading progression\r\n */\r\nexport interface ISceneLoaderProgressEvent {\r\n /**\r\n * Defines if data length to load can be evaluated\r\n */\r\n readonly lengthComputable: boolean;\r\n\r\n /**\r\n * Defines the loaded data length\r\n */\r\n readonly loaded: number;\r\n\r\n /**\r\n * Defines the data length to load\r\n */\r\n readonly total: number;\r\n}\r\n\r\n/**\r\n * Interface used by SceneLoader plugins to define supported file extensions\r\n */\r\nexport interface ISceneLoaderPluginExtensions {\r\n /**\r\n * Defines the list of supported extensions\r\n */\r\n readonly [extension: string]: {\r\n readonly isBinary: boolean;\r\n readonly mimeType?: string;\r\n };\r\n}\r\n\r\n/**\r\n * Metadata for a SceneLoader plugin that must also be provided by a plugin factory\r\n */\r\nexport interface ISceneLoaderPluginMetadata {\r\n /**\r\n * The friendly name of the plugin.\r\n */\r\n readonly name: string;\r\n\r\n /**\r\n * The file extensions supported by the plugin.\r\n */\r\n readonly extensions: string | ISceneLoaderPluginExtensions;\r\n\r\n /**\r\n * The callback that returns true if the data can be directly loaded.\r\n * @param data string containing the file data\r\n * @returns if the data can be loaded directly\r\n */\r\n canDirectLoad?(data: string): boolean;\r\n}\r\n\r\n/**\r\n * Interface used by SceneLoader plugin factory\r\n */\r\nexport interface ISceneLoaderPluginFactory extends ISceneLoaderPluginMetadata {\r\n /**\r\n * Function called to create a new plugin\r\n * @param options plugin options that were passed to the SceneLoader operation\r\n * @returns the new plugin\r\n */\r\n createPlugin(options: SceneLoaderPluginOptions): ISceneLoaderPlugin | ISceneLoaderPluginAsync | Promise<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;\r\n}\r\n\r\n/**\r\n * Interface used to define the base of ISceneLoaderPlugin and ISceneLoaderPluginAsync\r\n */\r\nexport interface ISceneLoaderPluginBase extends ISceneLoaderPluginMetadata {\r\n /**\r\n * The callback called when loading from a url.\r\n * @param scene scene loading this url\r\n * @param fileOrUrl file or url to load\r\n * @param rootUrl root url to use to load assets\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param name defines the name of the file when loading a binary file\r\n * @returns a file request object\r\n */\r\n loadFile?(\r\n scene: Scene,\r\n fileOrUrl: File | string | ArrayBufferView,\r\n rootUrl: string,\r\n onSuccess: (data: unknown, responseURL?: string) => void,\r\n onProgress?: (ev: ISceneLoaderProgressEvent) => void,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n name?: string\r\n ): Nullable<IFileRequest>;\r\n\r\n /**\r\n * The callback that returns the data to pass to the plugin if the data can be directly loaded.\r\n * @param scene scene loading this data\r\n * @param data string containing the data\r\n * @returns data to pass to the plugin\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\r\n directLoad?(scene: Scene, data: string): unknown | Promise<unknown>;\r\n\r\n /**\r\n * The callback that allows custom handling of the root url based on the response url.\r\n * @param rootUrl the original root url\r\n * @param responseURL the response url if available\r\n * @returns the new root url\r\n */\r\n rewriteRootURL?(rootUrl: string, responseURL?: string): string;\r\n}\r\n\r\n/**\r\n * Interface used to define a SceneLoader plugin\r\n */\r\nexport interface ISceneLoaderPlugin extends ISceneLoaderPluginBase {\r\n /**\r\n * Import meshes into a scene.\r\n * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param scene The scene to import into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param meshes The meshes array to import into\r\n * @param particleSystems The particle systems array to import into\r\n * @param skeletons The skeletons array to import into\r\n * @param onError The callback when import fails\r\n * @returns True if successful or false otherwise\r\n */\r\n importMesh(\r\n meshesNames: string | readonly string[] | null | undefined,\r\n scene: Scene,\r\n data: unknown,\r\n rootUrl: string,\r\n meshes: AbstractMesh[],\r\n particleSystems: IParticleSystem[],\r\n skeletons: Skeleton[],\r\n onError?: (message: string, exception?: any) => void\r\n ): boolean;\r\n\r\n /**\r\n * Load into a scene.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onError The callback when import fails\r\n * @returns True if successful or false otherwise\r\n */\r\n load(scene: Scene, data: unknown, rootUrl: string, onError?: (message: string, exception?: any) => void): boolean;\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onError The callback when import fails\r\n * @returns The loaded asset container\r\n */\r\n loadAssetContainer(scene: Scene, data: unknown, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;\r\n}\r\n\r\n/**\r\n * Interface used to define an async SceneLoader plugin\r\n */\r\nexport interface ISceneLoaderPluginAsync extends ISceneLoaderPluginBase {\r\n /**\r\n * Import meshes into a scene.\r\n * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param scene The scene to import into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns The loaded objects (e.g. meshes, particle systems, skeletons, animation groups, etc.)\r\n */\r\n importMeshAsync(\r\n meshesNames: string | readonly string[] | null | undefined,\r\n scene: Scene,\r\n data: unknown,\r\n rootUrl: string,\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\r\n fileName?: string\r\n ): Promise<ISceneLoaderAsyncResult>;\r\n\r\n /**\r\n * Load into a scene.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns Nothing\r\n */\r\n loadAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void>;\r\n\r\n /**\r\n * Load into an asset container.\r\n * @param scene The scene to load into\r\n * @param data The data to import\r\n * @param rootUrl The root url for scene and resources\r\n * @param onProgress The callback when the load progresses\r\n * @param fileName Defines the name of the file to load\r\n * @returns The loaded asset container\r\n */\r\n loadAssetContainerAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;\r\n}\r\n\r\n/**\r\n * Mode that determines how to handle old animation groups before loading new ones.\r\n */\r\nexport const enum SceneLoaderAnimationGroupLoadingMode {\r\n /**\r\n * Reset all old animations to initial state then dispose them.\r\n */\r\n Clean = 0,\r\n\r\n /**\r\n * Stop all old animations.\r\n */\r\n Stop = 1,\r\n\r\n /**\r\n * Restart old animations from first frame.\r\n */\r\n Sync = 2,\r\n\r\n /**\r\n * Old animations remains untouched.\r\n */\r\n NoSync = 3,\r\n}\r\n\r\n/**\r\n * Defines internal only plugin members.\r\n */\r\ninterface ISceneLoaderPluginInternal {\r\n /**\r\n * An optional observable to notify when the plugin is disposed\r\n */\r\n readonly onDisposeObservable: Observable<void>;\r\n}\r\n\r\n/**\r\n * Defines a plugin registered by the SceneLoader\r\n */\r\ninterface IRegisteredPlugin {\r\n /**\r\n * Defines the plugin to use\r\n */\r\n plugin: ((ISceneLoaderPlugin | ISceneLoaderPluginAsync) & Partial<ISceneLoaderPluginInternal>) | ISceneLoaderPluginFactory;\r\n /**\r\n * Defines if the plugin supports binary data\r\n */\r\n isBinary: boolean;\r\n mimeType?: string;\r\n}\r\n\r\nfunction IsFactory(pluginOrFactory: IRegisteredPlugin[\"plugin\"]): pluginOrFactory is ISceneLoaderPluginFactory {\r\n return !!(pluginOrFactory as ISceneLoaderPluginFactory).createPlugin;\r\n}\r\n\r\n/**\r\n * Defines file information\r\n */\r\ninterface IFileInfo {\r\n /**\r\n * Gets the file url\r\n */\r\n url: string;\r\n /**\r\n * Gets the root url\r\n */\r\n rootUrl: string;\r\n /**\r\n * Gets filename\r\n */\r\n name: string;\r\n /**\r\n * Gets the file\r\n */\r\n file: Nullable<File>;\r\n\r\n /**\r\n * Gets raw binary data.\r\n */\r\n rawData: Nullable<ArrayBufferView>;\r\n /**\r\n * Gets raw parsed json object\r\n */\r\n jsonData: Nullable<object>;\r\n}\r\n\r\n/**\r\n * Defines options for SceneLoader plugins. This interface is extended by specific plugins.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/naming-convention\r\nexport interface SceneLoaderPluginOptions extends Record<string, Record<string, unknown> | undefined> {}\r\n\r\n/**\r\n * Adds default/implicit options to plugin specific options.\r\n */\r\ntype DefaultPluginOptions<BasePluginOptions> = {\r\n /**\r\n * Defines if the plugin is enabled\r\n */\r\n enabled?: boolean;\r\n} & BasePluginOptions;\r\n\r\n// This captures the type defined inline for the pluginOptions property, which is just SceneLoaderPluginOptions wrapped with DefaultPluginOptions.\r\n// We do it this way rather than explicitly defining the type here and then using it in SceneLoaderOptions because we want the full expanded type\r\n// to show up in the user's intellisense to make it easier to understand what options are available.\r\nexport type PluginOptions = ISceneLoaderOptions[\"pluginOptions\"];\r\n\r\ntype SceneSource = string | File | ArrayBufferView | object;\r\n\r\n/**\r\n * Defines common options for loading operations performed by SceneLoader.\r\n */\r\ninterface ISceneLoaderOptions {\r\n /**\r\n * A string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n */\r\n rootUrl?: string;\r\n\r\n /**\r\n * A callback with a progress event for each file being loaded\r\n */\r\n onProgress?: (event: ISceneLoaderProgressEvent) => void;\r\n\r\n /**\r\n * The extension used to determine the plugin\r\n */\r\n pluginExtension?: string;\r\n\r\n /**\r\n * Defines the filename, if the data is binary\r\n */\r\n name?: string;\r\n\r\n /**\r\n * Defines options for the registered plugins\r\n */\r\n pluginOptions?: {\r\n // NOTE: This type is doing two things:\r\n // 1. Adding an implicit 'enabled' property to the options for each plugin.\r\n // 2. Creating a mapped type of all the options of all the plugins to make it just look like a consolidated plain object in intellisense for the user.\r\n [Plugin in keyof SceneLoaderPluginOptions]?: {\r\n [Option in keyof DefaultPluginOptions<SceneLoaderPluginOptions[Plugin]>]: DefaultPluginOptions<SceneLoaderPluginOptions[Plugin]>[Option];\r\n };\r\n };\r\n}\r\n\r\n/**\r\n * Defines options for ImportMeshAsync.\r\n */\r\nexport interface ImportMeshOptions extends ISceneLoaderOptions {\r\n /**\r\n * An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n */\r\n meshNames?: string | readonly string[] | null | undefined;\r\n}\r\n\r\n/**\r\n * Defines options for LoadAsync.\r\n */\r\nexport interface LoadOptions extends ISceneLoaderOptions {}\r\n\r\n/**\r\n * Defines options for AppendAsync.\r\n */\r\nexport interface AppendOptions extends ISceneLoaderOptions {}\r\n\r\n/**\r\n * Defines options for LoadAssetContainerAsync.\r\n */\r\nexport interface LoadAssetContainerOptions extends ISceneLoaderOptions {}\r\n\r\n/**\r\n * Defines options for ImportAnimationsAsync.\r\n */\r\nexport interface ImportAnimationsOptions extends ISceneLoaderOptions {\r\n /**\r\n * When true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n */\r\n overwriteAnimations?: boolean;\r\n\r\n /**\r\n * Defines how to handle old animations groups before importing new ones\r\n */\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode;\r\n\r\n /**\r\n * defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n */\r\n targetConverter?: Nullable<(target: unknown) => unknown>;\r\n}\r\n\r\nfunction isFile(value: unknown): value is File {\r\n return !!(value as File).name;\r\n}\r\n\r\nconst onPluginActivatedObservable = new Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>();\r\nconst registeredPlugins: { [extension: string]: IRegisteredPlugin } = {};\r\nlet showingLoadingScreen = false;\r\n\r\nfunction getDefaultPlugin(): IRegisteredPlugin | undefined {\r\n return registeredPlugins[\".babylon\"];\r\n}\r\n\r\nfunction getPluginForMimeType(mimeType: string): IRegisteredPlugin | undefined {\r\n for (const registeredPluginKey in registeredPlugins) {\r\n const registeredPlugin = registeredPlugins[registeredPluginKey];\r\n if (registeredPlugin.mimeType === mimeType) {\r\n return registeredPlugin;\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getPluginForExtension(extension: string, returnDefault: boolean): IRegisteredPlugin | undefined {\r\n const registeredPlugin = registeredPlugins[extension];\r\n if (registeredPlugin) {\r\n return registeredPlugin;\r\n }\r\n Logger.Warn(\r\n \"Unable to find a plugin to load \" +\r\n extension +\r\n \" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes\"\r\n );\r\n return returnDefault ? getDefaultPlugin() : undefined;\r\n}\r\n\r\nfunction isPluginForExtensionAvailable(extension: string): boolean {\r\n return !!registeredPlugins[extension];\r\n}\r\n\r\nfunction getPluginForDirectLoad(data: string): IRegisteredPlugin | undefined {\r\n for (const extension in registeredPlugins) {\r\n const plugin = registeredPlugins[extension].plugin;\r\n\r\n if (plugin.canDirectLoad && plugin.canDirectLoad(data)) {\r\n return registeredPlugins[extension];\r\n }\r\n }\r\n\r\n return getDefaultPlugin();\r\n}\r\n\r\nfunction getFilenameExtension(sceneFilename: string): string {\r\n const queryStringPosition = sceneFilename.indexOf(\"?\");\r\n\r\n if (queryStringPosition !== -1) {\r\n sceneFilename = sceneFilename.substring(0, queryStringPosition);\r\n }\r\n\r\n const dotPosition = sceneFilename.lastIndexOf(\".\");\r\n\r\n return sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();\r\n}\r\n\r\nfunction getDirectLoad(sceneFilename: string): Nullable<string> {\r\n if (sceneFilename.substring(0, 5) === \"data:\") {\r\n return sceneFilename.substring(5);\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction formatErrorMessage(fileInfo: IFileInfo, message?: string, exception?: any): string {\r\n const fromLoad = fileInfo.rawData ? \"binary data\" : fileInfo.url;\r\n let errorMessage = \"Unable to load from \" + fromLoad;\r\n\r\n if (message) {\r\n errorMessage += `: ${message}`;\r\n } else if (exception) {\r\n errorMessage += `: ${exception}`;\r\n }\r\n\r\n return errorMessage;\r\n}\r\n\r\nasync function loadDataAsync(\r\n fileInfo: IFileInfo,\r\n scene: Scene,\r\n onSuccess: (plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync, data: unknown, responseURL?: string) => void,\r\n onProgress: ((event: ISceneLoaderProgressEvent) => void) | undefined,\r\n onError: (message?: string, exception?: any) => void,\r\n onDispose: () => void,\r\n pluginExtension: Nullable<string>,\r\n name: string,\r\n pluginOptions: PluginOptions\r\n): Promise<Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>> {\r\n const directLoad = getDirectLoad(fileInfo.url);\r\n\r\n if (fileInfo.rawData && !pluginExtension) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"When using ArrayBufferView to load data the file extension must be provided.\";\r\n }\r\n\r\n if (fileInfo.jsonData && !pluginExtension) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"When using object to load data the file extension must be provided.\";\r\n }\r\n\r\n const fileExtension = !directLoad && !pluginExtension ? getFilenameExtension(fileInfo.url) : \"\";\r\n\r\n let registeredPlugin = pluginExtension\r\n ? getPluginForExtension(pluginExtension, true)\r\n : directLoad\r\n ? getPluginForDirectLoad(fileInfo.url)\r\n : getPluginForExtension(fileExtension, false);\r\n\r\n if (!registeredPlugin && fileExtension) {\r\n if (fileInfo.url && !fileInfo.url.startsWith(\"blob:\")) {\r\n // Fetching head content to get the mime type\r\n const response = await _FetchAsync(fileInfo.url, { method: \"HEAD\", responseHeaders: [\"Content-Type\"] });\r\n const mimeType = response.headerValues ? response.headerValues[\"Content-Type\"] : \"\";\r\n if (mimeType) {\r\n // eslint-disable-next-line require-atomic-updates\r\n registeredPlugin = getPluginForMimeType(mimeType);\r\n }\r\n }\r\n\r\n if (!registeredPlugin) {\r\n registeredPlugin = getDefaultPlugin();\r\n }\r\n }\r\n\r\n if (!registeredPlugin) {\r\n throw new Error(`No plugin or fallback for ${pluginExtension ?? fileInfo.url}`);\r\n }\r\n\r\n if (pluginOptions?.[registeredPlugin.plugin.name]?.enabled === false) {\r\n throw new Error(`The '${registeredPlugin.plugin.name}' plugin is disabled via the loader options passed to the loading operation.`);\r\n }\r\n\r\n if (fileInfo.rawData && !registeredPlugin.isBinary) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Loading from ArrayBufferView can not be used with plugins that don't support binary loading.\";\r\n }\r\n\r\n const getPluginInstance = (callback: (plugin: (ISceneLoaderPlugin | ISceneLoaderPluginAsync) & Partial<ISceneLoaderPluginInternal>) => void) => {\r\n // For plugin factories, the plugin is instantiated on each SceneLoader operation. This makes options handling\r\n // much simpler as we can just pass the options to the factory, rather than passing options through to every possible\r\n // plugin call. Given this, options are only supported for plugins that provide a factory function.\r\n if (IsFactory(registeredPlugin.plugin)) {\r\n const pluginFactory = registeredPlugin.plugin;\r\n const partialPlugin = pluginFactory.createPlugin(pluginOptions ?? {});\r\n if (partialPlugin instanceof Promise) {\r\n // eslint-disable-next-line github/no-then\r\n partialPlugin.then(callback).catch((error) => {\r\n onError(\"Error instantiating plugin.\", error);\r\n });\r\n // When async factories are used, the plugin instance cannot be returned synchronously.\r\n // In this case, the legacy loader functions will return null.\r\n return null;\r\n } else {\r\n callback(partialPlugin);\r\n return partialPlugin;\r\n }\r\n } else {\r\n callback(registeredPlugin.plugin);\r\n return registeredPlugin.plugin;\r\n }\r\n };\r\n\r\n return getPluginInstance((plugin) => {\r\n if (!plugin) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw `The loader plugin corresponding to the '${pluginExtension}' file type has not been found. If using es6, please import the plugin you wish to use before.`;\r\n }\r\n\r\n onPluginActivatedObservable.notifyObservers(plugin);\r\n\r\n // Check if we have a direct load url. If the plugin is registered to handle\r\n // it or it's not a base64 data url, then pass it through the direct load path.\r\n if (directLoad && ((plugin.canDirectLoad && plugin.canDirectLoad(fileInfo.url)) || !IsBase64DataUrl(fileInfo.url))) {\r\n if (plugin.directLoad) {\r\n const result = plugin.directLoad(scene, directLoad);\r\n if (result instanceof Promise) {\r\n result\r\n // eslint-disable-next-line github/no-then\r\n .then((data: unknown) => {\r\n onSuccess(plugin, data);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((error: any) => {\r\n onError(\"Error in directLoad of _loadData: \" + error, error);\r\n });\r\n } else {\r\n onSuccess(plugin, result);\r\n }\r\n } else {\r\n onSuccess(plugin, directLoad);\r\n }\r\n return;\r\n }\r\n\r\n const useArrayBuffer = registeredPlugin.isBinary;\r\n\r\n const dataCallback = (data: unknown, responseURL?: string) => {\r\n if (scene.isDisposed) {\r\n onError(\"Scene has been disposed\");\r\n return;\r\n }\r\n\r\n onSuccess(plugin, data, responseURL);\r\n };\r\n\r\n let request: Nullable<IFileRequest> = null;\r\n let pluginDisposed = false;\r\n plugin.onDisposeObservable?.add(() => {\r\n pluginDisposed = true;\r\n\r\n if (request) {\r\n request.abort();\r\n request = null;\r\n }\r\n\r\n onDispose();\r\n });\r\n\r\n const manifestChecked = () => {\r\n if (pluginDisposed) {\r\n return;\r\n }\r\n\r\n const errorCallback = (request?: WebRequest, exception?: LoadFileError) => {\r\n onError(request?.statusText, exception);\r\n };\r\n\r\n if (!plugin.loadFile && fileInfo.rawData) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Plugin does not support loading ArrayBufferView.\";\r\n }\r\n\r\n request = plugin.loadFile\r\n ? plugin.loadFile(scene, fileInfo.rawData || fileInfo.file || fileInfo.url, fileInfo.rootUrl, dataCallback, onProgress, useArrayBuffer, errorCallback, name)\r\n : scene._loadFile(fileInfo.jsonData || fileInfo.file || fileInfo.url, dataCallback, onProgress, true, useArrayBuffer, errorCallback);\r\n };\r\n\r\n const engine = scene.getEngine();\r\n let canUseOfflineSupport = engine.enableOfflineSupport;\r\n if (canUseOfflineSupport) {\r\n // Also check for exceptions\r\n let exceptionFound = false;\r\n for (const regex of scene.disableOfflineSupportExceptionRules) {\r\n if (regex.test(fileInfo.url)) {\r\n exceptionFound = true;\r\n break;\r\n }\r\n }\r\n\r\n canUseOfflineSupport = !exceptionFound;\r\n }\r\n\r\n if (canUseOfflineSupport && AbstractEngine.OfflineProviderFactory) {\r\n // Checking if a manifest file has been set for this scene and if offline mode has been requested\r\n scene.offlineProvider = AbstractEngine.OfflineProviderFactory(fileInfo.url, manifestChecked, engine.disableManifestCheck);\r\n } else {\r\n manifestChecked();\r\n }\r\n });\r\n}\r\n\r\nfunction GetFileInfo(rootUrl: string, sceneSource: SceneSource): Nullable<IFileInfo> {\r\n let url: string;\r\n let name: string;\r\n let file: Nullable<File> = null;\r\n let rawData: Nullable<ArrayBufferView> = null;\r\n let jsonData: Nullable<object> = null;\r\n\r\n if (!sceneSource) {\r\n url = rootUrl;\r\n name = Tools.GetFilename(rootUrl);\r\n rootUrl = Tools.GetFolderPath(rootUrl);\r\n } else if (isFile(sceneSource)) {\r\n url = `file:${sceneSource.name}`;\r\n name = sceneSource.name;\r\n file = sceneSource;\r\n } else if (ArrayBuffer.isView(sceneSource)) {\r\n url = \"\";\r\n name = RandomGUID();\r\n rawData = sceneSource;\r\n } else if (typeof sceneSource === \"object\") {\r\n url = \"\";\r\n name = RandomGUID();\r\n jsonData = sceneSource;\r\n } else if (sceneSource.startsWith(\"data:\")) {\r\n url = sceneSource;\r\n name = \"\";\r\n } else if (rootUrl) {\r\n const filename = sceneSource;\r\n if (filename.substring(0, 1) === \"/\") {\r\n Tools.Error(\"Wrong sceneFilename parameter\");\r\n return null;\r\n }\r\n\r\n url = rootUrl + filename;\r\n name = filename;\r\n } else {\r\n url = sceneSource;\r\n name = Tools.GetFilename(sceneSource);\r\n rootUrl = Tools.GetFolderPath(sceneSource);\r\n }\r\n\r\n return {\r\n url: url,\r\n rootUrl: rootUrl,\r\n name: name,\r\n file: file,\r\n rawData,\r\n jsonData,\r\n };\r\n}\r\n\r\n/**\r\n * Adds a new plugin to the list of registered plugins\r\n * @param plugin defines the plugin to add\r\n */\r\nexport function RegisterSceneLoaderPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory): void {\r\n if (typeof plugin.extensions === \"string\") {\r\n const extension = plugin.extensions;\r\n registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: false,\r\n };\r\n } else {\r\n const extensions = plugin.extensions;\r\n const keys = Object.keys(extensions);\r\n for (const extension of keys) {\r\n registeredPlugins[extension.toLowerCase()] = {\r\n plugin: plugin,\r\n isBinary: extensions[extension].isBinary,\r\n mimeType: extensions[extension].mimeType,\r\n };\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Adds a new plugin to the list of registered plugins\r\n * @deprecated Please use {@link RegisterSceneLoaderPlugin} instead.\r\n * @param plugin defines the plugin to add\r\n */\r\nexport function registerSceneLoaderPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory): void {\r\n RegisterSceneLoaderPlugin(plugin);\r\n}\r\n\r\n/**\r\n * Gets metadata for all currently registered scene loader plugins.\r\n * @returns An array where each entry has metadata for a single scene loader plugin.\r\n */\r\nexport function GetRegisteredSceneLoaderPluginMetadata(): DeepImmutable<\r\n Array<\r\n Pick<ISceneLoaderPluginMetadata, \"name\"> & {\r\n /**\r\n * The extensions supported by the plugin.\r\n */\r\n extensions: ({\r\n /**\r\n * The file extension.\r\n */\r\n extension: string;\r\n } & ISceneLoaderPluginExtensions[string])[];\r\n }\r\n >\r\n> {\r\n return Array.from(\r\n Object.entries(registeredPlugins).reduce((pluginMap, [extension, extensionRegistration]) => {\r\n let pluginMetadata = pluginMap.get(extensionRegistration.plugin.name);\r\n if (!pluginMetadata) {\r\n pluginMap.set(extensionRegistration.plugin.name, (pluginMetadata = []));\r\n }\r\n pluginMetadata.push({ extension, isBinary: extensionRegistration.isBinary, mimeType: extensionRegistration.mimeType });\r\n return pluginMap;\r\n }, new Map<string, ({ extension: string } & ISceneLoaderPluginExtensions[string])[]>())\r\n ).map(([name, extensions]) => ({ name, extensions }));\r\n}\r\n\r\n/**\r\n * Import meshes into a scene\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n */\r\nexport async function ImportMeshAsync(source: SceneSource, scene: Scene, options?: ImportMeshOptions): Promise<ISceneLoaderAsyncResult> {\r\n const { meshNames, rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = options ?? {};\r\n return await importMeshAsyncCoreAsync(meshNames, rootUrl, source, scene, onProgress, pluginExtension, name, pluginOptions);\r\n}\r\n\r\nasync function importMeshAsync(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<SceneLoaderSuccessCallback> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n): Promise<Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to import mesh to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = formatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback: \" + e, e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler: SceneLoaderSuccessCallback = (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers) => {\r\n scene.importedMeshesFiles.push(fileInfo.url);\r\n\r\n if (onSuccess) {\r\n try {\r\n onSuccess(meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback: \" + e, e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return await loadDataAsync(\r\n fileInfo,\r\n scene,\r\n (plugin, data, responseURL) => {\r\n if (plugin.rewriteRootURL) {\r\n fileInfo.rootUrl = plugin.rewriteRootURL(fileInfo.rootUrl, responseURL);\r\n }\r\n\r\n if ((plugin as ISceneLoaderPlugin).importMesh) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n const meshes: AbstractMesh[] = [];\r\n const particleSystems: IParticleSystem[] = [];\r\n const skeletons: Skeleton[] = [];\r\n\r\n if (!syncedPlugin.importMesh(meshNames, scene, data, fileInfo.rootUrl, meshes, particleSystems, skeletons, errorHandler)) {\r\n return;\r\n }\r\n\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(meshes, particleSystems, skeletons, [], [], [], [], []);\r\n } else {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .importMeshAsync(meshNames, scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n // eslint-disable-next-line github/no-then\r\n .then((result) => {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(\r\n result.meshes,\r\n result.particleSystems,\r\n result.skeletons,\r\n result.animationGroups,\r\n result.transformNodes,\r\n result.geometries,\r\n result.lights,\r\n result.spriteManagers\r\n );\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n}\r\n\r\nasync function importMeshAsyncCoreAsync(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n): Promise<ISceneLoaderAsyncResult> {\r\n return await new Promise((resolve, reject) => {\r\n try {\r\n importMeshAsync(\r\n meshNames,\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights, spriteManagers) => {\r\n resolve({\r\n meshes: meshes,\r\n particleSystems: particleSystems,\r\n skeletons: skeletons,\r\n animationGroups: animationGroups,\r\n transformNodes: transformNodes,\r\n geometries: geometries,\r\n lights: lights,\r\n spriteManagers: spriteManagers,\r\n });\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n // eslint-disable-next-line github/no-then\r\n ).catch(reject);\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(error);\r\n }\r\n });\r\n}\r\n\r\n// This is the core implementation of load scene\r\nasync function loadSceneImplAsync(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n engine: Nullable<AbstractEngine> = EngineStore.LastCreatedEngine,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n): Promise<void> {\r\n if (!engine) {\r\n Tools.Error(\"No engine available\");\r\n return;\r\n }\r\n\r\n await appendSceneImplAsync(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Load a scene\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded scene\r\n */\r\nexport async function LoadSceneAsync(source: SceneSource, engine: AbstractEngine, options?: LoadOptions): Promise<Scene> {\r\n const { rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = options ?? {};\r\n return await loadSceneSharedAsync(rootUrl, source, engine, onProgress, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Load a scene\r\n * @deprecated Please use {@link LoadSceneAsync} instead.\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded scene\r\n */\r\nexport async function loadSceneAsync(source: SceneSource, engine: AbstractEngine, options?: LoadOptions): Promise<Scene> {\r\n return await LoadSceneAsync(source, engine, options);\r\n}\r\n\r\n// This function is shared between the new module level loadSceneAsync and the legacy SceneLoader.LoadAsync\r\nasync function loadSceneSharedAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n engine?: Nullable<AbstractEngine>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n): Promise<Scene> {\r\n return await new Promise((resolve, reject) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n loadSceneImplAsync(\r\n rootUrl,\r\n sceneFilename,\r\n engine,\r\n (scene) => {\r\n resolve(scene);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n });\r\n}\r\n\r\n// This is the core implementation of append scene\r\nasync function appendSceneImplAsync(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n): Promise<Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to append to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n if (SceneLoaderFlags.ShowLoadingScreen && !showingLoadingScreen) {\r\n showingLoadingScreen = true;\r\n scene.getEngine().displayLoadingUI();\r\n scene.executeWhenReady(() => {\r\n scene.getEngine().hideLoadingUI();\r\n showingLoadingScreen = false;\r\n });\r\n }\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = formatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler = () => {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(scene);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return await loadDataAsync(\r\n fileInfo,\r\n scene,\r\n (plugin, data) => {\r\n if ((plugin as ISceneLoaderPlugin).load) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n if (!syncedPlugin.load(scene, data, fileInfo.rootUrl, errorHandler)) {\r\n return;\r\n }\r\n\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n } else {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .loadAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n // eslint-disable-next-line github/no-then\r\n .then(() => {\r\n scene.loadingPluginName = plugin.name;\r\n successHandler();\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n}\r\n\r\n/**\r\n * Append a scene\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns A promise that resolves when the scene is appended\r\n */\r\nexport async function AppendSceneAsync(source: SceneSource, scene: Scene, options?: AppendOptions): Promise<void> {\r\n const { rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = options ?? {};\r\n await appendSceneSharedAsync(rootUrl, source, scene, onProgress, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Append a scene\r\n * @deprecated Please use {@link AppendSceneAsync} instead.\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns A promise that resolves when the scene is appended\r\n */\r\nexport async function appendSceneAsync(source: SceneSource, scene: Scene, options?: AppendOptions): Promise<void> {\r\n return await AppendSceneAsync(source, scene, options);\r\n}\r\n\r\n// This function is shared between the new module level appendSceneAsync and the legacy SceneLoader.AppendAsync\r\nasync function appendSceneSharedAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n): Promise<Scene> {\r\n return await new Promise((resolve, reject) => {\r\n try {\r\n appendSceneImplAsync(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (scene) => {\r\n resolve(scene);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n // eslint-disable-next-line github/no-then\r\n ).catch(reject);\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(error);\r\n }\r\n });\r\n}\r\n\r\n// This is the core implementation of load asset container\r\nasync function loadAssetContainerImplAsync(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n onSuccess: Nullable<(assets: AssetContainer) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n): Promise<Nullable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load asset container to\");\r\n return null;\r\n }\r\n\r\n const fileInfo = GetFileInfo(rootUrl, sceneFilename);\r\n if (!fileInfo) {\r\n return null;\r\n }\r\n\r\n const loadingToken = {};\r\n scene.addPendingData(loadingToken);\r\n\r\n const disposeHandler = () => {\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n const errorMessage = formatErrorMessage(fileInfo, message, exception);\r\n\r\n if (onError) {\r\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\r\n } else {\r\n Logger.Error(errorMessage);\r\n // should the exception be thrown?\r\n }\r\n\r\n disposeHandler();\r\n };\r\n\r\n const progressHandler = onProgress\r\n ? (event: ISceneLoaderProgressEvent) => {\r\n try {\r\n onProgress(event);\r\n } catch (e) {\r\n errorHandler(\"Error in onProgress callback\", e);\r\n }\r\n }\r\n : undefined;\r\n\r\n const successHandler = (assets: AssetContainer) => {\r\n if (onSuccess) {\r\n try {\r\n onSuccess(assets);\r\n } catch (e) {\r\n errorHandler(\"Error in onSuccess callback\", e);\r\n }\r\n }\r\n\r\n scene.removePendingData(loadingToken);\r\n };\r\n\r\n return await loadDataAsync(\r\n fileInfo,\r\n scene,\r\n (plugin, data) => {\r\n if ((plugin as ISceneLoaderPlugin).loadAssetContainer) {\r\n const syncedPlugin = <ISceneLoaderPlugin>plugin;\r\n const assetContainer = syncedPlugin.loadAssetContainer(scene, data, fileInfo.rootUrl, errorHandler);\r\n if (!assetContainer) {\r\n return;\r\n }\r\n assetContainer.populateRootNodes();\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n } else if ((plugin as ISceneLoaderPluginAsync).loadAssetContainerAsync) {\r\n const asyncedPlugin = <ISceneLoaderPluginAsync>plugin;\r\n asyncedPlugin\r\n .loadAssetContainerAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\r\n // eslint-disable-next-line github/no-then\r\n .then((assetContainer) => {\r\n assetContainer.populateRootNodes();\r\n scene.loadingPluginName = plugin.name;\r\n successHandler(assetContainer);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((error) => {\r\n errorHandler(error.message, error);\r\n });\r\n } else {\r\n errorHandler(\"LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.\");\r\n }\r\n },\r\n progressHandler,\r\n errorHandler,\r\n disposeHandler,\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n );\r\n}\r\n\r\n/**\r\n * Load a scene into an asset container\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded asset container\r\n */\r\nexport async function LoadAssetContainerAsync(source: SceneSource, scene: Scene, options?: LoadAssetContainerOptions): Promise<AssetContainer> {\r\n const { rootUrl = \"\", onProgress, pluginExtension, name, pluginOptions } = options ?? {};\r\n return await loadAssetContainerSharedAsync(rootUrl, source, scene, onProgress, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Load a scene into an asset container\r\n * @deprecated Please use {@link LoadAssetContainerAsync} instead.\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns The loaded asset container\r\n */\r\nexport async function loadAssetContainerAsync(source: SceneSource, scene: Scene, options?: LoadAssetContainerOptions): Promise<AssetContainer> {\r\n return await LoadAssetContainerAsync(source, scene, options);\r\n}\r\n\r\n// This function is shared between the new module level loadAssetContainerAsync and the legacy SceneLoader.LoadAssetContainerAsync\r\nasync function loadAssetContainerSharedAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n): Promise<AssetContainer> {\r\n return await new Promise((resolve, reject) => {\r\n try {\r\n loadAssetContainerImplAsync(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n (assets) => {\r\n resolve(assets);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n // eslint-disable-next-line github/no-then\r\n ).catch(reject);\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(error);\r\n }\r\n });\r\n}\r\n\r\n// This is the core implementation of import animations\r\nasync function importAnimationsImplAsync(\r\n rootUrl: string,\r\n sceneFilename: SceneSource = \"\",\r\n scene: Nullable<Scene> = EngineStore.LastCreatedScene,\r\n overwriteAnimations = true,\r\n animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean,\r\n targetConverter: Nullable<(target: any) => any> = null,\r\n onSuccess: Nullable<(scene: Scene) => void> = null,\r\n onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null,\r\n onError: Nullable<(scene: Scene, message: string, exception?: any) => void> = null,\r\n pluginExtension: Nullable<string> = null,\r\n name = \"\",\r\n pluginOptions: PluginOptions = {}\r\n): Promise<void> {\r\n if (!scene) {\r\n Logger.Error(\"No scene available to load animations to\");\r\n return;\r\n }\r\n\r\n if (overwriteAnimations) {\r\n // Reset, stop and dispose all animations before loading new ones\r\n for (const animatable of scene.animatables) {\r\n animatable.reset();\r\n }\r\n scene.stopAllAnimations();\r\n const animationGroups = scene.animationGroups.slice();\r\n for (const animationGroup of animationGroups) {\r\n animationGroup.dispose();\r\n }\r\n const nodes = scene.getNodes();\r\n for (const node of nodes) {\r\n if (node.animations) {\r\n node.animations = [];\r\n }\r\n }\r\n } else {\r\n switch (animationGroupLoadingMode as number) {\r\n case SceneLoaderAnimationGroupLoadingMode.Clean:\r\n const animationGroups = scene.animationGroups.slice();\r\n for (const animationGroup of animationGroups) {\r\n animationGroup.dispose();\r\n }\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Stop:\r\n for (const animationGroup of scene.animationGroups) {\r\n animationGroup.stop();\r\n }\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.Sync:\r\n for (const animationGroup of scene.animationGroups) {\r\n animationGroup.reset();\r\n animationGroup.restart();\r\n }\r\n break;\r\n case SceneLoaderAnimationGroupLoadingMode.NoSync:\r\n // nothing to do\r\n break;\r\n default:\r\n Logger.Error(\"Unknown animation group loading mode value '\" + animationGroupLoadingMode + \"'\");\r\n return;\r\n }\r\n }\r\n\r\n const startingIndexForNewAnimatables = scene.animatables.length;\r\n\r\n const onAssetContainerLoaded = (container: AssetContainer) => {\r\n container.mergeAnimationsTo(scene, scene.animatables.slice(startingIndexForNewAnimatables), targetConverter);\r\n\r\n container.dispose();\r\n\r\n scene.onAnimationFileImportedObservable.notifyObservers(scene);\r\n\r\n if (onSuccess) {\r\n onSuccess(scene);\r\n }\r\n };\r\n\r\n await loadAssetContainerImplAsync(rootUrl, sceneFilename, scene, onAssetContainerLoaded, onProgress, onError, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Import animations from a file into a scene\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns A promise that resolves when the animations are imported\r\n */\r\nexport async function ImportAnimationsAsync(source: SceneSource, scene: Scene, options?: ImportAnimationsOptions): Promise<void> {\r\n const { rootUrl = \"\", overwriteAnimations, animationGroupLoadingMode, targetConverter, onProgress, pluginExtension, name, pluginOptions } = options ?? {};\r\n await importAnimationsSharedAsync(rootUrl, source, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, onProgress, pluginExtension, name, pluginOptions);\r\n}\r\n\r\n/**\r\n * Import animations from a file into a scene\r\n * @deprecated Please use {@link ImportAnimationsAsync} instead.\r\n * @param source a string that defines the name of the scene file, or starts with \"data:\" following by the stringified version of the scene, or a File object, or an ArrayBufferView\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param options an object that configures aspects of how the scene is loaded\r\n * @returns A promise that resolves when the animations are imported\r\n */\r\nexport async function importAnimationsAsync(source: SceneSource, scene: Scene, options?: ImportAnimationsOptions): Promise<void> {\r\n return await ImportAnimationsAsync(source, scene, options);\r\n}\r\n\r\n// This function is shared between the new module level importAnimationsAsync and the legacy SceneLoader.ImportAnimationsAsync\r\nasync function importAnimationsSharedAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n overwriteAnimations?: boolean,\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode,\r\n targetConverter?: Nullable<(target: any) => any>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n): Promise<Scene> {\r\n return await new Promise((resolve, reject) => {\r\n try {\r\n importAnimationsImplAsync(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n overwriteAnimations,\r\n animationGroupLoadingMode,\r\n targetConverter,\r\n (scene) => {\r\n resolve(scene);\r\n },\r\n onProgress,\r\n (scene, message, exception) => {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(exception || new Error(message));\r\n },\r\n pluginExtension,\r\n name,\r\n pluginOptions\r\n // eslint-disable-next-line github/no-then\r\n ).catch(reject);\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(error);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Class used to load scene from various file formats using registered plugins\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes\r\n * @deprecated The module level functions are more efficient for bundler tree shaking and allow plugin options to be passed through. Future improvements to scene loading will primarily be in the module level functions. The SceneLoader class will remain available, but it will be beneficial to prefer the module level functions.\r\n * @see {@link ImportMeshAsync}, {@link LoadSceneAsync}, {@link AppendSceneAsync}, {@link ImportAnimationsAsync}, {@link LoadAssetContainerAsync}\r\n */\r\nexport class SceneLoader {\r\n /**\r\n * No logging while loading\r\n */\r\n public static readonly NO_LOGGING = Constants.SCENELOADER_NO_LOGGING;\r\n\r\n /**\r\n * Minimal logging while loading\r\n */\r\n public static readonly MINIMAL_LOGGING = Constants.SCENELOADER_MINIMAL_LOGGING;\r\n\r\n /**\r\n * Summary logging while loading\r\n */\r\n public static readonly SUMMARY_LOGGING = Constants.SCENELOADER_SUMMARY_LOGGING;\r\n\r\n /**\r\n * Detailed logging while loading\r\n */\r\n public static readonly DETAILED_LOGGING = Constants.SCENELOADER_DETAILED_LOGGING;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\r\n */\r\n public static get ForceFullSceneLoadingForIncremental() {\r\n return SceneLoaderFlags.ForceFullSceneLoadingForIncremental;\r\n }\r\n\r\n public static set ForceFullSceneLoadingForIncremental(value: boolean) {\r\n SceneLoaderFlags.ForceFullSceneLoadingForIncremental = value;\r\n }\r\n\r\n /**\r\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\r\n */\r\n public static get ShowLoadingScreen(): boolean {\r\n return SceneLoaderFlags.ShowLoadingScreen;\r\n }\r\n\r\n public static set ShowLoadingScreen(value: boolean) {\r\n SceneLoaderFlags.ShowLoadingScreen = value;\r\n }\r\n\r\n /**\r\n * Defines the current logging level (while loading the scene)\r\n * @ignorenaming\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static get loggingLevel(): number {\r\n return SceneLoaderFlags.loggingLevel;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public static set loggingLevel(value: number) {\r\n SceneLoaderFlags.loggingLevel = value;\r\n }\r\n\r\n /**\r\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\r\n */\r\n public static get CleanBoneMatrixWeights(): boolean {\r\n return SceneLoaderFlags.CleanBoneMatrixWeights;\r\n }\r\n\r\n public static set CleanBoneMatrixWeights(value: boolean) {\r\n SceneLoaderFlags.CleanBoneMatrixWeights = value;\r\n }\r\n\r\n // Members\r\n\r\n /**\r\n * Event raised when a plugin is used to load a scene\r\n */\r\n public static readonly OnPluginActivatedObservable = onPluginActivatedObservable;\r\n\r\n /**\r\n * Gets the default plugin (used to load Babylon files)\r\n * @returns the .babylon plugin\r\n */\r\n public static GetDefaultPlugin(): IRegisteredPlugin | undefined {\r\n return getDefaultPlugin();\r\n }\r\n\r\n // Public functions\r\n\r\n /**\r\n * Gets a plugin that can load the given extension\r\n * @param extension defines the extension to load\r\n * @returns a plugin or null if none works\r\n */\r\n public static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory | undefined {\r\n return getPluginForExtension(extension, true)?.plugin;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the given extension can be loaded\r\n * @param extension defines the extension to load\r\n * @returns true if the extension is supported\r\n */\r\n public static IsPluginForExtensionAvailable(extension: string): boolean {\r\n return isPluginForExtensionAvailable(extension);\r\n }\r\n\r\n /**\r\n * Adds a new plugin to the list of registered plugins\r\n * @param plugin defines the plugin to add\r\n */\r\n public static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory): void {\r\n RegisterSceneLoaderPlugin(plugin);\r\n }\r\n\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with a list of imported meshes, particleSystems, skeletons, and animationGroups when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @param pluginOptions defines the options to use with the plugin\r\n * @deprecated Please use the module level {@link ImportMeshAsync} instead\r\n */\r\n public static ImportMesh(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onSuccess?: Nullable<SceneLoaderSuccessCallback>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string,\r\n pluginOptions?: PluginOptions\r\n ): void {\r\n // eslint-disable-next-line github/no-then\r\n importMeshAsync(meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name, pluginOptions).catch((error) =>\r\n onError?.(EngineStore.LastCreatedScene!, error?.message, error)\r\n );\r\n }\r\n\r\n /**\r\n * Import meshes into a scene\r\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file\r\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\r\n * @deprecated Please use the module level {@link ImportMeshAsync} instead\r\n */\r\n public static async ImportMeshAsync(\r\n meshNames: string | readonly string[] | null | undefined,\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<ISceneLoaderAsyncResult> {\r\n return await importMeshAsyncCoreAsync(meshNames, rootUrl, sceneFilename, scene, onProgress, pluginExtension, name);\r\n }\r\n\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @deprecated Please use the module level {@link LoadSceneAsync} instead\r\n */\r\n public static Load(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n engine?: Nullable<AbstractEngine>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ) {\r\n // eslint-disable-next-line github/no-then\r\n loadSceneImplAsync(rootUrl, sceneFilename, engine, onSuccess, onProgress, onError, pluginExtension, name).catch((error) =>\r\n onError?.(EngineStore.LastCreatedScene!, error?.message, error)\r\n );\r\n }\r\n\r\n /**\r\n * Load a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param engine is the instance of BABYLON.Engine to use to create the scene\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded scene\r\n * @deprecated Please use the module level {@link LoadSceneAsync} instead\r\n */\r\n public static async LoadAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n engine?: Nullable<AbstractEngine>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<Scene> {\r\n return await loadSceneSharedAsync(rootUrl, sceneFilename, engine, onProgress, pluginExtension, name);\r\n }\r\n\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @deprecated Please use the module level {@link AppendSceneAsync} instead\r\n */\r\n public static Append(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ) {\r\n // eslint-disable-next-line github/no-then\r\n appendSceneImplAsync(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name).catch((error) =>\r\n onError?.((scene ?? EngineStore.LastCreatedScene)!, error?.message, error)\r\n );\r\n }\r\n\r\n /**\r\n * Append a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the name of the file, if the data is binary\r\n * @returns The given scene\r\n * @deprecated Please use the module level {@link AppendSceneAsync} instead\r\n */\r\n public static async AppendAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<Scene> {\r\n return await appendSceneSharedAsync(rootUrl, sceneFilename, scene, onProgress, pluginExtension, name);\r\n }\r\n\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @deprecated Please use the module level {@link LoadAssetContainerAsync} instead\r\n */\r\n public static LoadAssetContainer(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onSuccess?: Nullable<(assets: AssetContainer) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ) {\r\n // eslint-disable-next-line github/no-then\r\n loadAssetContainerImplAsync(rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension, name).catch((error) =>\r\n onError?.((scene ?? EngineStore.LastCreatedScene)!, error?.message, error)\r\n );\r\n }\r\n\r\n /**\r\n * Load a scene into an asset container\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene (default: empty string)\r\n * @param scene is the instance of Scene to append to\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns The loaded asset container\r\n * @deprecated Please use the module level {@link LoadAssetContainerAsync} instead\r\n */\r\n public static async LoadAssetContainerAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<AssetContainer> {\r\n return await loadAssetContainerSharedAsync(rootUrl, sceneFilename, scene, onProgress, pluginExtension, name);\r\n }\r\n\r\n /**\r\n * Import animations from a file into a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @deprecated Please use the module level {@link ImportAnimationsAsync} instead\r\n */\r\n public static ImportAnimations(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n overwriteAnimations?: boolean,\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode,\r\n targetConverter?: Nullable<(target: any) => any>,\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): void {\r\n importAnimationsImplAsync(\r\n rootUrl,\r\n sceneFilename,\r\n scene,\r\n overwriteAnimations,\r\n animationGroupLoadingMode,\r\n targetConverter,\r\n onSuccess,\r\n onProgress,\r\n onError,\r\n pluginExtension,\r\n name\r\n // eslint-disable-next-line github/no-then\r\n ).catch((error) => onError?.((scene ?? EngineStore.LastCreatedScene)!, error?.message, error));\r\n }\r\n\r\n /**\r\n * Import animations from a file into a scene\r\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\r\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\r\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\r\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\r\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\r\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\r\n * @param onSuccess a callback with the scene when import succeeds\r\n * @param onProgress a callback with a progress event for each file being loaded\r\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\r\n * @param pluginExtension the extension used to determine the plugin\r\n * @param name defines the filename, if the data is binary\r\n * @returns the updated scene with imported animations\r\n * @deprecated Please use the module level {@link ImportAnimationsAsync} instead\r\n */\r\n public static async ImportAnimationsAsync(\r\n rootUrl: string,\r\n sceneFilename?: SceneSource,\r\n scene?: Nullable<Scene>,\r\n overwriteAnimations?: boolean,\r\n animationGroupLoadingMode?: SceneLoaderAnimationGroupLoadingMode,\r\n targetConverter?: Nullable<(target: any) => any>,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n onSuccess?: Nullable<(scene: Scene) => void>,\r\n onProgress?: Nullable<(event: ISceneLoaderProgressEvent) => void>,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n onError?: Nullable<(scene: Scene, message: string, exception?: any) => void>,\r\n pluginExtension?: Nullable<string>,\r\n name?: string\r\n ): Promise<Scene> {\r\n return await importAnimationsSharedAsync(rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, onProgress, pluginExtension, name);\r\n }\r\n}\r\n"]}
package/Misc/fileTools.js CHANGED
@@ -381,7 +381,7 @@ export const ReadFile = (file, onSuccess, onProgress, useArrayBuffer, onError) =
381
381
  */
382
382
  // eslint-disable-next-line @typescript-eslint/naming-convention
383
383
  export const LoadFile = (fileOrUrl, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError, onOpened) => {
384
- if (fileOrUrl.name) {
384
+ if (fileOrUrl.name || typeof fileOrUrl === "object") {
385
385
  return ReadFile(fileOrUrl, onSuccess, onProgress, useArrayBuffer, onError
386
386
  ? (error) => {
387
387
  onError(undefined, error);
@@ -1 +1 @@
1
- {"version":3,"file":"fileTools.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/fileTools.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,+CAA8C;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC,gCAAgC,CAAC,CAAC;AAExE,cAAc;AACd,MAAM,OAAO,aAAc,SAAQ,YAAY;IAI3C;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAA0B;QACnD,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;QAEzC,IAAI,CAAC,IAAI,GAAG,eAAe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,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { WebRequest } from \"./webRequest\";\r\nimport { IsWindowObjectExist } from \"./domManagement\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { IOfflineProvider } from \"../Offline/IOfflineProvider\";\r\nimport type { IFileRequest } from \"./fileRequest\";\r\nimport { Observable } from \"./observable\";\r\nimport { FilesInputStore } from \"./filesInputStore\";\r\nimport { RetryStrategy } from \"./retryStrategy\";\r\nimport { BaseError, ErrorCodes, RuntimeError } from \"./error\";\r\nimport { DecodeBase64ToBinary, DecodeBase64ToString, EncodeArrayBufferToBase64 } from \"./stringTools\";\r\nimport { _FunctionContainer } from \"../Engines/Processors/shaderProcessor\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"./logger\";\r\nimport { TimingTools } from \"./timingTools\";\r\nimport { EngineFunctionContext } from \"core/Engines/abstractEngine.functions\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\nconst Base64DataUrlRegEx = new RegExp(/^data:([^,]+\\/[^,]+)?;base64,/i);\r\n\r\n/** @ignore */\r\nexport class LoadFileError extends RuntimeError {\r\n public request?: WebRequest;\r\n public file?: File;\r\n\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param object defines the optional web request\r\n */\r\n constructor(message: string, object?: WebRequest | File) {\r\n super(message, ErrorCodes.LoadFileError);\r\n\r\n this.name = \"LoadFileError\";\r\n BaseError._setPrototypeOf(this, LoadFileError.prototype);\r\n\r\n if (object instanceof WebRequest) {\r\n this.request = object;\r\n } else {\r\n this.file = object;\r\n }\r\n }\r\n}\r\n\r\n/** @ignore */\r\nexport class RequestFileError extends RuntimeError {\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n */\r\n constructor(\r\n message: string,\r\n public request: WebRequest\r\n ) {\r\n super(message, ErrorCodes.RequestFileError);\r\n this.name = \"RequestFileError\";\r\n BaseError._setPrototypeOf(this, RequestFileError.prototype);\r\n }\r\n}\r\n\r\n/** @ignore */\r\nexport class ReadFileError extends RuntimeError {\r\n /**\r\n * Creates a new ReadFileError\r\n * @param message defines the message of the error\r\n * @param file defines the optional file\r\n */\r\n constructor(\r\n message: string,\r\n public file: File\r\n ) {\r\n super(message, ErrorCodes.ReadFileError);\r\n this.name = \"ReadFileError\";\r\n BaseError._setPrototypeOf(this, ReadFileError.prototype);\r\n }\r\n}\r\n\r\n/**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\nconst CleanUrl = (url: string): string => {\r\n url = url.replace(/#/gm, \"%23\");\r\n return url;\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\nexport const FileToolsOptions: {\r\n DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;\r\n BaseUrl: string;\r\n CorsBehavior: string | ((url: string | string[]) => string);\r\n PreprocessUrl: (url: string) => string;\r\n ScriptBaseUrl: string;\r\n ScriptPreprocessUrl: (url: string) => string;\r\n CleanUrl: (url: string) => string;\r\n} = {\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset.\r\n * When defining this function, return the wait time before trying again or return -1 to\r\n * stop retrying and error out.\r\n */\r\n DefaultRetryStrategy: RetryStrategy.ExponentialBackoff(),\r\n\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n BaseUrl: \"\",\r\n\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n CorsBehavior: \"anonymous\",\r\n\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n * @param url\r\n * @returns the processed url\r\n */\r\n PreprocessUrl: (url: string) => url,\r\n\r\n /**\r\n * Gets or sets the base URL to use to load scripts\r\n * Used for both JS and WASM\r\n */\r\n ScriptBaseUrl: \"\",\r\n /**\r\n * Gets or sets a function used to pre-process script url before using them to load.\r\n * Used for both JS and WASM\r\n * @param url defines the url to process\r\n * @returns the processed url\r\n */\r\n ScriptPreprocessUrl: (url: string) => url,\r\n\r\n /**\r\n * Gets or sets a function used to clean the url before using it to load assets\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n CleanUrl,\r\n};\r\n\r\n/**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n * @internal\r\n */\r\nexport const SetCorsBehavior = (url: string | string[], element: { crossOrigin: string | null }): void => {\r\n if (url && url.indexOf(\"data:\") === 0) {\r\n return;\r\n }\r\n\r\n if (FileToolsOptions.CorsBehavior) {\r\n if (typeof FileToolsOptions.CorsBehavior === \"string\" || FileToolsOptions.CorsBehavior instanceof String) {\r\n element.crossOrigin = <string>FileToolsOptions.CorsBehavior;\r\n } else {\r\n const result = FileToolsOptions.CorsBehavior(url);\r\n if (result) {\r\n element.crossOrigin = result;\r\n }\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Configuration used to load images\r\n * @see https://playground.babylonjs.com/#DKMEZK#2\r\n */\r\nexport const LoadImageConfiguration: {\r\n /**\r\n * Use this callback if you want to provide the required size of an image before loading it.\r\n */\r\n getRequiredSize: Nullable<\r\n (input: string | ArrayBuffer | ArrayBufferView | Blob) => {\r\n width: number;\r\n height: number;\r\n }\r\n >;\r\n} = {\r\n getRequiredSize: null,\r\n};\r\n\r\n/**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @param imageBitmapOptions\r\n * @param engine the engine instance to use\r\n * @returns the HTMLImageElement of the loaded image\r\n * @internal\r\n */\r\nexport const LoadImage = (\r\n input: string | ArrayBuffer | ArrayBufferView | Blob,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType: string = \"\",\r\n imageBitmapOptions?: ImageBitmapOptions,\r\n engine = EngineStore.LastCreatedEngine\r\n): Nullable<HTMLImageElement> => {\r\n if (typeof HTMLImageElement === \"undefined\" && !engine?._features.forceBitmapOverHTMLImageElement) {\r\n onError(\"LoadImage is only supported in web or BabylonNative environments.\");\r\n return null;\r\n }\r\n\r\n let url: string;\r\n let usingObjectURL = false;\r\n\r\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\r\n if (typeof Blob !== \"undefined\" && typeof URL !== \"undefined\") {\r\n url = URL.createObjectURL(new Blob([input], { type: mimeType }));\r\n usingObjectURL = true;\r\n } else {\r\n url = `data:${mimeType};base64,` + EncodeArrayBufferToBase64(input);\r\n }\r\n } else if (input instanceof Blob) {\r\n url = URL.createObjectURL(input);\r\n usingObjectURL = true;\r\n } else {\r\n url = FileToolsOptions.CleanUrl(input);\r\n url = FileToolsOptions.PreprocessUrl(url);\r\n }\r\n\r\n const onErrorHandler = (exception: any) => {\r\n if (onError) {\r\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\r\n const inputText = url || input.toString();\r\n onError(`Error while trying to load image: ${inputText.indexOf(\"http\") === 0 || inputText.length <= 128 ? inputText : inputText.slice(0, 128) + \"...\"}`, exception);\r\n }\r\n };\r\n\r\n if (engine?._features.forceBitmapOverHTMLImageElement) {\r\n LoadFile(\r\n url,\r\n (data) => {\r\n engine\r\n .createImageBitmap(new Blob([data], { type: mimeType }), { premultiplyAlpha: \"none\", ...imageBitmapOptions })\r\n // eslint-disable-next-line github/no-then\r\n .then((imgBmp) => {\r\n onLoad(imgBmp);\r\n if (usingObjectURL) {\r\n URL.revokeObjectURL(url);\r\n }\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((reason) => {\r\n if (onError) {\r\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\r\n onError(\"Error while trying to load image: \" + input, reason);\r\n }\r\n });\r\n },\r\n undefined,\r\n offlineProvider || undefined,\r\n true,\r\n (request, exception) => {\r\n onErrorHandler(exception);\r\n }\r\n );\r\n\r\n return null;\r\n }\r\n\r\n const img = new Image();\r\n if (LoadImageConfiguration.getRequiredSize) {\r\n const size = LoadImageConfiguration.getRequiredSize(input);\r\n if (size.width) {\r\n img.width = size.width;\r\n }\r\n if (size.height) {\r\n img.height = size.height;\r\n }\r\n }\r\n SetCorsBehavior(url, img);\r\n\r\n const handlersList: { target: any; name: string; handler: any }[] = [];\r\n\r\n const loadHandlersList = () => {\r\n for (const handler of handlersList) {\r\n handler.target.addEventListener(handler.name, handler.handler);\r\n }\r\n };\r\n\r\n const unloadHandlersList = () => {\r\n for (const handler of handlersList) {\r\n handler.target.removeEventListener(handler.name, handler.handler);\r\n }\r\n handlersList.length = 0;\r\n };\r\n\r\n const loadHandler = () => {\r\n unloadHandlersList();\r\n\r\n onLoad(img);\r\n\r\n // Must revoke the URL after calling onLoad to avoid security exceptions in\r\n // certain scenarios (e.g. when hosted in vscode).\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n\r\n const errorHandler = (err: any) => {\r\n unloadHandlersList();\r\n\r\n onErrorHandler(err);\r\n\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n\r\n const cspHandler = (err: any) => {\r\n if (err.blockedURI !== img.src || err.disposition === \"report\") {\r\n return;\r\n }\r\n\r\n unloadHandlersList();\r\n const cspException = new Error(`CSP violation of policy ${err.effectiveDirective} ${err.blockedURI}. Current policy is ${err.originalPolicy}`);\r\n\r\n EngineStore.UseFallbackTexture = false;\r\n onErrorHandler(cspException);\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n img.src = \"\";\r\n };\r\n\r\n handlersList.push({ target: img, name: \"load\", handler: loadHandler });\r\n handlersList.push({ target: img, name: \"error\", handler: errorHandler });\r\n handlersList.push({ target: document, name: \"securitypolicyviolation\", handler: cspHandler });\r\n\r\n loadHandlersList();\r\n\r\n const fromBlob = url.substring(0, 5) === \"blob:\";\r\n const fromData = url.substring(0, 5) === \"data:\";\r\n const noOfflineSupport = () => {\r\n if (fromBlob || fromData || !WebRequest.IsCustomRequestAvailable) {\r\n img.src = url;\r\n } else {\r\n LoadFile(\r\n url,\r\n (data, _, contentType) => {\r\n const type = !mimeType && contentType ? contentType : mimeType;\r\n const blob = new Blob([data], { type });\r\n const url = URL.createObjectURL(blob);\r\n usingObjectURL = true;\r\n img.src = url;\r\n },\r\n undefined,\r\n offlineProvider || undefined,\r\n true,\r\n (_request, exception) => {\r\n onErrorHandler(exception);\r\n }\r\n );\r\n }\r\n };\r\n\r\n const loadFromOfflineSupport = () => {\r\n if (offlineProvider) {\r\n offlineProvider.loadImage(url, img);\r\n }\r\n };\r\n\r\n if (!fromBlob && !fromData && offlineProvider && offlineProvider.enableTexturesOffline) {\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n } else {\r\n if (url.indexOf(\"file:\") !== -1) {\r\n const textureName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (FilesInputStore.FilesToLoad[textureName] && typeof URL !== \"undefined\") {\r\n try {\r\n let blobURL;\r\n try {\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n } catch (ex) {\r\n // Chrome doesn't support oneTimeOnly parameter\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n }\r\n img.src = blobURL;\r\n usingObjectURL = true;\r\n } catch (e) {\r\n img.src = \"\";\r\n }\r\n return img;\r\n }\r\n }\r\n\r\n noOfflineSupport();\r\n }\r\n\r\n return img;\r\n};\r\n\r\n/**\r\n * Reads a file from a File object\r\n * @param file defines the file to load\r\n * @param onSuccess defines the callback to call when data is loaded\r\n * @param onProgress defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @param onError defines the callback to call when an error occurs\r\n * @returns a file request object\r\n * @internal\r\n */\r\nexport const ReadFile = (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: (ev: ProgressEvent) => any,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: ReadFileError) => void\r\n): IFileRequest => {\r\n if (!(file instanceof File) && typeof file === \"object\") {\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => {},\r\n };\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n onSuccess(file);\r\n return fileRequest;\r\n } else {\r\n const reader = new FileReader();\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => reader.abort(),\r\n };\r\n\r\n reader.onloadend = () => fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n if (onError) {\r\n reader.onerror = () => {\r\n onError(new ReadFileError(`Unable to read ${file.name}`, file));\r\n };\r\n }\r\n reader.onload = (e) => {\r\n //target doesn't have result from ts 1.3\r\n onSuccess((<any>e.target)[\"result\"]);\r\n };\r\n if (onProgress) {\r\n reader.onprogress = onProgress;\r\n }\r\n if (!useArrayBuffer) {\r\n // Asynchronous read\r\n reader.readAsText(file);\r\n } else {\r\n reader.readAsArrayBuffer(file);\r\n }\r\n return fileRequest;\r\n }\r\n};\r\n\r\n/**\r\n * Loads a file from a url, a data url, or a file url\r\n * @param fileOrUrl file, url, data url, or file url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened\r\n * @returns a file request object\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const LoadFile = (\r\n fileOrUrl: File | string | object,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string, contentType?: Nullable<string>) => void,\r\n onProgress?: (ev: ProgressEvent) => void,\r\n offlineProvider?: Nullable<IOfflineProvider>,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n): IFileRequest => {\r\n if ((fileOrUrl as File).name) {\r\n return ReadFile(\r\n fileOrUrl as File,\r\n onSuccess,\r\n onProgress,\r\n useArrayBuffer,\r\n onError\r\n ? (error: ReadFileError) => {\r\n onError(undefined, error);\r\n }\r\n : undefined\r\n );\r\n }\r\n\r\n const url = fileOrUrl as string;\r\n\r\n // If file and file input are set\r\n if (url.indexOf(\"file:\") !== -1) {\r\n let fileName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (fileName.indexOf(\"./\") === 0) {\r\n fileName = fileName.substring(2);\r\n }\r\n const file = FilesInputStore.FilesToLoad[fileName];\r\n if (file) {\r\n return ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError ? (error) => onError(undefined, new LoadFileError(error.message, error.file)) : undefined);\r\n }\r\n }\r\n\r\n // For a Base64 Data URL\r\n const { match, type } = TestBase64DataUrl(url);\r\n if (match) {\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => () => {},\r\n };\r\n\r\n try {\r\n const data = useArrayBuffer ? DecodeBase64UrlToBinary(url) : DecodeBase64UrlToString(url);\r\n onSuccess(data, undefined, type);\r\n } catch (error) {\r\n if (onError) {\r\n onError(undefined, error);\r\n } else {\r\n Logger.Error(error.message || \"Failed to parse the Data URL\");\r\n }\r\n }\r\n\r\n TimingTools.SetImmediate(() => {\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n });\r\n\r\n return fileRequest;\r\n }\r\n\r\n return RequestFile(\r\n url,\r\n (data, request) => {\r\n onSuccess(data, request?.responseURL, request?.getResponseHeader(\"content-type\"));\r\n },\r\n onProgress,\r\n offlineProvider,\r\n useArrayBuffer,\r\n onError\r\n ? (error) => {\r\n onError(error.request, new LoadFileError(error.message, error.request));\r\n }\r\n : undefined,\r\n onOpened\r\n );\r\n};\r\n\r\n/**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened callback called when the web request is opened\r\n * @returns a file request object\r\n * @internal\r\n */\r\nexport const RequestFile = (\r\n url: string,\r\n onSuccess?: (data: string | ArrayBuffer, request?: WebRequest) => void,\r\n onProgress?: (event: ProgressEvent) => void,\r\n offlineProvider?: Nullable<IOfflineProvider>,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: RequestFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n): IFileRequest => {\r\n if (offlineProvider !== null) {\r\n offlineProvider ??= EngineStore.LastCreatedScene?.offlineProvider;\r\n }\r\n url = FileToolsOptions.CleanUrl(url);\r\n url = FileToolsOptions.PreprocessUrl(url);\r\n\r\n const loadUrl = FileToolsOptions.BaseUrl + url;\r\n\r\n let aborted = false;\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => (aborted = true),\r\n };\r\n\r\n const requestFile = () => {\r\n let request: Nullable<WebRequest> = new WebRequest();\r\n let retryHandle: Nullable<ReturnType<typeof setTimeout>> = null;\r\n let onReadyStateChange: Nullable<() => void>;\r\n\r\n const unbindEvents = () => {\r\n if (!request) {\r\n return;\r\n }\r\n\r\n if (onProgress) {\r\n request.removeEventListener(\"progress\", onProgress);\r\n }\r\n if (onReadyStateChange) {\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n }\r\n request.removeEventListener(\"loadend\", onLoadEnd!);\r\n };\r\n\r\n let onLoadEnd: Nullable<() => void> = () => {\r\n unbindEvents();\r\n\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n fileRequest.onCompleteObservable.clear();\r\n\r\n onProgress = undefined;\r\n onReadyStateChange = null;\r\n onLoadEnd = null;\r\n onError = undefined;\r\n onOpened = undefined;\r\n onSuccess = undefined;\r\n };\r\n\r\n fileRequest.abort = () => {\r\n aborted = true;\r\n\r\n if (onLoadEnd) {\r\n onLoadEnd();\r\n }\r\n\r\n if (request && request.readyState !== (XMLHttpRequest.DONE || 4)) {\r\n request.abort();\r\n }\r\n\r\n if (retryHandle !== null) {\r\n clearTimeout(retryHandle);\r\n retryHandle = null;\r\n }\r\n\r\n request = null;\r\n };\r\n\r\n const handleError = (error: any) => {\r\n const message = error.message || \"Unknown error\";\r\n if (onError && request) {\r\n onError(new RequestFileError(message, request));\r\n } else {\r\n Logger.Error(message);\r\n }\r\n };\r\n\r\n const retryLoop = (retryIndex: number) => {\r\n if (!request) {\r\n return;\r\n }\r\n request.open(\"GET\", loadUrl);\r\n\r\n if (onOpened) {\r\n try {\r\n onOpened(request);\r\n } catch (e) {\r\n handleError(e);\r\n return;\r\n }\r\n }\r\n\r\n if (useArrayBuffer) {\r\n request.responseType = \"arraybuffer\";\r\n }\r\n\r\n if (onProgress) {\r\n request.addEventListener(\"progress\", onProgress);\r\n }\r\n\r\n if (onLoadEnd) {\r\n request.addEventListener(\"loadend\", onLoadEnd);\r\n }\r\n\r\n onReadyStateChange = () => {\r\n if (aborted || !request) {\r\n return;\r\n }\r\n\r\n // In case of undefined state in some browsers.\r\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\r\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\r\n if (onReadyStateChange) {\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n }\r\n\r\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!IsWindowObjectExist() || IsFileURL()))) {\r\n // It's possible for the request to have a success status code but null response if the underlying\r\n // underlying HTTP connection was closed prematurely. See _onHttpResponseClose in xhr2.js. In this\r\n // case we will throw an exception if we call the onSuccess handler because \"data\" will be null\r\n // and that then bypasses the retry strategy.\r\n const data = useArrayBuffer ? request.response : request.responseText;\r\n if (data !== null) {\r\n try {\r\n if (onSuccess) {\r\n onSuccess(data, request);\r\n }\r\n } catch (e) {\r\n handleError(e);\r\n }\r\n return;\r\n }\r\n }\r\n\r\n const retryStrategy = FileToolsOptions.DefaultRetryStrategy;\r\n if (retryStrategy) {\r\n const waitTime = retryStrategy(loadUrl, request, retryIndex);\r\n if (waitTime !== -1) {\r\n // Prevent the request from completing for retry.\r\n unbindEvents();\r\n\r\n request = new WebRequest();\r\n retryHandle = setTimeout(() => retryLoop(retryIndex + 1), waitTime);\r\n return;\r\n }\r\n }\r\n\r\n const error = new RequestFileError(\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\r\n if (onError) {\r\n onError(error);\r\n }\r\n }\r\n };\r\n\r\n request.addEventListener(\"readystatechange\", onReadyStateChange);\r\n\r\n request.send();\r\n };\r\n\r\n retryLoop(0);\r\n };\r\n\r\n // Caching all files\r\n if (offlineProvider && offlineProvider.enableSceneOffline && !url.startsWith(\"blob:\")) {\r\n const noOfflineSupport = (request?: any) => {\r\n if (request && request.status > 400) {\r\n if (onError) {\r\n onError(request);\r\n }\r\n } else {\r\n requestFile();\r\n }\r\n };\r\n\r\n const loadFromOfflineSupport = () => {\r\n // TODO: database needs to support aborting and should return a IFileRequest\r\n\r\n if (offlineProvider) {\r\n offlineProvider.loadFile(\r\n FileToolsOptions.BaseUrl + url,\r\n (data) => {\r\n if (!aborted && onSuccess) {\r\n onSuccess(data);\r\n }\r\n\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n },\r\n onProgress\r\n ? (event) => {\r\n if (!aborted && onProgress) {\r\n onProgress(event);\r\n }\r\n }\r\n : undefined,\r\n noOfflineSupport,\r\n useArrayBuffer\r\n );\r\n }\r\n };\r\n\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n } else {\r\n requestFile();\r\n }\r\n\r\n return fileRequest;\r\n};\r\n\r\n/**\r\n * Reads the mime type from a URL, if available.\r\n * @param url\r\n * @returns\r\n */\r\nexport const GetMimeType = (url: string): string | undefined => {\r\n const { match, type } = TestBase64DataUrl(url);\r\n if (match) {\r\n return type || undefined;\r\n }\r\n\r\n const lastDot = url.lastIndexOf(\".\");\r\n const extension = url.substring(lastDot + 1).toLowerCase();\r\n\r\n switch (extension) {\r\n case \"glb\":\r\n return \"model/gltf-binary\";\r\n case \"bin\":\r\n return \"application/octet-stream\";\r\n case \"gltf\":\r\n return \"model/gltf+json\";\r\n case \"jpg\":\r\n case \"jpeg\":\r\n return \"image/jpeg\";\r\n case \"png\":\r\n return \"image/png\";\r\n case \"webp\":\r\n return \"image/webp\";\r\n case \"ktx\":\r\n return \"image/ktx\";\r\n case \"ktx2\":\r\n return \"image/ktx2\";\r\n case \"avif\":\r\n return \"image/avif\";\r\n default:\r\n return undefined;\r\n }\r\n};\r\n\r\n/**\r\n * Checks if the loaded document was accessed via `file:`-Protocol.\r\n * @returns boolean\r\n * @internal\r\n */\r\nexport const IsFileURL = (): boolean => {\r\n return typeof location !== \"undefined\" && location.protocol === \"file:\";\r\n};\r\n\r\n/**\r\n * Test if the given uri is a valid base64 data url\r\n * @param uri The uri to test\r\n * @returns True if the uri is a base64 data url or false otherwise\r\n * @internal\r\n */\r\nexport const IsBase64DataUrl = (uri: string): boolean => {\r\n return Base64DataUrlRegEx.test(uri);\r\n};\r\n\r\nexport const TestBase64DataUrl = (uri: string): { match: boolean; type: string } => {\r\n const results = Base64DataUrlRegEx.exec(uri);\r\n if (results === null || results.length === 0) {\r\n return { match: false, type: \"\" };\r\n } else {\r\n const type = results[0].replace(\"data:\", \"\").replace(\";base64,\", \"\");\r\n return { match: true, type };\r\n }\r\n};\r\n\r\n/**\r\n * Decode the given base64 uri.\r\n * @param uri The uri to decode\r\n * @returns The decoded base64 data.\r\n * @internal\r\n */\r\nexport function DecodeBase64UrlToBinary(uri: string): ArrayBuffer {\r\n return DecodeBase64ToBinary(uri.split(\",\")[1]);\r\n}\r\n\r\n/**\r\n * Decode the given base64 uri into a UTF-8 encoded string.\r\n * @param uri The uri to decode\r\n * @returns The decoded base64 data.\r\n * @internal\r\n */\r\nexport const DecodeBase64UrlToString = (uri: string): string => {\r\n return DecodeBase64ToString(uri.split(\",\")[1]);\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @internal\r\n */\r\nconst initSideEffects = () => {\r\n AbstractEngine._FileToolsLoadImage = LoadImage;\r\n EngineFunctionContext.loadFile = LoadFile;\r\n _FunctionContainer.loadFile = LoadFile;\r\n};\r\n\r\ninitSideEffects();\r\n\r\n// deprecated\r\n\r\n/**\r\n * FileTools defined as any.\r\n * This should not be imported or used in future releases or in any module in the framework\r\n * @internal\r\n * @deprecated import the needed function from fileTools.ts\r\n */\r\nexport let FileTools: {\r\n DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer;\r\n DecodeBase64UrlToString: (uri: string) => string;\r\n DefaultRetryStrategy: any;\r\n BaseUrl: any;\r\n CorsBehavior: any;\r\n PreprocessUrl: any;\r\n IsBase64DataUrl: (uri: string) => boolean;\r\n IsFileURL: () => boolean;\r\n LoadFile: (\r\n fileOrUrl: string | File,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void,\r\n onProgress?: (ev: ProgressEvent<EventTarget>) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n ) => IFileRequest;\r\n LoadImage: (\r\n input: string | ArrayBuffer | Blob | ArrayBufferView,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType?: string,\r\n imageBitmapOptions?: ImageBitmapOptions\r\n ) => Nullable<HTMLImageElement>;\r\n ReadFile: (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: (ev: ProgressEvent<EventTarget>) => any,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: ReadFileError) => void\r\n ) => IFileRequest;\r\n RequestFile: (\r\n url: string,\r\n onSuccess: (data: string | ArrayBuffer, request?: WebRequest) => void,\r\n onProgress?: (event: ProgressEvent<EventTarget>) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: RequestFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n ) => IFileRequest;\r\n SetCorsBehavior: (url: string | string[], element: { crossOrigin: string | null }) => void;\r\n};\r\n/**\r\n * @internal\r\n */\r\nexport const _injectLTSFileTools = (\r\n DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer,\r\n DecodeBase64UrlToString: (uri: string) => string,\r\n FileToolsOptions: { DefaultRetryStrategy: any; BaseUrl: any; CorsBehavior: any; PreprocessUrl: any; CleanUrl: any },\r\n IsBase64DataUrl: (uri: string) => boolean,\r\n IsFileURL: () => boolean,\r\n LoadFile: (\r\n fileOrUrl: string | File,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void,\r\n onProgress?: (ev: ProgressEvent<EventTarget>) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n ) => IFileRequest,\r\n LoadImage: (\r\n input: string | ArrayBuffer | ArrayBufferView | Blob,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType?: string,\r\n imageBitmapOptions?: ImageBitmapOptions\r\n ) => Nullable<HTMLImageElement>,\r\n ReadFile: (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: (ev: ProgressEvent<EventTarget>) => any,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: ReadFileError) => void\r\n ) => IFileRequest,\r\n RequestFile: (\r\n url: string,\r\n onSuccess: (data: string | ArrayBuffer, request?: WebRequest) => void,\r\n onProgress?: (event: ProgressEvent<EventTarget>) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: RequestFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n ) => IFileRequest,\r\n SetCorsBehavior: (url: string | string[], element: { crossOrigin: string | null }) => void\r\n) => {\r\n /**\r\n * Backwards compatibility.\r\n * @internal\r\n * @deprecated\r\n */\r\n FileTools = {\r\n DecodeBase64UrlToBinary,\r\n DecodeBase64UrlToString,\r\n DefaultRetryStrategy: FileToolsOptions.DefaultRetryStrategy,\r\n BaseUrl: FileToolsOptions.BaseUrl,\r\n CorsBehavior: FileToolsOptions.CorsBehavior,\r\n PreprocessUrl: FileToolsOptions.PreprocessUrl,\r\n IsBase64DataUrl,\r\n IsFileURL,\r\n LoadFile,\r\n LoadImage,\r\n ReadFile,\r\n RequestFile,\r\n SetCorsBehavior,\r\n };\r\n\r\n Object.defineProperty(FileTools, \"DefaultRetryStrategy\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.DefaultRetryStrategy;\r\n },\r\n set: function (this: null, value: (url: string, request: WebRequest, retryIndex: number) => number) {\r\n FileToolsOptions.DefaultRetryStrategy = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"BaseUrl\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.BaseUrl;\r\n },\r\n set: function (this: null, value: string) {\r\n FileToolsOptions.BaseUrl = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"PreprocessUrl\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.PreprocessUrl;\r\n },\r\n set: function (this: null, value: (url: string) => string) {\r\n FileToolsOptions.PreprocessUrl = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"CorsBehavior\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.CorsBehavior;\r\n },\r\n set: function (this: null, value: string | ((url: string | string[]) => string)) {\r\n FileToolsOptions.CorsBehavior = value;\r\n },\r\n });\r\n};\r\n\r\n_injectLTSFileTools(DecodeBase64UrlToBinary, DecodeBase64UrlToString, FileToolsOptions, IsBase64DataUrl, IsFileURL, LoadFile, LoadImage, ReadFile, RequestFile, SetCorsBehavior);\r\n"]}
1
+ {"version":3,"file":"fileTools.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/fileTools.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,+CAA8C;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC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,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,EAAE;QAC7C,GAAG,EAAE;YACD,OAAO,gBAAgB,CAAC,YAAY,CAAC;QACzC,CAAC;QACD,GAAG,EAAE,UAAsB,KAAoD;YAC3E,gBAAgB,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1C,CAAC;KACJ,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,mBAAmB,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { WebRequest } from \"./webRequest\";\r\nimport { IsWindowObjectExist } from \"./domManagement\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { IOfflineProvider } from \"../Offline/IOfflineProvider\";\r\nimport type { IFileRequest } from \"./fileRequest\";\r\nimport { Observable } from \"./observable\";\r\nimport { FilesInputStore } from \"./filesInputStore\";\r\nimport { RetryStrategy } from \"./retryStrategy\";\r\nimport { BaseError, ErrorCodes, RuntimeError } from \"./error\";\r\nimport { DecodeBase64ToBinary, DecodeBase64ToString, EncodeArrayBufferToBase64 } from \"./stringTools\";\r\nimport { _FunctionContainer } from \"../Engines/Processors/shaderProcessor\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"./logger\";\r\nimport { TimingTools } from \"./timingTools\";\r\nimport { EngineFunctionContext } from \"core/Engines/abstractEngine.functions\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\nconst Base64DataUrlRegEx = new RegExp(/^data:([^,]+\\/[^,]+)?;base64,/i);\r\n\r\n/** @ignore */\r\nexport class LoadFileError extends RuntimeError {\r\n public request?: WebRequest;\r\n public file?: File;\r\n\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param object defines the optional web request\r\n */\r\n constructor(message: string, object?: WebRequest | File) {\r\n super(message, ErrorCodes.LoadFileError);\r\n\r\n this.name = \"LoadFileError\";\r\n BaseError._setPrototypeOf(this, LoadFileError.prototype);\r\n\r\n if (object instanceof WebRequest) {\r\n this.request = object;\r\n } else {\r\n this.file = object;\r\n }\r\n }\r\n}\r\n\r\n/** @ignore */\r\nexport class RequestFileError extends RuntimeError {\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n */\r\n constructor(\r\n message: string,\r\n public request: WebRequest\r\n ) {\r\n super(message, ErrorCodes.RequestFileError);\r\n this.name = \"RequestFileError\";\r\n BaseError._setPrototypeOf(this, RequestFileError.prototype);\r\n }\r\n}\r\n\r\n/** @ignore */\r\nexport class ReadFileError extends RuntimeError {\r\n /**\r\n * Creates a new ReadFileError\r\n * @param message defines the message of the error\r\n * @param file defines the optional file\r\n */\r\n constructor(\r\n message: string,\r\n public file: File\r\n ) {\r\n super(message, ErrorCodes.ReadFileError);\r\n this.name = \"ReadFileError\";\r\n BaseError._setPrototypeOf(this, ReadFileError.prototype);\r\n }\r\n}\r\n\r\n/**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\nconst CleanUrl = (url: string): string => {\r\n url = url.replace(/#/gm, \"%23\");\r\n return url;\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\nexport const FileToolsOptions: {\r\n DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;\r\n BaseUrl: string;\r\n CorsBehavior: string | ((url: string | string[]) => string);\r\n PreprocessUrl: (url: string) => string;\r\n ScriptBaseUrl: string;\r\n ScriptPreprocessUrl: (url: string) => string;\r\n CleanUrl: (url: string) => string;\r\n} = {\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset.\r\n * When defining this function, return the wait time before trying again or return -1 to\r\n * stop retrying and error out.\r\n */\r\n DefaultRetryStrategy: RetryStrategy.ExponentialBackoff(),\r\n\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n BaseUrl: \"\",\r\n\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n CorsBehavior: \"anonymous\",\r\n\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n * @param url\r\n * @returns the processed url\r\n */\r\n PreprocessUrl: (url: string) => url,\r\n\r\n /**\r\n * Gets or sets the base URL to use to load scripts\r\n * Used for both JS and WASM\r\n */\r\n ScriptBaseUrl: \"\",\r\n /**\r\n * Gets or sets a function used to pre-process script url before using them to load.\r\n * Used for both JS and WASM\r\n * @param url defines the url to process\r\n * @returns the processed url\r\n */\r\n ScriptPreprocessUrl: (url: string) => url,\r\n\r\n /**\r\n * Gets or sets a function used to clean the url before using it to load assets\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n CleanUrl,\r\n};\r\n\r\n/**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n * @internal\r\n */\r\nexport const SetCorsBehavior = (url: string | string[], element: { crossOrigin: string | null }): void => {\r\n if (url && url.indexOf(\"data:\") === 0) {\r\n return;\r\n }\r\n\r\n if (FileToolsOptions.CorsBehavior) {\r\n if (typeof FileToolsOptions.CorsBehavior === \"string\" || FileToolsOptions.CorsBehavior instanceof String) {\r\n element.crossOrigin = <string>FileToolsOptions.CorsBehavior;\r\n } else {\r\n const result = FileToolsOptions.CorsBehavior(url);\r\n if (result) {\r\n element.crossOrigin = result;\r\n }\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Configuration used to load images\r\n * @see https://playground.babylonjs.com/#DKMEZK#2\r\n */\r\nexport const LoadImageConfiguration: {\r\n /**\r\n * Use this callback if you want to provide the required size of an image before loading it.\r\n */\r\n getRequiredSize: Nullable<\r\n (input: string | ArrayBuffer | ArrayBufferView | Blob) => {\r\n width: number;\r\n height: number;\r\n }\r\n >;\r\n} = {\r\n getRequiredSize: null,\r\n};\r\n\r\n/**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @param imageBitmapOptions\r\n * @param engine the engine instance to use\r\n * @returns the HTMLImageElement of the loaded image\r\n * @internal\r\n */\r\nexport const LoadImage = (\r\n input: string | ArrayBuffer | ArrayBufferView | Blob,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType: string = \"\",\r\n imageBitmapOptions?: ImageBitmapOptions,\r\n engine = EngineStore.LastCreatedEngine\r\n): Nullable<HTMLImageElement> => {\r\n if (typeof HTMLImageElement === \"undefined\" && !engine?._features.forceBitmapOverHTMLImageElement) {\r\n onError(\"LoadImage is only supported in web or BabylonNative environments.\");\r\n return null;\r\n }\r\n\r\n let url: string;\r\n let usingObjectURL = false;\r\n\r\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\r\n if (typeof Blob !== \"undefined\" && typeof URL !== \"undefined\") {\r\n url = URL.createObjectURL(new Blob([input], { type: mimeType }));\r\n usingObjectURL = true;\r\n } else {\r\n url = `data:${mimeType};base64,` + EncodeArrayBufferToBase64(input);\r\n }\r\n } else if (input instanceof Blob) {\r\n url = URL.createObjectURL(input);\r\n usingObjectURL = true;\r\n } else {\r\n url = FileToolsOptions.CleanUrl(input);\r\n url = FileToolsOptions.PreprocessUrl(url);\r\n }\r\n\r\n const onErrorHandler = (exception: any) => {\r\n if (onError) {\r\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\r\n const inputText = url || input.toString();\r\n onError(`Error while trying to load image: ${inputText.indexOf(\"http\") === 0 || inputText.length <= 128 ? inputText : inputText.slice(0, 128) + \"...\"}`, exception);\r\n }\r\n };\r\n\r\n if (engine?._features.forceBitmapOverHTMLImageElement) {\r\n LoadFile(\r\n url,\r\n (data) => {\r\n engine\r\n .createImageBitmap(new Blob([data], { type: mimeType }), { premultiplyAlpha: \"none\", ...imageBitmapOptions })\r\n // eslint-disable-next-line github/no-then\r\n .then((imgBmp) => {\r\n onLoad(imgBmp);\r\n if (usingObjectURL) {\r\n URL.revokeObjectURL(url);\r\n }\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((reason) => {\r\n if (onError) {\r\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\r\n onError(\"Error while trying to load image: \" + input, reason);\r\n }\r\n });\r\n },\r\n undefined,\r\n offlineProvider || undefined,\r\n true,\r\n (request, exception) => {\r\n onErrorHandler(exception);\r\n }\r\n );\r\n\r\n return null;\r\n }\r\n\r\n const img = new Image();\r\n if (LoadImageConfiguration.getRequiredSize) {\r\n const size = LoadImageConfiguration.getRequiredSize(input);\r\n if (size.width) {\r\n img.width = size.width;\r\n }\r\n if (size.height) {\r\n img.height = size.height;\r\n }\r\n }\r\n SetCorsBehavior(url, img);\r\n\r\n const handlersList: { target: any; name: string; handler: any }[] = [];\r\n\r\n const loadHandlersList = () => {\r\n for (const handler of handlersList) {\r\n handler.target.addEventListener(handler.name, handler.handler);\r\n }\r\n };\r\n\r\n const unloadHandlersList = () => {\r\n for (const handler of handlersList) {\r\n handler.target.removeEventListener(handler.name, handler.handler);\r\n }\r\n handlersList.length = 0;\r\n };\r\n\r\n const loadHandler = () => {\r\n unloadHandlersList();\r\n\r\n onLoad(img);\r\n\r\n // Must revoke the URL after calling onLoad to avoid security exceptions in\r\n // certain scenarios (e.g. when hosted in vscode).\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n\r\n const errorHandler = (err: any) => {\r\n unloadHandlersList();\r\n\r\n onErrorHandler(err);\r\n\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n\r\n const cspHandler = (err: any) => {\r\n if (err.blockedURI !== img.src || err.disposition === \"report\") {\r\n return;\r\n }\r\n\r\n unloadHandlersList();\r\n const cspException = new Error(`CSP violation of policy ${err.effectiveDirective} ${err.blockedURI}. Current policy is ${err.originalPolicy}`);\r\n\r\n EngineStore.UseFallbackTexture = false;\r\n onErrorHandler(cspException);\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n img.src = \"\";\r\n };\r\n\r\n handlersList.push({ target: img, name: \"load\", handler: loadHandler });\r\n handlersList.push({ target: img, name: \"error\", handler: errorHandler });\r\n handlersList.push({ target: document, name: \"securitypolicyviolation\", handler: cspHandler });\r\n\r\n loadHandlersList();\r\n\r\n const fromBlob = url.substring(0, 5) === \"blob:\";\r\n const fromData = url.substring(0, 5) === \"data:\";\r\n const noOfflineSupport = () => {\r\n if (fromBlob || fromData || !WebRequest.IsCustomRequestAvailable) {\r\n img.src = url;\r\n } else {\r\n LoadFile(\r\n url,\r\n (data, _, contentType) => {\r\n const type = !mimeType && contentType ? contentType : mimeType;\r\n const blob = new Blob([data], { type });\r\n const url = URL.createObjectURL(blob);\r\n usingObjectURL = true;\r\n img.src = url;\r\n },\r\n undefined,\r\n offlineProvider || undefined,\r\n true,\r\n (_request, exception) => {\r\n onErrorHandler(exception);\r\n }\r\n );\r\n }\r\n };\r\n\r\n const loadFromOfflineSupport = () => {\r\n if (offlineProvider) {\r\n offlineProvider.loadImage(url, img);\r\n }\r\n };\r\n\r\n if (!fromBlob && !fromData && offlineProvider && offlineProvider.enableTexturesOffline) {\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n } else {\r\n if (url.indexOf(\"file:\") !== -1) {\r\n const textureName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (FilesInputStore.FilesToLoad[textureName] && typeof URL !== \"undefined\") {\r\n try {\r\n let blobURL;\r\n try {\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n } catch (ex) {\r\n // Chrome doesn't support oneTimeOnly parameter\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n }\r\n img.src = blobURL;\r\n usingObjectURL = true;\r\n } catch (e) {\r\n img.src = \"\";\r\n }\r\n return img;\r\n }\r\n }\r\n\r\n noOfflineSupport();\r\n }\r\n\r\n return img;\r\n};\r\n\r\n/**\r\n * Reads a file from a File object\r\n * @param file defines the file to load\r\n * @param onSuccess defines the callback to call when data is loaded\r\n * @param onProgress defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @param onError defines the callback to call when an error occurs\r\n * @returns a file request object\r\n * @internal\r\n */\r\nexport const ReadFile = (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: (ev: ProgressEvent) => any,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: ReadFileError) => void\r\n): IFileRequest => {\r\n if (!(file instanceof File) && typeof file === \"object\") {\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => {},\r\n };\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n onSuccess(file);\r\n return fileRequest;\r\n } else {\r\n const reader = new FileReader();\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => reader.abort(),\r\n };\r\n\r\n reader.onloadend = () => fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n if (onError) {\r\n reader.onerror = () => {\r\n onError(new ReadFileError(`Unable to read ${file.name}`, file));\r\n };\r\n }\r\n reader.onload = (e) => {\r\n //target doesn't have result from ts 1.3\r\n onSuccess((<any>e.target)[\"result\"]);\r\n };\r\n if (onProgress) {\r\n reader.onprogress = onProgress;\r\n }\r\n if (!useArrayBuffer) {\r\n // Asynchronous read\r\n reader.readAsText(file);\r\n } else {\r\n reader.readAsArrayBuffer(file);\r\n }\r\n return fileRequest;\r\n }\r\n};\r\n\r\n/**\r\n * Loads a file from a url, a data url, or a file url\r\n * @param fileOrUrl file, url, data url, or file url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened\r\n * @returns a file request object\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const LoadFile = (\r\n fileOrUrl: File | string | object,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string, contentType?: Nullable<string>) => void,\r\n onProgress?: (ev: ProgressEvent) => void,\r\n offlineProvider?: Nullable<IOfflineProvider>,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n): IFileRequest => {\r\n if ((fileOrUrl as File).name || typeof fileOrUrl === \"object\") {\r\n return ReadFile(\r\n fileOrUrl as File,\r\n onSuccess,\r\n onProgress,\r\n useArrayBuffer,\r\n onError\r\n ? (error: ReadFileError) => {\r\n onError(undefined, error);\r\n }\r\n : undefined\r\n );\r\n }\r\n\r\n const url = fileOrUrl as string;\r\n\r\n // If file and file input are set\r\n if (url.indexOf(\"file:\") !== -1) {\r\n let fileName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (fileName.indexOf(\"./\") === 0) {\r\n fileName = fileName.substring(2);\r\n }\r\n const file = FilesInputStore.FilesToLoad[fileName];\r\n if (file) {\r\n return ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError ? (error) => onError(undefined, new LoadFileError(error.message, error.file)) : undefined);\r\n }\r\n }\r\n\r\n // For a Base64 Data URL\r\n const { match, type } = TestBase64DataUrl(url);\r\n if (match) {\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => () => {},\r\n };\r\n\r\n try {\r\n const data = useArrayBuffer ? DecodeBase64UrlToBinary(url) : DecodeBase64UrlToString(url);\r\n onSuccess(data, undefined, type);\r\n } catch (error) {\r\n if (onError) {\r\n onError(undefined, error);\r\n } else {\r\n Logger.Error(error.message || \"Failed to parse the Data URL\");\r\n }\r\n }\r\n\r\n TimingTools.SetImmediate(() => {\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n });\r\n\r\n return fileRequest;\r\n }\r\n\r\n return RequestFile(\r\n url,\r\n (data, request) => {\r\n onSuccess(data, request?.responseURL, request?.getResponseHeader(\"content-type\"));\r\n },\r\n onProgress,\r\n offlineProvider,\r\n useArrayBuffer,\r\n onError\r\n ? (error) => {\r\n onError(error.request, new LoadFileError(error.message, error.request));\r\n }\r\n : undefined,\r\n onOpened\r\n );\r\n};\r\n\r\n/**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened callback called when the web request is opened\r\n * @returns a file request object\r\n * @internal\r\n */\r\nexport const RequestFile = (\r\n url: string,\r\n onSuccess?: (data: string | ArrayBuffer, request?: WebRequest) => void,\r\n onProgress?: (event: ProgressEvent) => void,\r\n offlineProvider?: Nullable<IOfflineProvider>,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: RequestFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n): IFileRequest => {\r\n if (offlineProvider !== null) {\r\n offlineProvider ??= EngineStore.LastCreatedScene?.offlineProvider;\r\n }\r\n url = FileToolsOptions.CleanUrl(url);\r\n url = FileToolsOptions.PreprocessUrl(url);\r\n\r\n const loadUrl = FileToolsOptions.BaseUrl + url;\r\n\r\n let aborted = false;\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => (aborted = true),\r\n };\r\n\r\n const requestFile = () => {\r\n let request: Nullable<WebRequest> = new WebRequest();\r\n let retryHandle: Nullable<ReturnType<typeof setTimeout>> = null;\r\n let onReadyStateChange: Nullable<() => void>;\r\n\r\n const unbindEvents = () => {\r\n if (!request) {\r\n return;\r\n }\r\n\r\n if (onProgress) {\r\n request.removeEventListener(\"progress\", onProgress);\r\n }\r\n if (onReadyStateChange) {\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n }\r\n request.removeEventListener(\"loadend\", onLoadEnd!);\r\n };\r\n\r\n let onLoadEnd: Nullable<() => void> = () => {\r\n unbindEvents();\r\n\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n fileRequest.onCompleteObservable.clear();\r\n\r\n onProgress = undefined;\r\n onReadyStateChange = null;\r\n onLoadEnd = null;\r\n onError = undefined;\r\n onOpened = undefined;\r\n onSuccess = undefined;\r\n };\r\n\r\n fileRequest.abort = () => {\r\n aborted = true;\r\n\r\n if (onLoadEnd) {\r\n onLoadEnd();\r\n }\r\n\r\n if (request && request.readyState !== (XMLHttpRequest.DONE || 4)) {\r\n request.abort();\r\n }\r\n\r\n if (retryHandle !== null) {\r\n clearTimeout(retryHandle);\r\n retryHandle = null;\r\n }\r\n\r\n request = null;\r\n };\r\n\r\n const handleError = (error: any) => {\r\n const message = error.message || \"Unknown error\";\r\n if (onError && request) {\r\n onError(new RequestFileError(message, request));\r\n } else {\r\n Logger.Error(message);\r\n }\r\n };\r\n\r\n const retryLoop = (retryIndex: number) => {\r\n if (!request) {\r\n return;\r\n }\r\n request.open(\"GET\", loadUrl);\r\n\r\n if (onOpened) {\r\n try {\r\n onOpened(request);\r\n } catch (e) {\r\n handleError(e);\r\n return;\r\n }\r\n }\r\n\r\n if (useArrayBuffer) {\r\n request.responseType = \"arraybuffer\";\r\n }\r\n\r\n if (onProgress) {\r\n request.addEventListener(\"progress\", onProgress);\r\n }\r\n\r\n if (onLoadEnd) {\r\n request.addEventListener(\"loadend\", onLoadEnd);\r\n }\r\n\r\n onReadyStateChange = () => {\r\n if (aborted || !request) {\r\n return;\r\n }\r\n\r\n // In case of undefined state in some browsers.\r\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\r\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\r\n if (onReadyStateChange) {\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n }\r\n\r\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!IsWindowObjectExist() || IsFileURL()))) {\r\n // It's possible for the request to have a success status code but null response if the underlying\r\n // underlying HTTP connection was closed prematurely. See _onHttpResponseClose in xhr2.js. In this\r\n // case we will throw an exception if we call the onSuccess handler because \"data\" will be null\r\n // and that then bypasses the retry strategy.\r\n const data = useArrayBuffer ? request.response : request.responseText;\r\n if (data !== null) {\r\n try {\r\n if (onSuccess) {\r\n onSuccess(data, request);\r\n }\r\n } catch (e) {\r\n handleError(e);\r\n }\r\n return;\r\n }\r\n }\r\n\r\n const retryStrategy = FileToolsOptions.DefaultRetryStrategy;\r\n if (retryStrategy) {\r\n const waitTime = retryStrategy(loadUrl, request, retryIndex);\r\n if (waitTime !== -1) {\r\n // Prevent the request from completing for retry.\r\n unbindEvents();\r\n\r\n request = new WebRequest();\r\n retryHandle = setTimeout(() => retryLoop(retryIndex + 1), waitTime);\r\n return;\r\n }\r\n }\r\n\r\n const error = new RequestFileError(\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\r\n if (onError) {\r\n onError(error);\r\n }\r\n }\r\n };\r\n\r\n request.addEventListener(\"readystatechange\", onReadyStateChange);\r\n\r\n request.send();\r\n };\r\n\r\n retryLoop(0);\r\n };\r\n\r\n // Caching all files\r\n if (offlineProvider && offlineProvider.enableSceneOffline && !url.startsWith(\"blob:\")) {\r\n const noOfflineSupport = (request?: any) => {\r\n if (request && request.status > 400) {\r\n if (onError) {\r\n onError(request);\r\n }\r\n } else {\r\n requestFile();\r\n }\r\n };\r\n\r\n const loadFromOfflineSupport = () => {\r\n // TODO: database needs to support aborting and should return a IFileRequest\r\n\r\n if (offlineProvider) {\r\n offlineProvider.loadFile(\r\n FileToolsOptions.BaseUrl + url,\r\n (data) => {\r\n if (!aborted && onSuccess) {\r\n onSuccess(data);\r\n }\r\n\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n },\r\n onProgress\r\n ? (event) => {\r\n if (!aborted && onProgress) {\r\n onProgress(event);\r\n }\r\n }\r\n : undefined,\r\n noOfflineSupport,\r\n useArrayBuffer\r\n );\r\n }\r\n };\r\n\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n } else {\r\n requestFile();\r\n }\r\n\r\n return fileRequest;\r\n};\r\n\r\n/**\r\n * Reads the mime type from a URL, if available.\r\n * @param url\r\n * @returns\r\n */\r\nexport const GetMimeType = (url: string): string | undefined => {\r\n const { match, type } = TestBase64DataUrl(url);\r\n if (match) {\r\n return type || undefined;\r\n }\r\n\r\n const lastDot = url.lastIndexOf(\".\");\r\n const extension = url.substring(lastDot + 1).toLowerCase();\r\n\r\n switch (extension) {\r\n case \"glb\":\r\n return \"model/gltf-binary\";\r\n case \"bin\":\r\n return \"application/octet-stream\";\r\n case \"gltf\":\r\n return \"model/gltf+json\";\r\n case \"jpg\":\r\n case \"jpeg\":\r\n return \"image/jpeg\";\r\n case \"png\":\r\n return \"image/png\";\r\n case \"webp\":\r\n return \"image/webp\";\r\n case \"ktx\":\r\n return \"image/ktx\";\r\n case \"ktx2\":\r\n return \"image/ktx2\";\r\n case \"avif\":\r\n return \"image/avif\";\r\n default:\r\n return undefined;\r\n }\r\n};\r\n\r\n/**\r\n * Checks if the loaded document was accessed via `file:`-Protocol.\r\n * @returns boolean\r\n * @internal\r\n */\r\nexport const IsFileURL = (): boolean => {\r\n return typeof location !== \"undefined\" && location.protocol === \"file:\";\r\n};\r\n\r\n/**\r\n * Test if the given uri is a valid base64 data url\r\n * @param uri The uri to test\r\n * @returns True if the uri is a base64 data url or false otherwise\r\n * @internal\r\n */\r\nexport const IsBase64DataUrl = (uri: string): boolean => {\r\n return Base64DataUrlRegEx.test(uri);\r\n};\r\n\r\nexport const TestBase64DataUrl = (uri: string): { match: boolean; type: string } => {\r\n const results = Base64DataUrlRegEx.exec(uri);\r\n if (results === null || results.length === 0) {\r\n return { match: false, type: \"\" };\r\n } else {\r\n const type = results[0].replace(\"data:\", \"\").replace(\";base64,\", \"\");\r\n return { match: true, type };\r\n }\r\n};\r\n\r\n/**\r\n * Decode the given base64 uri.\r\n * @param uri The uri to decode\r\n * @returns The decoded base64 data.\r\n * @internal\r\n */\r\nexport function DecodeBase64UrlToBinary(uri: string): ArrayBuffer {\r\n return DecodeBase64ToBinary(uri.split(\",\")[1]);\r\n}\r\n\r\n/**\r\n * Decode the given base64 uri into a UTF-8 encoded string.\r\n * @param uri The uri to decode\r\n * @returns The decoded base64 data.\r\n * @internal\r\n */\r\nexport const DecodeBase64UrlToString = (uri: string): string => {\r\n return DecodeBase64ToString(uri.split(\",\")[1]);\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @internal\r\n */\r\nconst initSideEffects = () => {\r\n AbstractEngine._FileToolsLoadImage = LoadImage;\r\n EngineFunctionContext.loadFile = LoadFile;\r\n _FunctionContainer.loadFile = LoadFile;\r\n};\r\n\r\ninitSideEffects();\r\n\r\n// deprecated\r\n\r\n/**\r\n * FileTools defined as any.\r\n * This should not be imported or used in future releases or in any module in the framework\r\n * @internal\r\n * @deprecated import the needed function from fileTools.ts\r\n */\r\nexport let FileTools: {\r\n DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer;\r\n DecodeBase64UrlToString: (uri: string) => string;\r\n DefaultRetryStrategy: any;\r\n BaseUrl: any;\r\n CorsBehavior: any;\r\n PreprocessUrl: any;\r\n IsBase64DataUrl: (uri: string) => boolean;\r\n IsFileURL: () => boolean;\r\n LoadFile: (\r\n fileOrUrl: string | File,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void,\r\n onProgress?: (ev: ProgressEvent<EventTarget>) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n ) => IFileRequest;\r\n LoadImage: (\r\n input: string | ArrayBuffer | Blob | ArrayBufferView,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType?: string,\r\n imageBitmapOptions?: ImageBitmapOptions\r\n ) => Nullable<HTMLImageElement>;\r\n ReadFile: (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: (ev: ProgressEvent<EventTarget>) => any,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: ReadFileError) => void\r\n ) => IFileRequest;\r\n RequestFile: (\r\n url: string,\r\n onSuccess: (data: string | ArrayBuffer, request?: WebRequest) => void,\r\n onProgress?: (event: ProgressEvent<EventTarget>) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: RequestFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n ) => IFileRequest;\r\n SetCorsBehavior: (url: string | string[], element: { crossOrigin: string | null }) => void;\r\n};\r\n/**\r\n * @internal\r\n */\r\nexport const _injectLTSFileTools = (\r\n DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer,\r\n DecodeBase64UrlToString: (uri: string) => string,\r\n FileToolsOptions: { DefaultRetryStrategy: any; BaseUrl: any; CorsBehavior: any; PreprocessUrl: any; CleanUrl: any },\r\n IsBase64DataUrl: (uri: string) => boolean,\r\n IsFileURL: () => boolean,\r\n LoadFile: (\r\n fileOrUrl: string | File,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void,\r\n onProgress?: (ev: ProgressEvent<EventTarget>) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n ) => IFileRequest,\r\n LoadImage: (\r\n input: string | ArrayBuffer | ArrayBufferView | Blob,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType?: string,\r\n imageBitmapOptions?: ImageBitmapOptions\r\n ) => Nullable<HTMLImageElement>,\r\n ReadFile: (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: (ev: ProgressEvent<EventTarget>) => any,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: ReadFileError) => void\r\n ) => IFileRequest,\r\n RequestFile: (\r\n url: string,\r\n onSuccess: (data: string | ArrayBuffer, request?: WebRequest) => void,\r\n onProgress?: (event: ProgressEvent<EventTarget>) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: RequestFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n ) => IFileRequest,\r\n SetCorsBehavior: (url: string | string[], element: { crossOrigin: string | null }) => void\r\n) => {\r\n /**\r\n * Backwards compatibility.\r\n * @internal\r\n * @deprecated\r\n */\r\n FileTools = {\r\n DecodeBase64UrlToBinary,\r\n DecodeBase64UrlToString,\r\n DefaultRetryStrategy: FileToolsOptions.DefaultRetryStrategy,\r\n BaseUrl: FileToolsOptions.BaseUrl,\r\n CorsBehavior: FileToolsOptions.CorsBehavior,\r\n PreprocessUrl: FileToolsOptions.PreprocessUrl,\r\n IsBase64DataUrl,\r\n IsFileURL,\r\n LoadFile,\r\n LoadImage,\r\n ReadFile,\r\n RequestFile,\r\n SetCorsBehavior,\r\n };\r\n\r\n Object.defineProperty(FileTools, \"DefaultRetryStrategy\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.DefaultRetryStrategy;\r\n },\r\n set: function (this: null, value: (url: string, request: WebRequest, retryIndex: number) => number) {\r\n FileToolsOptions.DefaultRetryStrategy = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"BaseUrl\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.BaseUrl;\r\n },\r\n set: function (this: null, value: string) {\r\n FileToolsOptions.BaseUrl = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"PreprocessUrl\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.PreprocessUrl;\r\n },\r\n set: function (this: null, value: (url: string) => string) {\r\n FileToolsOptions.PreprocessUrl = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"CorsBehavior\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.CorsBehavior;\r\n },\r\n set: function (this: null, value: string | ((url: string | string[]) => string)) {\r\n FileToolsOptions.CorsBehavior = value;\r\n },\r\n });\r\n};\r\n\r\n_injectLTSFileTools(DecodeBase64UrlToBinary, DecodeBase64UrlToString, FileToolsOptions, IsBase64DataUrl, IsFileURL, LoadFile, LoadImage, ReadFile, RequestFile, SetCorsBehavior);\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onerjs/core",
3
- "version": "8.35.3",
3
+ "version": "8.35.5",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",