Create a new SceneRegistry instance.
The application.
Private
_appPrivate
_indexPrivate
_listPrivate
_urlPrivate
_loadPrivate
Private function to load scene data with the option to cache. This allows us to retain expected behavior of loadSceneSettings and loadSceneHierarchy where they don't store loaded data which may be undesired behavior with projects that have many scenes.
The scene item (which can be found with SceneRegistry#find, URL of the scene file (e.g."scene_id.json") or name of the scene.
Whether to store the loaded data in the scene item.
The function to call after loading, passed (err, sceneItem) where err is null if no errors occurred.
Change to a new scene. Calling this function will load the scene data, delete all
entities and graph nodes under app.root
and load the scene settings and hierarchy.
The scene item (which can be found with SceneRegistry#find, URL of the scene file (e.g."scene_id.json") or name of the scene.
Optional
callback: ChangeSceneCallbackThe function to call after loading, passed (err, entity) where err is null if no errors occurred.
app.scenes.changeScene("Scene Name", function (err, entity) {
if (!err) {
// success
} else {
// error
}
});
Find a Scene by name and return the SceneRegistryItem.
The name of the scene.
The stored data about a scene or null if no scene with that name exists.
Find a scene by the URL and return the SceneRegistryItem.
The URL to search by.
The stored data about a scene or null if no scene with that URL exists.
Return the list of scene.
All items in the registry.
Load the scene hierarchy and scene settings. This is an internal method used by the AppBase.
The URL of the scene file.
The function called after the settings are applied. Passed (err, scene) where err is null if no error occurred and scene is the Scene.
Loads and stores the scene data to reduce the number of the network requests when the same scenes are loaded multiple times. Can also be used to load data before calling SceneRegistry#loadSceneHierarchy and SceneRegistry#loadSceneSettings to make scene loading quicker for the user.
The scene item (which can be found with SceneRegistry#find, URL of the scene file (e.g."scene_id.json") or name of the scene.
The function to call after loading, passed (err, sceneItem) where err is null if no errors occurred.
const sceneItem = app.scenes.find("Scene Name");
app.scenes.loadSceneData(sceneItem, function (err, sceneItem) {
if (err) {
// error
}
});
Load a scene file, create and initialize the Entity hierarchy and add the hierarchy to the application root Entity.
The scene item (which can be found with SceneRegistry#find, URL of the scene file (e.g."scene_id.json") or name of the scene.
The function to call after loading, passed (err, entity) where err is null if no errors occurred.
const sceneItem = app.scenes.find("Scene Name");
app.scenes.loadSceneHierarchy(sceneItem, function (err, entity) {
if (!err) {
const e = app.root.find("My New Entity");
} else {
// error
}
});
Load a scene file and apply the scene settings to the current scene.
The scene item (which can be found with SceneRegistry#find, URL of the scene file (e.g."scene_id.json") or name of the scene.
The function called after the settings are applied. Passed (err) where err is null if no error occurred.
const sceneItem = app.scenes.find("Scene Name");
app.scenes.loadSceneSettings(sceneItem, function (err) {
if (!err) {
// success
} else {
// error
}
});
Unloads scene data that has been loaded previously using SceneRegistry#loadSceneData.
The scene item (which can be found with SceneRegistry#find or URL of the scene file. Usually this will be "scene_id.json".
const sceneItem = app.scenes.find("Scene Name");
app.scenes.unloadSceneData(sceneItem);
Container for storing and loading of scenes. An instance of the registry is created on the AppBase object as AppBase#scenes.