Class TemplateUtility

The TemplateUtility class provides various template specific utilities and helpers to interact with Template and SceneObject instances.

Hierarchy (view full)

Constructors

  • Parameters

    • OptionalisInternalConstructor: boolean

    Returns rsx.TemplateUtility

Methods

  • Updates the contents of the template with the contents of the provided template instance. If the provided object is not a template instance nothing happens. All template instances in all open scenes will have their diffs recorded, and will be updated after the apply operation is done.

    Parameters

    • sceneObject: SceneObject

      Template instance whose template to update.

    • objectTemplate: Template

      The template to apply.

    Returns UncertainAsyncOp<TemplateOperationResult, string>

    Object signaling status and return value of the operation.

  • Populates Template UUIDs of the provided scene object. The template UUIDs are taken from the provided template object UUIDs. Both of the hierarchies must match identically. Also ensures all objects in the instance hierarchy have the provided template resource UUID link, essentially breaking any nested template links.

    Parameters

    Returns void

  • Breaks the link between a template instance and its template. Object will retain all current values but will no longer be influenced by modifications to its parent template.

    Parameters

    • sceneObject: SceneObject

      Template instance whose link to break.

    Returns void

  • Creates a new template from the provided scene object hierarchy, and makes the scene object an instance of the template if succesful.

    Parameters

    • sceneObject: SceneObject

      Scene object hierarchy from which to create the template.

    • virtualPath: FilePath

      Virtual path at which to store the template in.

    Returns UncertainAsyncOp<TemplateOperationResult, string>

    Object signaling status and return value of the operation.

  • Gathers all affectted SceneNodes by a template save operation.

    Parameters

    • root: SceneObject

      The root to start gathering new objects fron.

    Returns SceneNode[]

    A vector of all new scene nodes on the template instance.

  • Gets a string that represents a template delta. This is only a debug representation and should not be used to parse or extract more informatio about the template.

    Parameters

    Returns string

  • Returns the root object of the template instance that this object belongs to, if any.

    Parameters

    • sceneObject: SceneObject

      Scene object to retrieve the template parent for.

    Returns SceneObject

    Template parent of the provided object, or null if the object is not part of a template instance.

  • Returns the UUID of the template attached to the provided scene object.

    Parameters

    • sceneObject: SceneObject

      Scene object to retrieve the template UUID for.

    Returns UUID

    Template UUID if the object is part of a template, empty uuid otherwise.

  • Checks if a scene object has a template link. Scene objects with a template link will be automatically updated when their template changes in order to reflect its changes.

    Parameters

    • sceneObject: SceneObject

      Scene object to check if it has a template link.

    Returns boolean

    True if the object is a template instance (has a template link), false otherwise.

  • Performs delta record for all template instances in all currently loaded scenes.

    Returns void

  • Updates the internal template delta data by recording the difference between the current values in provided template instance.

    Parameters

    • sceneObject: SceneObject

      Scene object that is part of the template instance for which to record the deltas for.

    • OptionalisRecursive: boolean

      If true, will recursively record deltas for all children templates, alongside a delta the scene object.

    Returns void

  • Updates the internal template delta data by recording the difference between the current values in template instances that are children of the provided object hierarchy.

    Parameters

    • sceneObject: SceneObject

      Scene object at the root of the hierarchy to record template deltas for. Deltas will not be recorded for the root itself, in case it is also a template instance.

    Returns void

    If the provided object contains any child template instances, this will be done recursively for them as well.

  • Resaves all template resources that have the given templateResource as a nested template.

    Parameters

    Returns void

  • Remove any instance specific changes to the object or its hierarchy from the provided template instance and restore it to the exact copy of the linked template.

    Parameters

    Returns void

  • Updates all template instances of the given template in currently loaded scenes.

    Parameters

    • templateResource: Template | ResourceHandle<Template>

      The template resource to update the instances for. Null if all instances should be updated.

    • OptionalisUpdatingNonInstantiatedOnly: boolean

      If true, only template instances that have not been instantiated properly yet are updated.

    Returns void

  • Updates a template instance to the most recent version of the object from the template resource.

    Parameters

    Returns void

  • Updates multiple template instances to the most recent version of the object from the template resources. Use this over updateInstanceFromTemplate if it is possible that one object has moved from one template instance to another. Calling this method with both instances instead of separate calls to updateInstanceFromTemplate ensures that UUIDs are resolved properly.

    Parameters

    Returns void

  • Updates all template instances in the scene to their most recent version, as stored in the Template resource. Any instance specific changes are preserved.

    Parameters

    • scene: SceneInstance

      Scene instance to update.

    • templateResource: Template | ResourceHandle<Template>

      The template resource to update the instances for. Null if all instances should be updated.

    • OptionalisUpdatingNonInstantiatedOnly: boolean

      If true, only template instances that have not been instantiated properly yet are updated.

    Returns void

  • Updates all instances of the nestedTemplate in the templateResource.

    Parameters

    Returns void

Events

onRevertedToTemplate: Event<[p0: SceneObject], void>

Invoked when a scene object was reverted to the template.

onTemplateSaved: Event<[p0: ResourceHandle<Template>], void>

Invoked when a template resource is saved.