Class SceneObjectUndoRedo

The SceneObjectUndoRedo class provides undo helpers for scene objects that can be undone through the editor's undo-redo system.

Hierarchy

  • FrameworkObject
    • SceneObjectUndoRedo

Constructors

  • Parameters

    • OptionalisInternalConstructor: boolean

    Returns SceneObjectUndoRedo

Methods

  • Records the current state of the provided SceneObject headers. A diff is automatically generated after the callback has been invoked. If a change is detected an UndoableCommand will be created.

    Parameters

    • undoRedo: UndoRedo

      The undo/redo information structure.

    • sceneObjects: SceneObject[]
    • description: string

      The name of the undo command.

    • callback: (() => void)

      The callback that performs the change.

        • (): void
        • Returns void

    • OptionalisGroupable: boolean

      Determines if the command should be grouped with similar commands.

    Returns void

    The SceneObjectHeader only contains primary properties such as name, transform, active and similar basal properties. All components of the sceneObject as well as child objects are ignored. To track changes to Component or children use createUndoForSceneObject instead. Use this API for performance critical situations.

  • Records the complete state of the provided SceneObject including changes to Component objects assigned to the scene object. Optionally, all child objects can be recorded. A diff is generated with a call to commitActiveOperations. If a change is detected an UndoableCommand will be created.

    Parameters

    • undoRedo: UndoRedo

      The undo/redo information structure.

    • sceneObject: SceneObject

      Scene object to record.

    • hierarchy: boolean

      Determines if the child objects will be recorded as well, otherwise just the provided object.

    • description: string

      Optional description specifying the type of changes about to be made.

    • OptionalisGroupable: boolean

      Determines if the command should be grouped with similar commands.

    Returns void

    If you only modify basic SceneObject properties such as name or the transform values, it's better to use the more lightweight recordSceneObjectHeader API instead.

  • Break the template link for some scene objects.

    Parameters

    • undoRedo: UndoRedo
    • sceneObjects: SceneObject[]

      The scene objects to break the template link.

    • description: string

      The description of the command to show in the command history.

    Returns void

  • Clone a scene object.

    Parameters

    • undoRedo: UndoRedo
    • sceneObject: SceneObject

      The scene object to clone.

    • description: string

      The description of the command to show in the command history.

    Returns SceneObject

    The cloned scene object.

  • Clone scene objects.

    Parameters

    • undoRedo: UndoRedo
    • sceneObjects: SceneObject[]

      The scene objects to clone.

    • transforms: Immutable<Matrix4>[]

      The transforms to apply to the cloned objects.

    • description: string

      The description of the command to show in the command history.

    Returns SceneObject[]

    The cloned scene objects.

  • Create a new scene object.

    Parameters

    • options: {
          description: string;
          name: string;
          sceneInstance: SceneInstance;
          undoRedo: UndoRedo;
      } | {
          description: string;
          fatComponent: FatComponent;
          name: string;
          sceneInstance: SceneInstance;
          undoRedo: UndoRedo;
      }

      Options object for the function call.

    Returns SceneObject

    The new scene object.

  • Records the complete state of the provided SceneObject including changes to Component objects assigned to the scene object. Optionally, all child objects can be recorded. A diff is automatically generated after the callback has been invoked. If a change is detected an UndoableCommand will be created.

    Parameters

    • undoRedo: UndoRedo

      The undo/redo information structure.

    • sceneObject: SceneObject

      Scene object.

    • description: string

      The name of the undo command.

    • callback: (() => void)

      The callback that performs the change.

        • (): void
        • Returns void

    • OptionalisRecursive: boolean

      Set to true to include changes to children of the sceneObject

    • OptionalisGroupable: boolean

      Determines if the command should be grouped with similar commands.

    Returns void

    If you only modify basic SceneObject properties such as name or the transform values, it's better to use the more lightweight createUndoForSceneObjectHeaders API instead.

  • Delete a scene object.

    Parameters

    • undoRedo: UndoRedo
    • sceneObject: SceneObject

      The scene object to delete.

    • description: string

      The description of the command to show in the command history.

    Returns void

  • Delete scene objects.

    Parameters

    • undoRedo: UndoRedo
    • sceneObjects: SceneObject[]

      The scene objects to delete.

    • description: string

      The description of the command to show in the command history.

    Returns void

  • Group scene objects under a common parent.

    Parameters

    • undoRedo: UndoRedo
    • sceneObjects: SceneObject[]

      The scene objects to group.

    • description: string

      The description of the command to show in the command history.

    Returns SceneObject

    The new parent of the group.

  • Instantiate a new scene object from a template

    Parameters

    Returns SceneObject

    The instantiated scene object.

  • Inverts the visibility of a list of scene objects and puts an undo command to revert the operation on the undo stack.

    Parameters

    Returns void

  • Create new scene object instances based on any SceneObject data on the clipboard.

    Parameters

    • undoRedo: UndoRedo
    • parent: SceneObject

      The parent under which the scene objects will be pasted.

    • description: string

      The description of the command to show in the command history.

    Returns boolean

    true if any objects were created.

  • Creates a brand new scene object and begins a recordSceneObject operation on the newly created scene object. Both the creation and the initially recorded set of data will be recorded as a single undo/redo command. Generally you want to call this when creating a new scene object and immediately make some initial changes to it (such as adding component or modifying their properties).

    Parameters

    • undoRedo: UndoRedo

      The undo/redo information structure.

    • sceneObject: SceneObject

      Newly created scene object on which to initiate the record operation on.

    • OptionalisGroupable: boolean

      Determines if the command should be grouped with similar commands.

    Returns void

  • Records the current state of the provided SceneObject header, and generates a diff with a call to commitActiveOperations. If a change is detected an UndoableCommand will be created.

    Parameters

    • undoRedo: UndoRedo

      The undo/redo information structure.

    • sceneObject: SceneObject

      Scene object to record the state of.

    • fieldPath: string

      Name to the field which should be focused when performing the undo/redo operation.

    • Optionaldescription: string

      Description of the undo command.

    • OptionalisGroupable: boolean

      Determines if the command should be grouped with similar commands.

    Returns void

    The SceneObjectHeader only contains primary properties such as name, transform, active and similar basal properties. All components of the sceneObject as well as child objects are ignored. To track changes to Component or children use recordSceneObject instead.

  • Records the current state of the provided SceneObject headers, and generates a diff with a call to commitActiveOperations. If a change is detected an UndoableCommand will be created.

    Parameters

    • undoRedo: UndoRedo

      The undo/redo information structure.

    • sceneObjects: SceneObject[]

      Scene objects to record the state of.

    • description: string

      Description of the undo command.

    • OptionalisGroupable: boolean

      Determines if the command should be grouped with similar commands.

    Returns void

    The SceneObjectHeader only contains primary properties such as name, transform, active and similar basal properties. All components of the sceneObject as well as child objects are ignored. To track changes to Component or children use recordSceneObject instead. Use this API for performance critical situations.

  • Place a scene object under a new parent.

    Parameters

    • undoRedo: UndoRedo
    • sceneObject: SceneObject

      The scene object to reparent.

    • newParent: SceneObject

      The new parent to place the object under.

    • description: string

      The description of the command to show in the command history.

    Returns void

  • Place scene objects under a new parent.

    Parameters

    • undoRedo: UndoRedo
    • sceneObjects: SceneObject[]

      The scene objects to reparent.

    • newParent: SceneObject

      The new parent to place the objects under.

    • description: string

      The description of the command to show in the command history.

    Returns void

  • Toggles the visibility of a list of scene objects and puts an undo command to revert the operation on the undo stack.

    Parameters

    Returns void