aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs69
1 files changed, 64 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 0db9b91..6cfe3e9 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Drawing; 31using System.Drawing;
31using System.Runtime.Serialization; 32using System.Runtime.Serialization;
@@ -106,6 +107,8 @@ namespace OpenSim.Region.Environment.Scenes
106 [XmlIgnore] public LLVector3 m_attachedPos = LLVector3.Zero; 107 [XmlIgnore] public LLVector3 m_attachedPos = LLVector3.Zero;
107 [XmlIgnore] public LLUUID fromAssetID = LLUUID.Zero; 108 [XmlIgnore] public LLUUID fromAssetID = LLUUID.Zero;
108 109
110 [XmlIgnore] public bool m_undoing = false;
111
109 public Int32 CreationDate; 112 public Int32 CreationDate;
110 public uint ParentID = 0; 113 public uint ParentID = 0;
111 114
@@ -123,6 +126,8 @@ namespace OpenSim.Region.Environment.Scenes
123 public uint EveryoneMask = (uint)PermissionMask.None; 126 public uint EveryoneMask = (uint)PermissionMask.None;
124 public uint NextOwnerMask = (uint)PermissionMask.All; 127 public uint NextOwnerMask = (uint)PermissionMask.All;
125 128
129 private UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
130
126 public LLObject.ObjectFlags Flags = LLObject.ObjectFlags.None; 131 public LLObject.ObjectFlags Flags = LLObject.ObjectFlags.None;
127 132
128 public uint ObjectFlags 133 public uint ObjectFlags
@@ -266,6 +271,40 @@ namespace OpenSim.Region.Environment.Scenes
266 //return new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); 271 //return new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
267 272
268 } 273 }
274
275 public void StoreUndoState()
276 {
277 if (!m_undoing)
278 {
279 if (m_parentGroup != null)
280 {
281 if (m_undo.Count > 0)
282 {
283 UndoState last = m_undo.Peek();
284 if (last != null)
285 {
286 if (last.Compare(this))
287 return;
288 }
289 }
290
291
292 if (m_parentGroup.GetSceneMaxUndo() > 0)
293 {
294 UndoState nUndo = new UndoState(this);
295
296 m_undo.Push(nUndo);
297
298 }
299 }
300 }
301 }
302
303 public void ClearUndoState()
304 {
305 m_undo.Clear();
306 StoreUndoState();
307 }
269 308
270 public LLVector3 GroupPosition 309 public LLVector3 GroupPosition
271 { 310 {
@@ -290,7 +329,9 @@ namespace OpenSim.Region.Environment.Scenes
290 return m_groupPosition; 329 return m_groupPosition;
291 } 330 }
292 set 331 set
293 { 332 {
333 StoreUndoState();
334
294 m_groupPosition = value; 335 m_groupPosition = value;
295 336
296 if (PhysActor != null) 337 if (PhysActor != null)
@@ -334,7 +375,10 @@ namespace OpenSim.Region.Environment.Scenes
334 public LLVector3 OffsetPosition 375 public LLVector3 OffsetPosition
335 { 376 {
336 get { return m_offsetPosition; } 377 get { return m_offsetPosition; }
337 set { m_offsetPosition = value; 378 set
379 {
380 StoreUndoState();
381 m_offsetPosition = value;
338 try 382 try
339 { 383 {
340 // Hack to get the child prim to update world positions in the physics engine 384 // Hack to get the child prim to update world positions in the physics engine
@@ -380,6 +424,7 @@ namespace OpenSim.Region.Environment.Scenes
380 } 424 }
381 set 425 set
382 { 426 {
427 StoreUndoState();
383 m_rotationOffset = value; 428 m_rotationOffset = value;
384 429
385 if (PhysActor != null) 430 if (PhysActor != null)
@@ -650,7 +695,8 @@ namespace OpenSim.Region.Environment.Scenes
650 { 695 {
651 get { return m_shape.Scale; } 696 get { return m_shape.Scale; }
652 set 697 set
653 { 698 {
699 StoreUndoState();
654 m_shape.Scale = value; 700 m_shape.Scale = value;
655 TriggerScriptChangedEvent(Changed.SCALE); 701 TriggerScriptChangedEvent(Changed.SCALE);
656 } 702 }
@@ -759,7 +805,8 @@ namespace OpenSim.Region.Environment.Scenes
759 LLObject.ObjectFlags.CreateSelected; 805 LLObject.ObjectFlags.CreateSelected;
760 806
761 TrimPermissions(); 807 TrimPermissions();
762 808 //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
809
763 ScheduleFullUpdate(); 810 ScheduleFullUpdate();
764 } 811 }
765 812
@@ -802,7 +849,7 @@ namespace OpenSim.Region.Environment.Scenes
802 849
803 TrimPermissions(); 850 TrimPermissions();
804 // ApplyPhysics(); 851 // ApplyPhysics();
805 852
806 ScheduleFullUpdate(); 853 ScheduleFullUpdate();
807 } 854 }
808 855
@@ -1982,6 +2029,7 @@ namespace OpenSim.Region.Environment.Scenes
1982 2029
1983 public void UpdateRotation(LLQuaternion rot) 2030 public void UpdateRotation(LLQuaternion rot)
1984 { 2031 {
2032 //StoreUndoState();
1985 RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W); 2033 RotationOffset = new LLQuaternion(rot.X, rot.Y, rot.Z, rot.W);
1986 ScheduleTerseUpdate(); 2034 ScheduleTerseUpdate();
1987 } 2035 }
@@ -2097,6 +2145,7 @@ namespace OpenSim.Region.Environment.Scenes
2097 /// <param name="scale"></param> 2145 /// <param name="scale"></param>
2098 public void Resize(LLVector3 scale) 2146 public void Resize(LLVector3 scale)
2099 { 2147 {
2148 StoreUndoState();
2100 m_shape.Scale = scale; 2149 m_shape.Scale = scale;
2101 2150
2102 ScheduleFullUpdate(); 2151 ScheduleFullUpdate();
@@ -2522,5 +2571,15 @@ namespace OpenSim.Region.Environment.Scenes
2522 info.AddValue("PayPrice", PayPrice); 2571 info.AddValue("PayPrice", PayPrice);
2523 } 2572 }
2524 2573
2574
2575 public void Undo()
2576 {
2577 if (m_undo.Count > 0)
2578 {
2579 UndoState goback = m_undo.Pop();
2580 if (goback != null)
2581 goback.PlaybackState(this);
2582 }
2583 }
2525 } 2584 }
2526} 2585}