コード例 #1
0
 public void Dispose()
 {
     if (_timeline.Undo != null)
     {
         var after = EditTimelineAction.CaptureData(_timeline);
         if (!FlaxEngine.Utils.ArraysEqual(_before, after))
         {
             var action = new EditTimelineAction(_timeline, _before, after);
             if (_customActionAfter != null && _customActionBefore != null)
             {
                 _timeline.Undo.AddAction(new MultiUndoAction(_customActionBefore, action, _customActionAfter));
             }
             else if (_customActionAfter != null)
             {
                 _timeline.Undo.AddAction(new MultiUndoAction(action, _customActionAfter));
             }
             else if (_customActionBefore != null)
             {
                 _timeline.Undo.AddAction(new MultiUndoAction(_customActionBefore, action));
             }
             else
             {
                 _timeline.Undo.AddAction(action);
             }
         }
         _before             = null;
         _customActionBefore = null;
         _customActionAfter  = null;
     }
     _timeline = null;
 }
コード例 #2
0
 public TimelineUndoBlock(Timeline timeline, IUndoAction customActionBefore = null, IUndoAction customActionAfter = null)
 {
     _timeline = timeline;
     if (timeline.Undo != null)
     {
         _customActionBefore = customActionBefore;
         _customActionAfter  = customActionAfter;
         _before             = EditTimelineAction.CaptureData(timeline);
     }
 }