aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/UndoState.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs43
1 files changed, 22 insertions, 21 deletions
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index fd90714..7bbf1bd 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -30,6 +30,7 @@ using System.Reflection;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using log4net; 31using log4net;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
34 35
35namespace OpenSim.Region.Framework.Scenes 36namespace OpenSim.Region.Framework.Scenes
@@ -44,30 +45,30 @@ namespace OpenSim.Region.Framework.Scenes
44 /// Constructor. 45 /// Constructor.
45 /// </summary> 46 /// </summary>
46 /// <param name="part"></param> 47 /// <param name="part"></param>
47 /// <param name="what">bit field with what is changed</param> 48 /// <param name="change">bit field with what is changed</param>
48 /// 49 ///
49 public UndoState(SceneObjectPart part, ObjectChangeWhat what) 50 public UndoState(SceneObjectPart part, ObjectChangeType change)
50 { 51 {
51 data = new ObjectChangeData(); 52 data = new ObjectChangeData();
52 data.what = what; 53 data.change = change;
53 creationtime = DateTime.UtcNow; 54 creationtime = DateTime.UtcNow;
54 55
55 if (part.ParentGroup.RootPart == part) 56 if (part.ParentGroup.RootPart == part)
56 { 57 {
57 if ((what & ObjectChangeWhat.Position) != 0) 58 if ((change & ObjectChangeType.Position) != 0)
58 data.position = part.ParentGroup.AbsolutePosition; 59 data.position = part.ParentGroup.AbsolutePosition;
59 if ((what & ObjectChangeWhat.Rotation) != 0) 60 if ((change & ObjectChangeType.Rotation) != 0)
60 data.rotation = part.RotationOffset; 61 data.rotation = part.RotationOffset;
61 if ((what & ObjectChangeWhat.Scale) != 0) 62 if ((change & ObjectChangeType.Scale) != 0)
62 data.scale = part.Shape.Scale; 63 data.scale = part.Shape.Scale;
63 } 64 }
64 else 65 else
65 { 66 {
66 if ((what & ObjectChangeWhat.Position) != 0) 67 if ((change & ObjectChangeType.Position) != 0)
67 data.position = part.OffsetPosition; 68 data.position = part.OffsetPosition;
68 if ((what & ObjectChangeWhat.Rotation) != 0) 69 if ((change & ObjectChangeType.Rotation) != 0)
69 data.rotation = part.RotationOffset; 70 data.rotation = part.RotationOffset;
70 if ((what & ObjectChangeWhat.Scale) != 0) 71 if ((change & ObjectChangeType.Scale) != 0)
71 data.scale = part.Shape.Scale; 72 data.scale = part.Shape.Scale;
72 } 73 }
73 } 74 }
@@ -97,27 +98,27 @@ namespace OpenSim.Region.Framework.Scenes
97 /// <param name="part"></param> 98 /// <param name="part"></param>
98 /// <returns>true what fiels and related data are equal, False otherwise.</returns> 99 /// <returns>true what fiels and related data are equal, False otherwise.</returns>
99 /// 100 ///
100 public bool Compare(SceneObjectPart part, ObjectChangeWhat what) 101 public bool Compare(SceneObjectPart part, ObjectChangeType change)
101 { 102 {
102 if (data.what != what) // if diferent targets, then they are diferent 103 if (data.change != change) // if diferent targets, then they are diferent
103 return false; 104 return false;
104 105
105 if (part != null) 106 if (part != null)
106 { 107 {
107 if (part.ParentID == 0) 108 if (part.ParentID == 0)
108 { 109 {
109 if ((what & ObjectChangeWhat.Position) != 0 && data.position != part.ParentGroup.AbsolutePosition) 110 if ((change & ObjectChangeType.Position) != 0 && data.position != part.ParentGroup.AbsolutePosition)
110 return false; 111 return false;
111 } 112 }
112 else 113 else
113 { 114 {
114 if ((what & ObjectChangeWhat.Position) != 0 && data.position != part.OffsetPosition) 115 if ((change & ObjectChangeType.Position) != 0 && data.position != part.OffsetPosition)
115 return false; 116 return false;
116 } 117 }
117 118
118 if ((what & ObjectChangeWhat.Rotation) != 0 && data.rotation != part.RotationOffset) 119 if ((change & ObjectChangeType.Rotation) != 0 && data.rotation != part.RotationOffset)
119 return false; 120 return false;
120 if ((what & ObjectChangeWhat.Rotation) != 0 && data.scale == part.Shape.Scale) 121 if ((change & ObjectChangeType.Rotation) != 0 && data.scale == part.Shape.Scale)
121 return false; 122 return false;
122 return true; 123 return true;
123 124
@@ -196,9 +197,9 @@ namespace OpenSim.Region.Framework.Scenes
196 /// adds a new state undo to part or its group, with changes indicated by what bits 197 /// adds a new state undo to part or its group, with changes indicated by what bits
197 /// </summary> 198 /// </summary>
198 /// <param name="part"></param> 199 /// <param name="part"></param>
199 /// <param name="what">bit field with what is changed</param> 200 /// <param name="change">bit field with what is changed</param>
200 201
201 public void StoreUndo(SceneObjectPart part, ObjectChangeWhat what) 202 public void StoreUndo(SceneObjectPart part, ObjectChangeType change)
202 { 203 {
203 lock (m_undo) 204 lock (m_undo)
204 { 205 {
@@ -220,7 +221,7 @@ namespace OpenSim.Region.Framework.Scenes
220 // see if we actually have a change 221 // see if we actually have a change
221 if (last != null) 222 if (last != null)
222 { 223 {
223 if (last.Compare(part, what)) 224 if (last.Compare(part, change))
224 return; 225 return;
225 } 226 }
226 } 227 }
@@ -230,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes
230 while (m_undo.Count >= size) 231 while (m_undo.Count >= size)
231 m_undo.RemoveLast(); 232 m_undo.RemoveLast();
232 233
233 UndoState nUndo = new UndoState(part, what); 234 UndoState nUndo = new UndoState(part, change);
234 m_undo.AddFirst(nUndo); 235 m_undo.AddFirst(nUndo);
235 } 236 }
236 } 237 }
@@ -273,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes
273 while (m_redo.Count >= size) 274 while (m_redo.Count >= size)
274 m_redo.RemoveLast(); 275 m_redo.RemoveLast();
275 276
276 nUndo = new UndoState(part, goback.data.what); // new value in part should it be full goback copy? 277 nUndo = new UndoState(part, goback.data.change); // new value in part should it be full goback copy?
277 m_redo.AddFirst(nUndo); 278 m_redo.AddFirst(nUndo);
278 279
279 goback.PlayState(part); 280 goback.PlayState(part);
@@ -320,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes
320 while (m_undo.Count >= size) 321 while (m_undo.Count >= size)
321 m_undo.RemoveLast(); 322 m_undo.RemoveLast();
322 323
323 nUndo = new UndoState(part, gofwd.data.what); // new value in part should it be full gofwd copy? 324 nUndo = new UndoState(part, gofwd.data.change); // new value in part should it be full gofwd copy?
324 m_undo.AddFirst(nUndo); 325 m_undo.AddFirst(nUndo);
325 326
326 gofwd.PlayState(part); 327 gofwd.PlayState(part);