29 using System.Reflection;
30 using System.Collections.Generic;
33 using OpenSim.Framework;
34 using OpenSim.Region.Framework.Interfaces;
36 namespace OpenSim.
Region.Framework.Scenes
40 const int UNDOEXPIRESECONDS = 300;
54 creationtime = DateTime.UtcNow;
59 data.position = part.ParentGroup.AbsolutePosition;
61 data.rotation = part.RotationOffset;
63 data.scale = part.Shape.Scale;
68 data.position = part.OffsetPosition;
70 data.rotation = part.RotationOffset;
72 data.scale = part.Shape.Scale;
81 TimeSpan t = DateTime.UtcNow - creationtime;
82 if (t.Seconds > UNDOEXPIRESECONDS)
92 creationtime = DateTime.UtcNow;
103 if (data.change != change)
143 grp.doChangeObject(part, data);
145 part.Undoing =
false;
152 public LinkedList<UndoState> m_redo =
new LinkedList<UndoState>();
153 public LinkedList<UndoState> m_undo =
new LinkedList<UndoState>();
183 get {
return m_undo.Count; }
208 if (m_redo.Count > 0)
213 if (m_undo.Count > 0)
216 last = m_undo.First.Value;
224 if (last.
Compare(part, change))
231 while (m_undo.Count >= size)
235 m_undo.AddFirst(nUndo);
252 if (m_redo.Count > 0)
254 nUndo = m_redo.First.Value;
259 if (m_undo.Count > 0)
271 m_undo.RemoveFirst();
274 while (m_redo.Count >= size)
278 m_redo.AddFirst(nUndo);
280 goback.PlayState(part);
299 if (m_undo.Count > 0)
301 nUndo = m_undo.First.Value;
306 if (m_redo.Count > 0)
318 m_redo.RemoveFirst();
321 while (m_undo.Count >= size)
325 m_undo.AddFirst(nUndo);
327 gofwd.PlayState(part);
341 m_terrainModule = terrainModule;
342 m_terrainChannel = terrainChannel;
347 return m_terrainChannel == terrainChannel;
352 m_terrainModule.UndoTerrain(m_terrainChannel);
void updateExpire()
updates undo or redo creation time to now
ITerrainModule m_terrainModule
LandUndoState(ITerrainModule terrainModule, ITerrainChannel terrainChannel)
void StoreUndo(SceneObjectPart part, ObjectChangeType change)
adds a new state undo to part or its group, with changes indicated by what bits
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
void PlayState(SceneObjectPart part)
executes the undo or redo to a part or its group
UndoRedoState(int _size)
creates a new UndoRedoState with states memory having indicated size
UndoRedoState()
creates a new UndoRedoState with default states memory size
void Undo(SceneObjectPart part)
executes last state undo to part or its group current state is pushed into redo
SceneObjectGroup ParentGroup
bool checkExpire()
check if undo or redo is too old
uint ParentID
The parent ID of this part.
override Vector3 AbsolutePosition
The absolute position of this scene object in the scene
void Redo(SceneObjectPart part)
executes last state redo to part or its group current state is pushed into undo
UndoState(SceneObjectPart part, ObjectChangeType change)
Constructor.
bool Compare(SceneObjectPart part, ObjectChangeType change)
Compare the relevant state in the given part to this state.
void Clear()
clears all undo and redo entries
ITerrainChannel m_terrainChannel
bool Compare(ITerrainChannel terrainChannel)
Quaternion RotationOffset