Class TemplateUtility

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

Hierarchy

  • FrameworkObject
    • TemplateUtility

Constructors

  • Parameters

    • OptionalisInternalConstructor: boolean

    Returns TemplateUtility

Methods

  • Updates the contents of the template with the contents of a provided scene object.

    Parameters

    • sceneObject: SceneObject

      SceneObject to save as a template

    • template: Template

      The template resource to save to.

    Returns void

  • 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.

  • 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.

    Parameters

    Returns void

  • 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.

  • Creates a new template from the provided scene object and stores it in the library.

    Parameters

    • sceneObject: SceneObject

      Objects to create the template from. Once template save is completed the object will be converted to the instance of the template.

    • virtualFilePath: LibraryIdentifierPath

      Path at which to store the template.

    Returns void

  • Creates a template from the selected scene objects, the object will be grouped in a new parent if needed, can be undone.

    Parameters

    • undoRedo: UndoRedo

      The undo/redo information structure.

    • sceneObjects: SceneObject[]

      The scene objects to create a template from.

    • destinationLibraryPath: LibraryIdentifierPath

      The directory in the library where to save the template.

    • OptionallibraryPathContainsName: boolean

    Returns LibraryIdentifierPath

    The library path of the created template resource.

  • 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.

  • 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 instance in currently loaded scenes and templates.

    Returns void

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

    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

    Returns void

Events

onRevertedToTemplate: Event<[SceneObject], void>

Invoked when a scene object was reverted to the template.