Exemplo n.º 1
0
 /// <summary>
 /// Push a new state onto the undo/redo buffer, will erase anything after the current undo.
 /// This will use the passed states for undo and redo.
 /// </summary>
 public void pushUndoState(CameraPosition undoState, CameraPosition redoState)
 {
     //Make sure the undo and redo states are sufficiently different, otherwise ignore this new entry
     if ((undoState.Translation - redoState.Translation).length2() > 0.001 || (undoState.LookAt - redoState.LookAt).length2() > 0.001)
     {
         undoRedoBuffer.pushAndSkip(new TwoWayDelegateCommand <CameraPosition, CameraPosition>(redoState, undoState, new TwoWayDelegateCommand <CameraPosition, CameraPosition> .Funcs()
         {
             ExecuteFunc = state =>
             {
                 this.setPosition(state, GuiFrameworkCamerasInterface.CameraTransitionTime);
                 if (OnRedo != null)
                 {
                     OnRedo.Invoke(this);
                 }
             },
             UndoFunc = state =>
             {
                 this.setPosition(state, GuiFrameworkCamerasInterface.CameraTransitionTime);
                 if (OnUndo != null)
                 {
                     OnUndo.Invoke(this);
                 }
             }
         }));
         if (OnUndoRedoChanged != null)
         {
             OnUndoRedoChanged.Invoke(this);
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Push a new state onto the undo/redo buffer, will erase anything after the current undo.
 /// This will use the passed states for undo and redo.
 /// </summary>
 public void pushUndoState(LayerState undoState, LayerState redoState)
 {
     if (!undoState.isTheSameAs(redoState)) //This uses the slightly unreliable isTheSameAs function, but worse case scenerio we end up with a duplicate undo.
     {
         undoRedoBuffers[activeStateName].pushAndSkip(new TwoWayDelegateCommand <LayerState, LayerState>(redoState, undoState, new TwoWayDelegateCommand <LayerState, LayerState> .Funcs()
         {
             ExecuteFunc = state =>
             {
                 state.apply();
                 if (OnRedo != null)
                 {
                     OnRedo.Invoke(this);
                 }
             },
             UndoFunc = state =>
             {
                 state.apply();
                 if (OnUndo != null)
                 {
                     OnUndo.Invoke(this);
                 }
             }
         }));
         if (OnUndoRedoChanged != null)
         {
             OnUndoRedoChanged.Invoke(this);
         }
     }
 }
 /// <summary>
 /// Push a new state onto the undo/redo buffer, will erase anything after the current undo.
 /// This will use the passed states for undo and redo.
 /// </summary>
 public void pushUndoState(MusclePosition undoPosition, MusclePosition redoPosition)
 {
     poseUndoRedoBuffer.pushAndSkip(new TwoWayDelegateCommand <MusclePosition, MusclePosition>(redoPosition, undoPosition, new TwoWayDelegateCommand <MusclePosition, MusclePosition> .Funcs()
     {
         ExecuteFunc = position =>
         {
             position.preview();
             if (OnRedo != null)
             {
                 OnRedo.Invoke(this);
             }
         },
         UndoFunc = position =>
         {
             position.preview();
             if (OnUndo != null)
             {
                 OnUndo.Invoke(this);
             }
         }
     }));
     if (OnUndoRedoChanged != null)
     {
         OnUndoRedoChanged.Invoke(this);
     }
 }
 void controller_SceneLoaded(SimScene scene)
 {
     bindPosition = new MusclePosition();
     bindPosition.captureState();
     poseUndoRedoBuffer.clear();
     if (OnUndoRedoChanged != null)
     {
         OnUndoRedoChanged.Invoke(this);
     }
 }