Asset3DLibraryBundle enforces a multiton pattern and is not intended to be instanced directly. Its purpose is to create a container for 3D data management, both before and after parsing. If you are interested in creating multiple library bundles, please use the getInstance() method.

Static methods

@:value({ key : "default" })staticgetInstance(key:String = "default"):Asset3DLibraryBundle

Returns an Asset3DLibraryBundle instance. If no key is given, returns the default bundle instance (which is similar to using the Asset3DLibraryBundle as a singleton.) To keep several separated library bundles, pass a string key to this method to define which bundle should be returned. This is referred to as using the Asset3DLibrary as a multiton.

Parameters:

key

Defines which multiton instance should be returned.

Returns:

An instance of the asset library

Variables

conflictPrecedence:String

Defines which asset should have precedence when resolving a naming conflict between two assets of which one has just been renamed by the user or by a parser. By default ConflictPrecedence.FAVOR_NEW is used, meaning that the newly renamed asset will keep it's new name while the older asset gets renamed to not conflict.

This property is ignored for conflict strategies that do not actually rename an asset automatically, such as ConflictStrategy.IGNORE and ConflictStrategy.THROW_ERROR.

See also:

  • a3d.library.naming.ConflictPrecedence

  • a3d.library.naming.ConflictStrategy

conflictStrategy:ConflictStrategyBase

Defines which strategy should be used for resolving naming conflicts, when two library assets are given the same name. By default, ConflictStrategy.APPEND_NUM_SUFFIX is used which means that a numeric suffix is appended to one of the assets. The conflictPrecedence property defines which of the two conflicting assets will be renamed.

See also:

  • a3d.library.naming.ConflictStrategy

  • a3d.library.Asset3DLibrary.conflictPrecedence

Methods

addAsset(asset:IAsset):Void

Adds an asset to the asset library, first making sure that it's name is unique using the method defined by the conflictStrategy and conflictPrecedence properties.

@:value({ filterFunc : null, namespaceFilter : null, Asset3DTypeFilter : null })createIterator(?Asset3DTypeFilter:String, ?namespaceFilter:String, ?filterFunc:Dynamic):Asset3DLibraryIterator

Create an Asset3DLibraryIterator instance that can be used to iterate over the assets in this asset library instance. The iterator can filter assets on asset type and/or namespace. A "null" filter value means no filter of that type is used.

Parameters:

Asset3DTypeFilter

Asset type to filter on (from the Asset3DType enum class.) Use null to not filter on asset type.

namespaceFilter

Namespace to filter on. Use null to not filter on namespace.

filterFunc

Callback function to use when deciding whether an asset should be included in the iteration or not. This needs to be a function that takes a single parameter of type IAsset and returns a Bool where true means it should be included.

See also:

  • away3d.library.assets.Asset3DType

enableParser(parserClass:Class<ParserBase>):Void

enableParsers(parserClasses:Array<Dynamic>):Void

@:value({ ns : null })getAsset(name:String, ?ns:String):IAsset

@:value({ parser : null, ns : null, context : null })load(req:URLRequest, ?context:AssetLoaderContext, ?ns:String, ?parser:ParserBase):AssetLoaderToken

Loads a file and (optionally) all of its dependencies.

Parameters:

req

The URLRequest object containing the URL of the file to be loaded.

context

An optional context object providing additional parameters for loading

ns

An optional namespace string under which the file is to be loaded, allowing the differentiation of two resources with identical assets

parser

An optional parser object for translating the loaded data into a usable resource. If not provided, AssetLoader will attempt to auto-detect the file type.

@:value({ parser : null, ns : null, context : null })loadData(data:Dynamic, ?context:AssetLoaderContext, ?ns:String, ?parser:ParserBase):AssetLoaderToken

Loads a resource from existing data in memory.

Parameters:

data

The data object containing all resource information.

context

An optional context object providing additional parameters for loading

ns

An optional namespace string under which the file is to be loaded, allowing the differentiation of two resources with identical assets

parser

An optional parser object for translating the loaded data into a usable resource. If not provided, AssetLoader will attempt to auto-detect the file type.

@:value({ dispose : true })removeAllAssets(dispose:Bool = true):Void

Removes all assets from the asset library, optionally disposing them as they are removed.

Parameters:

dispose

Defines whether the assets should also be disposed.

@:value({ dispose : true })removeAsset(asset:IAsset, dispose:Bool = true):Void

Removes an asset from the library, and optionally disposes that asset by calling it's disposeAsset() method (which for most assets is implemented as a default version of that type's dispose() method.

Parameters:

asset

The asset which should be removed from this library.

dispose

Defines whether the assets should also be disposed.

@:value({ dispose : true, ns : null })removeAssetByName(name:String, ?ns:String, dispose:Bool = true):IAsset

Removes an asset which is specified using name and namespace.

Parameters:

name

The name of the asset to be removed.

ns

The namespace to which the desired asset belongs.

dispose

Defines whether the assets should also be disposed.

See also:

  • away3d.library.Asset3DLibrary.removeAsset()

@:value({ dispose : true, ns : null })removeNamespaceAssets(?ns:String, dispose:Bool = true):Void

Removes all assets belonging to a particular namespace (null for default) from the asset library, and optionall disposes them by calling their disposeAsset() method.

Parameters:

ns

The namespace from which all assets should be removed.

dispose

Defines whether the assets should also be disposed.

See also:

  • away3d.library.Asset3DLibrary.removeAsset()