Class Template

Template is a savable hierarchy of scene objects. In general it can serve as any grouping of scene objects (for example a level) or be used as a form of a template instantiated and reused throughout the scene.

Hierarchy (view full)

Constructors

  • Creates a new template from the provided scene object.

    Parameters

    • sceneObject: SceneObject

      Scene object to create the template from.

    • OptionalisInternalConstructor: boolean

    Returns Template

Accessors

  • get hash(): UUID
  • Returns a hash value that can be used for determining if a template changed by comparing it to a previously saved hash.

    Returns UUID

  • get isDestroyed(): boolean
  • Determines if the resource is destroyed.

    Returns boolean

    This can happen when the Resource was forcefully unloaded or reverted. For this reason, it is safer to hold on to a instead of directly referencing a resource pointer, as the current Resource can always be retrieved via .value.

  • get isScene(): boolean
  • Determines if the template represents a scene or just a generic group of objects. The only difference between the two is the way root object is handled: scenes are assumed to be saved with the scene root object (which is hidden), while object group root is a normal scene object (not hidden). This is relevant when when templates are loaded, so the systems knows to append the root object to non-scene templates.

    Returns boolean

  • get name(): string
  • Name of the resource. Use primarily for easier identification and not important to the engine itself.

    Returns string

  • get root(): SceneObject
  • Returns a reference to the internal template hierarchy. Returned hierarchy is not instantiated and cannot be interacted with in a manner you would with normal scene objects.

    Returns SceneObject

  • get uuid(): UUID
  • Returns a universally unique identifier of this resource.

    Returns UUID

Methods

  • Duplicates the resource and creates a unique UUID for the duplicated resource.

    Returns Resource

    The duplicated resource or null, if the duplication failed.

  • Instantiates a template by creating an instance of the template's scene object hierarchy. The returned hierarchy will be parented to world root of the null scene.

    Parameters

    • OptionalkeepTemplateInternals: boolean

      Ensures the instantiated hierarchy keeps the original UUIDs as within the template, and also ensures that any nested template links are directly preserved.

    Returns SceneObject

    Instantiated clone of the template's scene object hierarchy.

  • Instantiates a template by creating an instance of the template's scene object hierarchy, and parents it to the provided scene object.

    Parameters

    • parent: SceneObject

      Scene object to parent the instantiated hierarchy to.

    • OptionalkeepTemplateInternals: boolean

      Ensures the instantiated hierarchy keeps the original UUIDs as within the template, and also ensures that any nested template links are directly preserved.

    Returns SceneObject

    Instantiated clone of the template's scene object hierarchy.

  • Virtual

    Method called by RSX to perform actions required after the creation of the resource.

    Returns void

  • Virtual

    Method called by RSX to perform any operations needed after deserialization.

    Returns void

    Use this API to restore your serializable data into live objects.

  • Virtual

    Method called by RSX to disable the resource.

    Returns void

    Use this API to deactivate the resource before it is serialized.

  • Virtual

    Method called by RSX to enable the resource.

    Returns void

    Use this API to activate the resource after it has been disabled by serialization.

  • Virtual

    Method called by RSX to perform initialization of the resource.

    Returns void

    Use this API to initialize data and default construct all fields.

  • Virtual

    Method called by RSX to perform any operations before serialization.

    Returns void

    Use this API to bake your live data into serializable data.

  • Reverts the resource to the on-disk representation.

    Returns boolean

    This is a potentially expensive call, as it needs to deserialize and replace all existing in-memory resource handles.

  • Replaces the contents of this template with new contents from the provided object.

    Parameters

    Returns void