RSX Code Reference
    Preparing search index...

    Class TemplateUtility

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

    Hierarchy (View Summary)

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

      • OptionalautoApply: boolean

      Returns void

    • Updates the contents of the template with the contents of the provided sceneObject. The sceneObject must be a template instance. If it is not a template instance, an error is logged to the console.

      Parameters

      • sceneObject: SceneObject

        SceneObject that is part of a template instance to apply to the template resource.

      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

    • Breaks the template link for the provided scene objects.

      Parameters

      • undoRedo: UndoRedo

        The undo/redo information structure.

      • sceneObjects: SceneObject[]

        The scene objects to break the template link for.

      • OptionalfnOnSuccess: () => void

        An optional callback that is invoked on success.

      • OptionalfnOnError: (errorMessage: string) => void

        An optional callback that is invoked on error.

      Returns void

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

      • libraryPath: LibraryPath

        Virtual library path at which to store the template.

      • OptionalfnOnSuccess: (result: TemplateOperationResult) => void
      • OptionalfnOnError: (errorMessage: string) => void

      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: LibraryPath

        The directory in the library where to save the template.

      • OptionallibraryPathContainsName: boolean
      • OptionalfnOnSuccess: (
            result: TemplateOperationResult,
            templateLibraryPath: LibraryPath,
            templateRoot: SceneObject,
        ) => void
      • OptionalfnOnError: (errorMessage: string) => void

      Returns boolean

      True if the template creation operation was started.

    • Computes and returns a debug string representation of the template delta for the provided scene object. The delta is computed on the fly against the template version the instance was last synced to.

      Parameters

      • object: SceneObject

        Scene object to compute the template delta debug string for.

      Returns string

      Debug string of the template delta, or empty string if the object is not 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.

    • Checks if a template instance root is out of date relative to its template resource.

      Parameters

      Returns boolean

    • 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

    onRevertedToTemplate: Event<[sceneObject: SceneObject]>

    Invoked when a scene object was reverted to the template.

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

    Invoked when a template resource is saved.