/// <summary> /// Creates the new scene object undo command. /// </summary> /// <param name="obj">Scene object on which to apply the performed changes.</param> /// <param name="oldState">Recorded original state of the scene object(s).</param> /// <param name="newState">Recorded new state of the scene object(s).</param> /// <param name="description"> /// Optional description of the changes made to the scene object between the two states. /// </param> public RecordSceneObjectUndo(SceneObject obj, SerializedSceneObject oldState, SerializedSceneObject newState, string description) { this.obj = obj; this.oldState = oldState; this.newState = newState; }
/// <summary> /// Creates a new object instance, recording the current state of the scene object. /// </summary> /// <param name="obj">Scene object to record the state of.</param> /// <param name="hierarchy">If true, the child scene objects will be recorded as well.</param> /// <param name="description"> /// Optional description that describes the change that is happening. /// </param> internal SceneObjectToRecord(SceneObject obj, bool hierarchy, string description) { this.obj = obj; this.description = description; orgState = new SerializedSceneObject(obj, hierarchy); }
/// <summary> /// Generates the diff from the previously recorded state and the current state. If there is a difference /// an undo command is recorded. /// </summary> internal void RecordCommand() { if (obj.IsDestroyed) { return; } var newState = new SerializedSceneObject(obj); UndoRedo.Global.RegisterCommand(new RecordSceneObjectUndo(obj, orgState, newState, description)); }
/// <summary> /// Records the current scene object state. /// </summary> internal void RecordCommand() { if (obj.IsDestroyed) { return; } var state = new SerializedSceneObject(obj); UndoRedo.Global.RegisterCommand(new NewSceneObjectUndo(obj, state)); }
private static extern void Internal_CreateInstance(SerializedSceneObject instance, IntPtr so, bool hierarchy);
private static extern void Internal_SerializedSceneObject(SerializedSceneObject managedInstance, SceneObject sceneObject, bool hierarchy);
/// <summary> /// Creates the new scene object undo command. /// </summary> /// <param name="obj">Newly created scene object on which to apply the command.</param> /// <param name="state">Recorded state of the scene object.</param> public NewSceneObjectUndo(SceneObject obj, SerializedSceneObject state) { this.obj = obj; this.state = state; }