Module: data

Data API. Used to load/unload exported json data files.
Source:

Summary

Methods

Type Definitions

Detailed Description

Methods

activate_media()

Activate media data context. Activation of audio/video contexts is required for mobile platforms which disable media playback without explicit user interaction. This method should be executed inside some input event listener.
Source:

is_idle() → {Boolean}

Check if the engine has finished all of the scheduled loading actions.
Returns:
Check result
Type
Boolean
Source:

is_primary_loaded() → {Boolean}

Check if the engine primary data (main scene) is loaded (detect the last loading stage).
Returns:
Check result
Type
Boolean
Source:

load(path, loaded_cbopt, stageload_cbopt, wait_complete_loadingopt, load_hiddenopt) → {Number}

Load data from the json file exported from Blender.
Parameters:
Name Type Attributes Default Description
path String Path to JSON file
loaded_cb LoadedCallback <optional>
null Callback to be executed right after load
stageload_cb StageloadCallback <optional>
null Callback to report about the loading progress
wait_complete_loading Boolean <optional>
false Wait until all resources are loaded
load_hidden Boolean <optional>
false Hide loaded and disable physics objects
Returns:
ID of loaded data.
Type
Number
Source:

set_debug_resources_root(debug_resources_root)

Set the root which contains the resources, for debug purposes. Enables the checking of loading paths, so if the resources are not loaded from the app root, there will be a warning in m_print.
Parameters:
Name Type Description
debug_resources_root String App root directory.
Source:

unload(data_idopt)

Unload the previously loaded data.
Parameters:
Name Type Attributes Default Description
data_id Number <optional>
0 ID of unloaded data. Unload all data if data_id is zero.
Source:

Type Definitions

LoadedCallback(data_id, success)

Data loaded callback. Executed when the data loading process has been completed.
Parameters:
Name Type Description
data_id Number Data ID
success Boolean Load success
Source:

StageloadCallback(percentage, load_time)

Loading stage callback. Used to implement loading progress indicators (preloaders).
Parameters:
Name Type Description
percentage Number Loading progress (0-100).
load_time Number Loading time in ms.
Source: