Novelty scripting reference > Types > Scene

Scene

Interface for manipulating a scene.
Scene is a single-reference type. It can be accessed directly, yielding the currently active scene:

Scene.GetObject(...);
Or indirectly via the Page interface:
Page@ p = Novel.GetCurrentPage();
p.GetScene().GetObject(...)


Members

const Vector2 size
Size of the scene (width, height).


Methods

void EnumerateLayers(array<SceneLayer@> &inout layerArray) const
Populates the array with handles to the layers in the scene.

void EnumerateObjects(array<Object@> &inout objectArray) const
Populates the array with handles to all objects in the scene.

void EnumerateObjectsByName(const string &in name,
    array<Object@> &inout objectArray) const

Populates the array with handles to all objects in the scene with a certain name.

Object@ GetObject(const string &in objectName) const
Object@ GetObject(UID uniqueID) const
Finds and returns an object in the scene by name or UID; or null.

SceneLayer@ GetLayer(uint layerIndex) const
SceneLayer@ GetLayer(const string &in layerName) const
Finds and returns a layer in the scene by index or name; or null.
Layer indices are ordered from top to bottom (top = 0, bottom = GetLayerCount() - 1).

SceneLayer@ GetLayerByUID(UID uid) const
Finds and returns a layer in the scene by UID; or null.

SceneLayer@ GetDefaultLayer() const
Returns the top layer or the first layer to not be locked.

uint GetLayerCount() const
Returns the number of layers in the scene.

uint GetLayerOrder(SceneLayer@ layer) const
Returns the order index of a layer in the scene; or INVALID_INDEX on failure.

Object@ CreateObjectByName(const string &in assetName)
Object@ CreateObjectByName(const string &in assetName, SceneLayer@ targetLayer)
Creates a new object in the scene from an existing asset.
Returns null on failure.

Object@ CreateObjectByType(const string &in type)
Object@ CreateObjectByType(const string &in type, SceneLayer@ targetLayer)
Creates a new object in the scene with a specific type. (See NoveltyML reference)
Returns null on failure.

Object@ CreateObjectFromNML(const string &in noveltyML)
Object@ CreateObjectFromNML(const string &in noveltyML, SceneLayer@ targetLayer)
Creates a new object in the scene from a string containing NoveltyML. (See NoveltyML reference)
Returns null on failure.

string AsString() const
Returns a string describing the scene.


Back to top