Class AssetContainer
Hierarchy (View Summary)
- AbstractAssetContainer
- AssetContainer
Constructors
constructor
-
Instantiates an AssetContainer.
Returns AssetContainer
Properties
action Managers
ActionManagers available on the scene.
animation Groups
All of the animation groups added to this scene
animations
Gets a list of Animations associated with the scene
cameras
All of the cameras added to this scene
effect Layers
The list of effect layers added to the scene
geometries
The list of geometries used in the scene.
layers
The list of layers added to the scene
lens Flare Systems
The list of lens flare systems added to the scene
lights
All of the lights added to this scene
materials
All of the materials added to this scene In the context of a Scene, it is not supposed to be modified manually. Any addition or removal should be done using the addMaterial and removeMaterial Scene methods. Note also that the order of the Material within the array is not significant and might change.
meshes
All of the (abstract) meshes added to this scene
morph Target Managers
The list of morph target managers added to the scene
multi Materials
All of the multi-materials added to this scene
particle Systems
All of the particle systems added to this scene
post Processes
The list of postprocesses added to the scene
procedural Textures
The list of procedural textures added to the scene
reflection Probes
The list of reflection probes added to the scene
root Nodes
Gets the list of root nodes (ie. nodes with no parent)
scene
The scene the AssetContainer belongs to.
skeletons
The list of skeletons added to the scene
sounds
The list of sounds
sprite Managers
The list of sprite managers added to the scene
textures
Textures to keep.
transform Nodes
All of the transform nodes added to this scene In the context of a Scene, it is not supposed to be modified manually. Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods. Note also that the order of the TransformNode within the array is not significant and might change.
Accessors
environment Texture
-
Texture used in all pbr material as the reflection texture. As in the majority of the scene they are the same (exception for multi room and so on), this is easier to reference from here than from all the materials.
Returns Nullable<BaseTexture>
-
Texture used in all pbr material as the reflection texture. As in the majority of the scene they are the same (exception for multi room and so on), this is easier to reference from here than from all the materials.
Parameters
- value: Nullable<BaseTexture>
Returns void
Methods
add All Assets To Container
-
Since6.26.0 Given a root asset, this method will traverse its hierarchy and add it, its children and any materials/skeletons to the container.
Parameters
- root: Node
root node
Returns void
- root: Node
add All To Scene
-
Adds all the assets from the container to the scene.
Returns void
add To Scene
-
Adds assets from the container to the scene.
Parameters
- predicate: Nullable<(entity: any) => boolean> = null
defines a predicate used to select which entity will be added (can be null)
Returns void
- predicate: Nullable<(entity: any) => boolean> = null
create Root Mesh
-
Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.
Returns Mesh
the root mesh
dispose
-
Disposes all the assets in the container
Returns void
get Cameras By Tags
get Lights By Tags
get Materials By Tags
get Meshes By Tags
-
Get a list of meshes by tags
Parameters
- tagsQuery: string
defines the tags query to use
Optionalfilter: (mesh: AbstractMesh) => booleandefines a predicate used to filter results
Returns AbstractMesh[]
an array of Mesh
- tagsQuery: string
get Nodes
-
Returns Node[]
all meshes, lights, cameras, transformNodes and bones
get Transform Nodes By Tags
-
getTransformNodesByTags(
tagsQuery: string,
filter?: (transform: TransformNode) => boolean,
): TransformNode[]Get a list of transform nodes by tags
Parameters
- tagsQuery: string
defines the tags query to use
Optionalfilter: (transform: TransformNode) => booleandefines a predicate used to filter results
Returns TransformNode[]
an array of TransformNode
- tagsQuery: string
instantiate Models To Scene
-
instantiateModelsToScene(
nameFunction?: (sourceName: string) => string,
cloneMaterials?: boolean,
options?: {
doNotInstantiate?: boolean | ((node: Node) => boolean);
predicate?: (entity: any) => boolean;
},
): InstantiatedEntriesInstantiate or clone all meshes and add the new ones to the scene. Skeletons and animation groups will all be cloned
Parameters
OptionalnameFunction: (sourceName: string) => stringdefines an optional function used to get new names for clones
- cloneMaterials: boolean = false
defines an optional boolean that defines if materials must be cloned as well (false by default)
Optionaloptions: {
doNotInstantiate?: boolean | ((node: Node) => boolean);
predicate?: (entity: any) => boolean;
}defines an optional list of options to control how to instantiate / clone models
-
OptionaldoNotInstantiate?: boolean | ((node: Node) => boolean)defines if the model must be instantiated or just cloned
-
Optionalpredicate?: (entity: any) => booleandefines a predicate used to filter whih mesh to instantiate/clone
-
Returns InstantiatedEntries
a list of rootNodes, skeletons and animation groups that were duplicated
merge Animations To
-
mergeAnimationsTo(
scene?: Nullable<Scene>,
animatables: Animatable[],
targetConverter?: Nullable<(target: any) => Nullable<Node>>,
): AnimationGroup[]Merge animations (direct and animation groups) from this asset container into a scene
Parameters
- scene: Nullable<Scene> = EngineStore.LastCreatedScene
is the instance of BABYLON.Scene to append to (default: last created scene)
- animatables: Animatable[]
set of animatables to retarget to a node from the scene
- targetConverter: Nullable<(target: any) => Nullable<Node>> = null
defines a function used to convert animation targets from the asset container to the scene (default: search node by name)
Returns AnimationGroup[]
an array of the new AnimationGroup added to the scene (empty array if none)
- scene: Nullable<Scene> = EngineStore.LastCreatedScene
move All From Scene
-
Removes all the assets contained in the scene and adds them to the container.
Parameters
OptionalkeepAssets: KeepAssetsSet of assets to keep in the scene. (default: empty)
Returns void
populate Root Nodes
-
Since6.15.0 This method checks for any node that has no parent and is not in the rootNodes array, and adds the node there, if so.
Returns void
remove All From Scene
-
Removes all the assets in the container from the scene
Returns void
remove From Scene
-
Removes assets in the container from the scene
Parameters
- predicate: Nullable<(entity: any) => boolean> = null
defines a predicate used to select which entity will be added (can be null)
Returns void
- predicate: Nullable<(entity: any) => boolean> = null
Container with a set of assets that can be added or removed from a scene.