aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTom Grimshaw2010-07-04 19:28:39 -0700
committerTom Grimshaw2010-07-04 19:28:39 -0700
commit5b68343361cbd000a2f024b37797ec235abb7207 (patch)
treea8977cb2d9392c83081675f24f8043a3cc56ad73
parentCorrect positioning of timeout modifier in the SynchronousRestObjectRequester (diff)
downloadopensim-SC_OLD-5b68343361cbd000a2f024b37797ec235abb7207.zip
opensim-SC_OLD-5b68343361cbd000a2f024b37797ec235abb7207.tar.gz
opensim-SC_OLD-5b68343361cbd000a2f024b37797ec235abb7207.tar.bz2
opensim-SC_OLD-5b68343361cbd000a2f024b37797ec235abb7207.tar.xz
The majority of the Undo fix. There is still an issue with Rotation which i'll address next; however position undo and scale undo should be working just fine now. Also removed some residual debug logging.
-rw-r--r--OpenSim/Framework/UndoStack.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs61
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs80
5 files changed, 135 insertions, 57 deletions
diff --git a/OpenSim/Framework/UndoStack.cs b/OpenSim/Framework/UndoStack.cs
index 3799180..4cd779a 100644
--- a/OpenSim/Framework/UndoStack.cs
+++ b/OpenSim/Framework/UndoStack.cs
@@ -88,7 +88,14 @@ namespace OpenSim.Framework
88 88
89 public T Peek() 89 public T Peek()
90 { 90 {
91 return m_undolist[m_undolist.Count - 1]; 91 if (m_undolist.Count > 0)
92 {
93 return m_undolist[m_undolist.Count - 1];
94 }
95 else
96 {
97 return default(T);
98 }
92 } 99 }
93 100
94 public void Clear() 101 public void Clear()
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index da664da..34712b8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -355,7 +355,7 @@ namespace OpenSim.Region.Framework.Scenes
355 { 355 {
356 foreach(SceneObjectPart p in m_parts.Values) 356 foreach(SceneObjectPart p in m_parts.Values)
357 { 357 {
358 p.StoreUndoState(true); 358 p.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
359 } 359 }
360 } 360 }
361 finally 361 finally
@@ -435,7 +435,6 @@ namespace OpenSim.Region.Framework.Scenes
435 get { return m_rootPart.GroupPosition; } 435 get { return m_rootPart.GroupPosition; }
436 set 436 set
437 { 437 {
438
439 Vector3 val = value; 438 Vector3 val = value;
440 439
441 if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) 440 if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
@@ -464,7 +463,7 @@ namespace OpenSim.Region.Framework.Scenes
464 foreach (SceneObjectPart part in m_parts.Values) 463 foreach (SceneObjectPart part in m_parts.Values)
465 { 464 {
466 part.IgnoreUndoUpdate = false; 465 part.IgnoreUndoUpdate = false;
467 part.StoreUndoState(true); 466 part.StoreUndoState(UndoType.STATE_GROUP_POSITION);
468 part.GroupPosition = val; 467 part.GroupPosition = val;
469 } 468 }
470 lockPartsForRead(false); 469 lockPartsForRead(false);
@@ -1488,7 +1487,7 @@ namespace OpenSim.Region.Framework.Scenes
1488 1487
1489 public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) 1488 public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient)
1490 { 1489 {
1491 part.StoreUndoState(); 1490 part.StoreUndoState(UndoType.STATE_PRIM_ALL);
1492 part.OnGrab(offsetPos, remoteClient); 1491 part.OnGrab(offsetPos, remoteClient);
1493 } 1492 }
1494 1493
@@ -3245,6 +3244,9 @@ namespace OpenSim.Region.Framework.Scenes
3245 prevScale.X *= x; 3244 prevScale.X *= x;
3246 prevScale.Y *= y; 3245 prevScale.Y *= y;
3247 prevScale.Z *= z;; 3246 prevScale.Z *= z;;
3247
3248 part.IgnoreUndoUpdate = false;
3249 part.StoreUndoState(UndoType.STATE_GROUP_SCALE);
3248 part.IgnoreUndoUpdate = true; 3250 part.IgnoreUndoUpdate = true;
3249 part.Resize(prevScale); 3251 part.Resize(prevScale);
3250 part.IgnoreUndoUpdate = false; 3252 part.IgnoreUndoUpdate = false;
@@ -3253,11 +3255,12 @@ namespace OpenSim.Region.Framework.Scenes
3253 { 3255 {
3254 foreach (SceneObjectPart obPart in m_parts.Values) 3256 foreach (SceneObjectPart obPart in m_parts.Values)
3255 { 3257 {
3256 obPart.IgnoreUndoUpdate = false;
3257 obPart.StoreUndoState(true);
3258 obPart.IgnoreUndoUpdate = true;
3259 if (obPart.UUID != m_rootPart.UUID) 3258 if (obPart.UUID != m_rootPart.UUID)
3260 { 3259 {
3260 obPart.IgnoreUndoUpdate = false;
3261 obPart.StoreUndoState(UndoType.STATE_GROUP_SCALE);
3262 obPart.IgnoreUndoUpdate = true;
3263
3261 Vector3 currentpos = new Vector3(obPart.OffsetPosition); 3264 Vector3 currentpos = new Vector3(obPart.OffsetPosition);
3262 currentpos.X *= x; 3265 currentpos.X *= x;
3263 currentpos.Y *= y; 3266 currentpos.Y *= y;
@@ -3296,14 +3299,11 @@ namespace OpenSim.Region.Framework.Scenes
3296 /// <param name="pos"></param> 3299 /// <param name="pos"></param>
3297 public void UpdateGroupPosition(Vector3 pos) 3300 public void UpdateGroupPosition(Vector3 pos)
3298 { 3301 {
3299 foreach (SceneObjectPart part in Children.Values)
3300 {
3301 part.StoreUndoState();
3302 }
3303 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 3302 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
3304 { 3303 {
3305 if (IsAttachment) 3304 if (IsAttachment)
3306 { 3305 {
3306 m_rootPart.StoreUndoState(UndoType.STATE_GROUP_POSITION);
3307 m_rootPart.AttachedPos = pos; 3307 m_rootPart.AttachedPos = pos;
3308 } 3308 }
3309 if (RootPart.GetStatusSandbox()) 3309 if (RootPart.GetStatusSandbox())
@@ -3336,7 +3336,7 @@ namespace OpenSim.Region.Framework.Scenes
3336 SceneObjectPart part = GetChildPart(localID); 3336 SceneObjectPart part = GetChildPart(localID);
3337 foreach (SceneObjectPart parts in Children.Values) 3337 foreach (SceneObjectPart parts in Children.Values)
3338 { 3338 {
3339 parts.StoreUndoState(); 3339 parts.StoreUndoState(UndoType.STATE_PRIM_POSITION);
3340 } 3340 }
3341 if (part != null) 3341 if (part != null)
3342 { 3342 {
@@ -3361,7 +3361,7 @@ namespace OpenSim.Region.Framework.Scenes
3361 { 3361 {
3362 foreach (SceneObjectPart part in Children.Values) 3362 foreach (SceneObjectPart part in Children.Values)
3363 { 3363 {
3364 part.StoreUndoState(); 3364 part.StoreUndoState(UndoType.STATE_PRIM_POSITION);
3365 } 3365 }
3366 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 3366 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
3367 Vector3 oldPos = 3367 Vector3 oldPos =
@@ -3409,7 +3409,7 @@ namespace OpenSim.Region.Framework.Scenes
3409 { 3409 {
3410 foreach (SceneObjectPart parts in Children.Values) 3410 foreach (SceneObjectPart parts in Children.Values)
3411 { 3411 {
3412 parts.StoreUndoState(); 3412 parts.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
3413 } 3413 }
3414 m_rootPart.UpdateRotation(rot); 3414 m_rootPart.UpdateRotation(rot);
3415 3415
@@ -3433,7 +3433,7 @@ namespace OpenSim.Region.Framework.Scenes
3433 { 3433 {
3434 foreach (SceneObjectPart parts in Children.Values) 3434 foreach (SceneObjectPart parts in Children.Values)
3435 { 3435 {
3436 parts.StoreUndoState(); 3436 parts.StoreUndoState(UndoType.STATE_GROUP_ROTATION);
3437 } 3437 }
3438 m_rootPart.UpdateRotation(rot); 3438 m_rootPart.UpdateRotation(rot);
3439 3439
@@ -3460,7 +3460,7 @@ namespace OpenSim.Region.Framework.Scenes
3460 SceneObjectPart part = GetChildPart(localID); 3460 SceneObjectPart part = GetChildPart(localID);
3461 foreach (SceneObjectPart parts in Children.Values) 3461 foreach (SceneObjectPart parts in Children.Values)
3462 { 3462 {
3463 parts.StoreUndoState(); 3463 parts.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
3464 } 3464 }
3465 if (part != null) 3465 if (part != null)
3466 { 3466 {
@@ -3496,7 +3496,7 @@ namespace OpenSim.Region.Framework.Scenes
3496 part.UpdateRotation(rot); 3496 part.UpdateRotation(rot);
3497 part.OffsetPosition = pos; 3497 part.OffsetPosition = pos;
3498 part.IgnoreUndoUpdate = false; 3498 part.IgnoreUndoUpdate = false;
3499 part.StoreUndoState(); 3499 part.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
3500 } 3500 }
3501 } 3501 }
3502 } 3502 }
@@ -3510,7 +3510,7 @@ namespace OpenSim.Region.Framework.Scenes
3510 Quaternion axRot = rot; 3510 Quaternion axRot = rot;
3511 Quaternion oldParentRot = m_rootPart.RotationOffset; 3511 Quaternion oldParentRot = m_rootPart.RotationOffset;
3512 3512
3513 m_rootPart.StoreUndoState(); 3513 m_rootPart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
3514 m_rootPart.UpdateRotation(rot); 3514 m_rootPart.UpdateRotation(rot);
3515 if (m_rootPart.PhysActor != null) 3515 if (m_rootPart.PhysActor != null)
3516 { 3516 {
@@ -3542,7 +3542,7 @@ namespace OpenSim.Region.Framework.Scenes
3542 if (childpart != m_rootPart) 3542 if (childpart != m_rootPart)
3543 { 3543 {
3544 childpart.IgnoreUndoUpdate = false; 3544 childpart.IgnoreUndoUpdate = false;
3545 childpart.StoreUndoState(); 3545 childpart.StoreUndoState(UndoType.STATE_PRIM_ROTATION);
3546 } 3546 }
3547 } 3547 }
3548 3548
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 72ad281..93a23ca 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -697,7 +697,7 @@ namespace OpenSim.Region.Framework.Scenes
697 get { return m_offsetPosition; } 697 get { return m_offsetPosition; }
698 set 698 set
699 { 699 {
700 StoreUndoState(); 700 StoreUndoState(UndoType.STATE_PRIM_POSITION);
701 m_offsetPosition = value; 701 m_offsetPosition = value;
702 702
703 if (ParentGroup != null && !ParentGroup.IsDeleted) 703 if (ParentGroup != null && !ParentGroup.IsDeleted)
@@ -759,7 +759,7 @@ namespace OpenSim.Region.Framework.Scenes
759 759
760 set 760 set
761 { 761 {
762 StoreUndoState(); 762 StoreUndoState(UndoType.STATE_PRIM_ROTATION);
763 m_rotationOffset = value; 763 m_rotationOffset = value;
764 764
765 PhysicsActor actor = PhysActor; 765 PhysicsActor actor = PhysActor;
@@ -958,7 +958,7 @@ namespace OpenSim.Region.Framework.Scenes
958 get { return m_shape.Scale; } 958 get { return m_shape.Scale; }
959 set 959 set
960 { 960 {
961 StoreUndoState(); 961 StoreUndoState(UndoType.STATE_PRIM_SCALE);
962 if (m_shape != null) 962 if (m_shape != null)
963 { 963 {
964 m_shape.Scale = value; 964 m_shape.Scale = value;
@@ -1522,7 +1522,7 @@ namespace OpenSim.Region.Framework.Scenes
1522 { 1522 {
1523 m_redo.Clear(); 1523 m_redo.Clear();
1524 } 1524 }
1525 StoreUndoState(); 1525 StoreUndoState(UndoType.STATE_ALL);
1526 } 1526 }
1527 1527
1528 public byte ConvertScriptUintToByte(uint indata) 1528 public byte ConvertScriptUintToByte(uint indata)
@@ -2721,7 +2721,7 @@ namespace OpenSim.Region.Framework.Scenes
2721 /// <param name="scale"></param> 2721 /// <param name="scale"></param>
2722 public void Resize(Vector3 scale) 2722 public void Resize(Vector3 scale)
2723 { 2723 {
2724 StoreUndoState(); 2724 StoreUndoState(UndoType.STATE_PRIM_SCALE);
2725 m_shape.Scale = scale; 2725 m_shape.Scale = scale;
2726 2726
2727 ParentGroup.HasGroupChanged = true; 2727 ParentGroup.HasGroupChanged = true;
@@ -3504,13 +3504,11 @@ namespace OpenSim.Region.Framework.Scenes
3504 m_parentGroup.ScheduleGroupForTerseUpdate(); 3504 m_parentGroup.ScheduleGroupForTerseUpdate();
3505 //m_parentGroup.ScheduleGroupForFullUpdate(); 3505 //m_parentGroup.ScheduleGroupForFullUpdate();
3506 } 3506 }
3507 public void StoreUndoState() 3507 public void StoreUndoState(UndoType type)
3508 { 3508 {
3509 StoreUndoState(false); 3509
3510 } 3510
3511 public void StoreUndoState(bool group) 3511 if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
3512 {
3513 if (!Undoing)
3514 { 3512 {
3515 if (!IgnoreUndoUpdate) 3513 if (!IgnoreUndoUpdate)
3516 { 3514 {
@@ -3521,17 +3519,25 @@ namespace OpenSim.Region.Framework.Scenes
3521 if (m_undo.Count > 0) 3519 if (m_undo.Count > 0)
3522 { 3520 {
3523 UndoState last = m_undo.Peek(); 3521 UndoState last = m_undo.Peek();
3524 if (last != null) 3522
3525 {
3526 if (last.Compare(this))
3527 return;
3528 }
3529 } 3523 }
3530 3524
3531 if (m_parentGroup.GetSceneMaxUndo() > 0) 3525 if (m_parentGroup.GetSceneMaxUndo() > 0)
3532 { 3526 {
3533 UndoState nUndo = new UndoState(this); 3527 UndoState lastUndo = m_undo.Peek();
3534 nUndo.GroupChange = group; 3528
3529 UndoState nUndo = new UndoState(this, type);
3530
3531 if (lastUndo != null)
3532 {
3533 TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
3534 if (ts.TotalMilliseconds < 500)
3535 {
3536 //Delete the last entry since it was less than 500 milliseconds ago
3537 nUndo.Merge(lastUndo);
3538 m_undo.Pop();
3539 }
3540 }
3535 m_undo.Push(nUndo); 3541 m_undo.Push(nUndo);
3536 } 3542 }
3537 3543
@@ -4008,20 +4014,13 @@ namespace OpenSim.Region.Framework.Scenes
4008 if (m_undo.Count > 0) 4014 if (m_undo.Count > 0)
4009 { 4015 {
4010 UndoState nUndo = null; 4016 UndoState nUndo = null;
4011 if (m_parentGroup.GetSceneMaxUndo() > 0)
4012 {
4013 nUndo = new UndoState(this);
4014 }
4015 UndoState goback = m_undo.Pop(); 4017 UndoState goback = m_undo.Pop();
4016 m_log.Debug("Got goback"); 4018 if (m_parentGroup.GetSceneMaxUndo() > 0)
4017 if (goback == null)
4018 {
4019 m_log.Debug("it's null");
4020 }
4021 else
4022 { 4019 {
4023 m_log.Debug(goback.GroupPosition.ToString()); 4020 nUndo = new UndoState(this, goback.Type);
4024 } 4021 }
4022
4023
4025 if (goback != null) 4024 if (goback != null)
4026 { 4025 {
4027 goback.PlaybackState(this); 4026 goback.PlaybackState(this);
@@ -4036,13 +4035,13 @@ namespace OpenSim.Region.Framework.Scenes
4036 { 4035 {
4037 lock (m_redo) 4036 lock (m_redo)
4038 { 4037 {
4038 UndoState gofwd = m_redo.Pop();
4039 if (m_parentGroup.GetSceneMaxUndo() > 0) 4039 if (m_parentGroup.GetSceneMaxUndo() > 0)
4040 { 4040 {
4041 UndoState nUndo = new UndoState(this); 4041 UndoState nUndo = new UndoState(this, gofwd.Type);
4042 4042
4043 m_undo.Push(nUndo); 4043 m_undo.Push(nUndo);
4044 } 4044 }
4045 UndoState gofwd = m_redo.Pop();
4046 if (gofwd != null) 4045 if (gofwd != null)
4047 gofwd.PlayfwdState(this); 4046 gofwd.PlayfwdState(this);
4048 } 4047 }
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 5bdaa17..77e477f 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
105 sceneObject.AddPart(part); 105 sceneObject.AddPart(part);
106 part.LinkNum = linkNum; 106 part.LinkNum = linkNum;
107 part.TrimPermissions(); 107 part.TrimPermissions();
108 part.StoreUndoState(); 108 part.StoreUndoState(UndoType.STATE_ALL);
109 reader.Close(); 109 reader.Close();
110 sr.Close(); 110 sr.Close();
111 } 111 }
@@ -231,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
231 if (originalLinkNum != 0) 231 if (originalLinkNum != 0)
232 part.LinkNum = originalLinkNum; 232 part.LinkNum = originalLinkNum;
233 233
234 part.StoreUndoState(); 234 part.StoreUndoState(UndoType.STATE_ALL);
235 reader.Close(); 235 reader.Close();
236 sr.Close(); 236 sr.Close();
237 } 237 }
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index 77381ab..ad05351 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -27,26 +27,43 @@
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Region.Framework.Interfaces; 29using OpenSim.Region.Framework.Interfaces;
30using System;
30 31
31namespace OpenSim.Region.Framework.Scenes 32namespace OpenSim.Region.Framework.Scenes
32{ 33{
34 [Flags]
35 public enum UndoType
36 {
37 STATE_PRIM_POSITION = 1,
38 STATE_PRIM_ROTATION = 2,
39 STATE_PRIM_SCALE = 4,
40 STATE_PRIM_ALL = 7,
41 STATE_GROUP_POSITION = 8,
42 STATE_GROUP_ROTATION = 16,
43 STATE_GROUP_SCALE = 32,
44 STATE_GROUP_ALL = 56,
45 STATE_ALL = 63
46 }
47
33 public class UndoState 48 public class UndoState
34 { 49 {
35 public Vector3 Position = Vector3.Zero; 50 public Vector3 Position = Vector3.Zero;
36 public Vector3 Scale = Vector3.Zero; 51 public Vector3 Scale = Vector3.Zero;
37 public Quaternion Rotation = Quaternion.Identity; 52 public Quaternion Rotation = Quaternion.Identity;
38 public bool GroupChange = false;
39 public Vector3 GroupPosition = Vector3.Zero; 53 public Vector3 GroupPosition = Vector3.Zero;
40 public Quaternion GroupRotation = Quaternion.Identity; 54 public Quaternion GroupRotation = Quaternion.Identity;
41 public Vector3 GroupScale = Vector3.Zero; 55 public Vector3 GroupScale = Vector3.Zero;
56 public DateTime LastUpdated = DateTime.Now;
57 public UndoType Type;
42 58
43 public UndoState(SceneObjectPart part) 59 public UndoState(SceneObjectPart part, UndoType type)
44 { 60 {
61 Type = type;
45 if (part != null) 62 if (part != null)
46 { 63 {
47 if (part.ParentID == 0) 64 if (part.ParentID == 0)
48 { 65 {
49 GroupScale = part.Shape.Scale; 66 GroupScale = part.ParentGroup.RootPart.Shape.Scale;
50 67
51 //FUBAR WARNING: Do NOT get the group's absoluteposition here 68 //FUBAR WARNING: Do NOT get the group's absoluteposition here
52 //or you'll experience a loop and/or a stack issue 69 //or you'll experience a loop and/or a stack issue
@@ -55,6 +72,7 @@ namespace OpenSim.Region.Framework.Scenes
55 Position = part.ParentGroup.RootPart.AbsolutePosition; 72 Position = part.ParentGroup.RootPart.AbsolutePosition;
56 Rotation = part.RotationOffset; 73 Rotation = part.RotationOffset;
57 Scale = part.Shape.Scale; 74 Scale = part.Shape.Scale;
75 LastUpdated = DateTime.Now;
58 } 76 }
59 else 77 else
60 { 78 {
@@ -67,10 +85,54 @@ namespace OpenSim.Region.Framework.Scenes
67 Position = part.OffsetPosition; 85 Position = part.OffsetPosition;
68 Rotation = part.RotationOffset; 86 Rotation = part.RotationOffset;
69 Scale = part.Shape.Scale; 87 Scale = part.Shape.Scale;
88 LastUpdated = DateTime.Now;
70 } 89 }
71 } 90 }
72 } 91 }
73 92 public void Merge(UndoState last)
93 {
94 if ((Type & UndoType.STATE_GROUP_POSITION) == 0 || ((last.Type & UndoType.STATE_GROUP_POSITION) >= (Type & UndoType.STATE_GROUP_POSITION)))
95 {
96 GroupPosition = last.GroupPosition;
97 Position = last.Position;
98 }
99 if ((Type & UndoType.STATE_GROUP_SCALE) == 0 || ((last.Type & UndoType.STATE_GROUP_SCALE) >= (Type & UndoType.STATE_GROUP_SCALE)))
100 {
101 Console.WriteLine("Setting groupscale to " + last.GroupScale.ToString());
102 GroupScale = last.GroupScale;
103 Scale = last.Scale;
104 }
105 if ((Type & UndoType.STATE_GROUP_ROTATION) == 0 || ((last.Type & UndoType.STATE_GROUP_ROTATION) >= (Type & UndoType.STATE_GROUP_ROTATION)))
106 {
107 GroupRotation = last.GroupRotation;
108 Rotation = last.Rotation;
109 }
110 if ((Type & UndoType.STATE_PRIM_POSITION) == 0 || ((last.Type & UndoType.STATE_PRIM_POSITION) >= (Type & UndoType.STATE_PRIM_POSITION)))
111 {
112 Position = last.Position;
113 }
114 if ((Type & UndoType.STATE_PRIM_SCALE) == 0 || ((last.Type & UndoType.STATE_PRIM_SCALE) >= (Type & UndoType.STATE_PRIM_SCALE)))
115 {
116 Scale = last.Scale;
117 }
118 if ((Type & UndoType.STATE_PRIM_ROTATION) == 0 || ((last.Type & UndoType.STATE_PRIM_ROTATION) >= (Type & UndoType.STATE_PRIM_ROTATION)))
119 {
120 Rotation = last.Rotation;
121 }
122 Type = Type | last.Type;
123 }
124 public bool Compare(UndoState undo)
125 {
126 if (undo == null || Position == null) return false;
127 if (undo.Position == Position && undo.Rotation == Rotation && undo.Scale == Scale && undo.GroupPosition == GroupPosition && undo.GroupScale == GroupScale && undo.GroupRotation == GroupRotation)
128 {
129 return true;
130 }
131 else
132 {
133 return false;
134 }
135 }
74 public bool Compare(SceneObjectPart part) 136 public bool Compare(SceneObjectPart part)
75 { 137 {
76 if (part != null) 138 if (part != null)
@@ -96,6 +158,14 @@ namespace OpenSim.Region.Framework.Scenes
96 158
97 public void PlaybackState(SceneObjectPart part) 159 public void PlaybackState(SceneObjectPart part)
98 { 160 {
161 bool GroupChange = false;
162 if ((Type & UndoType.STATE_GROUP_POSITION) != 0
163 || (Type & UndoType.STATE_GROUP_ROTATION) != 0
164 || (Type & UndoType.STATE_GROUP_SCALE) != 0)
165 {
166 GroupChange = true;
167 }
168
99 if (part != null) 169 if (part != null)
100 { 170 {
101 part.Undoing = true; 171 part.Undoing = true;
@@ -113,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
113 { 183 {
114 if (GroupChange) 184 if (GroupChange)
115 { 185 {
186 part.ParentGroup.RootPart.Undoing = true;
116 if (Position != Vector3.Zero) 187 if (Position != Vector3.Zero)
117 { 188 {
118 //Calculate the scale... 189 //Calculate the scale...
@@ -125,6 +196,7 @@ namespace OpenSim.Region.Framework.Scenes
125 part.ParentGroup.Rotation = GroupRotation; 196 part.ParentGroup.Rotation = GroupRotation;
126 197
127 } 198 }
199 part.ParentGroup.RootPart.Undoing = false;
128 } 200 }
129 else 201 else
130 { 202 {