BBMOD_ResourceManager.load

A function defined in BBMOD_ResourceManager.gml

load(_path[, _sha1][, _onLoad])

Description

Asynchronnously loads a resource from a file or retrieves a reference to it, if it is already loaded.

Arguments

Name Type Description
_path String The path to the resource.
_sha1 String Expected SHA1 of the file. If the actual one does not match with this, then the resource will not be loaded. Use undefined if you do not want to check the SHA1 of the file.
_onLoad Function A function to execute when the resource is loaded or if an error occurs while loading it. It must take the error as the first argument and the resource as the second argument. If no error occurs, then undefined is passed. If the resource was already loaded when calling this function, then this callback is not executed.

Returns

Struct.BBMOD_Resource The resource or undefined.

Note

Currently supported files formats are *.bbmod for BBMOD_Model, *.bbanim for BBMOD_Animation, *.bbmat for BBMOD_Material and *.png, *.gif, *.jpg/jpeg for BBMOD_Sprite. Since version 3.17.0, this can also automatically load model's materials from BBMAT files when BBMOD_ResourceManager.LoadMaterials is set to true. If you're loading for example a model called Tree.bbmod, which has materials "Trunk" and "Leaves", it first tries to load them from files Tree_Trunk.bbmat and Tree_Leaves.bbmat. If these files don't exist, then it tries to load them without the Tree_ prefix, i.e. Trunk.bbmat and Leaves.bbmat. If even these are not present, then the material slots are left with the default values. If the BBMAT files do exist, then the _onLoad callback is called after all of them are loaded!

See also

BBMOD_ResourceManager.LoadMaterials

Do you find this page helpful?

Copyright © 2024, BlueBurn. Built on January 21, 2024 using GMDoc.