import { Node } from "@babylonjs/core/node"; import { AssetContainer } from "@babylonjs/core/assetContainer"; import { ScriptMap } from "../loader"; import { AdvancedAssetContainerInstantiatedEntries } from "./entries"; export interface IAdvancedAssetContainerInstantiateOptions { /** * Defines if the model must be instantiated or just cloned */ doNotInstantiate?: boolean | ((node: Node) => boolean); /** * Defines a predicate used to filter whih mesh to instantiate/clone */ predicate?: (entity: any) => boolean; } export declare class AdvancedAssetContainer { /** * Defines the reference to the */ container: AssetContainer; private _rootUrl; private _scriptsMap; private _originalDescendants; private _nodesMap; private _animationGroupsMap; constructor(container: AssetContainer, rootUrl: string, scriptsMap: ScriptMap); /** * By default, loaded advanced asset containers add their nodes in the scene. * As it is not always wanted, this method allows to remove those nodes from the scene and only keep them in the container. * This is particularely useful when you want to instantiate the container several times in the scene, but not use the original nodes of the container itself. */ removeDefault(): void; /** * Retrieve the reference to a node present in the root nodes of the container by its name. * This is useful only if the container is not intended to be instantiated so you never call `.removeDefault()`. * @param name defines the name of the root node to retrieve. */ getRootNodeByName(name: string): Node | null; /** * Retrieve the reference to a script instance of the given type attached to a node with the given name. * @param name defines the name of the object to retrieve the script from. * @param classType defines the class of the type to retrieve. * @returns the reference to the script instance attached to the node which matches the given class type. */ getScriptByClassByObjectName any>(name: string, classType: T): InstanceType | null; /** * Instantiate or clone all meshes, skeletons and animations groups, and add the new ones to the scene. * If the container contains scripts attached to its nodes, those scripts will also be applied on the instantiated/cloned nodes. * @param options defines an optional list of options to control how to instantiate / clone models * @param options.doNotInstantiate defines if the model must be instantiated or just cloned * @param options.predicate defines a predicate used to filter whih mesh to instantiate/clone * @returns a new reference to instantiated entries with the instantiated nodes, skeletons and animation groups. * @see `BABYLON.AssetContainer.instantiateModelsToScene` for options. */ instantiate(options?: IAdvancedAssetContainerInstantiateOptions): AdvancedAssetContainerInstantiatedEntries; }