public ManipulatableUpdateAction(Layer l, Frameset f, Keyframe k, IEntityState prevState, IEntityState newState) { LayerIndex = Program.ActiveProject.Layers.IndexOf(l); FramesetIndex = l.Framesets.IndexOf(f); KeyframeIndex = f.Keyframes.IndexOf(k); OldState = prevState.Copy(); NewState = newState.Copy(); }
public bool Undo() { Keyframe keyframe = Program.ActiveProject.Layers[LayerIndex].Framesets[FramesetIndex].Keyframes[KeyframeIndex]; keyframe.State = OldState.Copy(); Program.MainTimeline.ClearSelection(); Program.MainTimeline.selectedItems.Select(Program.ActiveProject.Layers[LayerIndex], keyframe, Program.ActiveProject.Layers[LayerIndex].Framesets[FramesetIndex]); Program.MainTimeline.GLContext.Invalidate(); return(true); }
public bool Do() { Layer TargetLayer = Program.ActiveProject.Layers[LayerIndex]; Frameset TargetFrameset = TargetLayer.Framesets[FramesetIndex]; AddedFrame = new Keyframe(Time, State.Copy(), EntityInterpolationMode.Linear); PrevSelectedFrame = Program.MainTimeline.selectedTime; Program.MainTimeline.ClearSelection(); Program.MainTimeline.selectedItems.Select(TargetLayer, TargetFrameset, AddedFrame); TargetFrameset.Keyframes.Add(AddedFrame); TargetFrameset.Keyframes = TargetFrameset.Keyframes.OrderBy(o => o.Time).ToList(); AddedFrameIndex = TargetFrameset.Keyframes.IndexOf(AddedFrame); Program.MainTimeline.GLContext.Invalidate(); return(true); }