aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs120
1 files changed, 24 insertions, 96 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6622495..f70b259 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -263,8 +263,7 @@ namespace OpenSim.Region.Framework.Scenes
263 private bool m_occupied; // KF if any av is sitting on this prim 263 private bool m_occupied; // KF if any av is sitting on this prim
264 private string m_text = String.Empty; 264 private string m_text = String.Empty;
265 private string m_touchName = String.Empty; 265 private string m_touchName = String.Empty;
266 private Stack<UndoState> m_undo = new Stack<UndoState>(5); 266 private UndoRedoState m_UndoRedo = new UndoRedoState(5);
267 private Stack<UndoState> m_redo = new Stack<UndoState>(5);
268 267
269 private bool m_passTouches; 268 private bool m_passTouches;
270 269
@@ -1709,8 +1708,8 @@ namespace OpenSim.Region.Framework.Scenes
1709 dupe.Category = Category; 1708 dupe.Category = Category;
1710 dupe.m_rezzed = m_rezzed; 1709 dupe.m_rezzed = m_rezzed;
1711 1710
1712 dupe.m_undo = new Stack<UndoState>(5); 1711 dupe.m_UndoRedo = new UndoRedoState(5);
1713 dupe.m_redo = new Stack<UndoState>(5); 1712
1714 dupe.IgnoreUndoUpdate = false; 1713 dupe.IgnoreUndoUpdate = false;
1715 dupe.Undoing = false; 1714 dupe.Undoing = false;
1716 1715
@@ -1944,6 +1943,7 @@ namespace OpenSim.Region.Framework.Scenes
1944 1943
1945 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 1944 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
1946 PhysActor.OnOutOfBounds += PhysicsOutOfBounds; 1945 PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
1946
1947 if (ParentID != 0 && ParentID != LocalId) 1947 if (ParentID != 0 && ParentID != LocalId)
1948 { 1948 {
1949 if (ParentGroup.RootPart.PhysActor != null) 1949 if (ParentGroup.RootPart.PhysActor != null)
@@ -3657,43 +3657,13 @@ namespace OpenSim.Region.Framework.Scenes
3657 //ParentGroup.ScheduleGroupForFullUpdate(); 3657 //ParentGroup.ScheduleGroupForFullUpdate();
3658 } 3658 }
3659 3659
3660 public void StoreUndoState() 3660 public void StoreUndoState(ObjectChangeWhat what)
3661 {
3662 StoreUndoState(false);
3663 }
3664
3665 public void StoreUndoState(bool forGroup)
3666 { 3661 {
3667 if (!Undoing && !IgnoreUndoUpdate) // just to read better - undo is in progress, or suspended 3662 lock (m_UndoRedo)
3668 { 3663 {
3669 if (ParentGroup != null) 3664 if (!Undoing && !IgnoreUndoUpdate && ParentGroup != null) // just to read better - undo is in progress, or suspended
3670 { 3665 {
3671 lock (m_undo) 3666 m_UndoRedo.StoreUndo(this, what);
3672 {
3673 if (m_undo.Count > 0)
3674 {
3675 // see if we had a change
3676
3677 UndoState last = m_undo.Peek();
3678 if (last != null)
3679 {
3680 if (last.Compare(this, forGroup))
3681 {
3682 return;
3683 }
3684 }
3685 }
3686
3687 if (ParentGroup.GetSceneMaxUndo() > 0)
3688 {
3689 UndoState nUndo = new UndoState(this, forGroup);
3690
3691 m_undo.Push(nUndo);
3692
3693 if (m_redo.Count > 0)
3694 m_redo.Clear();
3695 }
3696 }
3697 } 3667 }
3698 } 3668 }
3699 } 3669 }
@@ -3705,84 +3675,42 @@ namespace OpenSim.Region.Framework.Scenes
3705 { 3675 {
3706 get 3676 get
3707 { 3677 {
3708 lock (m_undo) 3678 lock (m_UndoRedo)
3709 return m_undo.Count; 3679 return m_UndoRedo.Count;
3710 } 3680 }
3711 } 3681 }
3712 3682
3713 public void Undo() 3683 public void Undo()
3714 { 3684 {
3715 lock (m_undo) 3685 lock (m_UndoRedo)
3716 { 3686 {
3717// m_log.DebugFormat( 3687 if (Undoing || ParentGroup == null)
3718// "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}", 3688 return;
3719// Name, LocalId, m_undo.Count);
3720
3721 if (m_undo.Count > 0)
3722 {
3723 UndoState goback = m_undo.Pop();
3724
3725 if (goback != null)
3726 {
3727 UndoState nUndo = null;
3728
3729 if (ParentGroup.GetSceneMaxUndo() > 0)
3730 {
3731 nUndo = new UndoState(this, goback.ForGroup);
3732 }
3733
3734 goback.PlayState(this);
3735
3736 if (nUndo != null)
3737 m_redo.Push(nUndo);
3738 }
3739 }
3740 3689
3741// m_log.DebugFormat( 3690 Undoing = true;
3742// "[SCENE OBJECT PART]: Handled undo request for {0} {1}, stack size now {2}", 3691 m_UndoRedo.Undo(this);
3743// Name, LocalId, m_undo.Count); 3692 Undoing = false;
3744 } 3693 }
3745 } 3694 }
3746 3695
3747 public void Redo() 3696 public void Redo()
3748 { 3697 {
3749 lock (m_undo) 3698 lock (m_UndoRedo)
3750 { 3699 {
3751// m_log.DebugFormat( 3700 if (Undoing || ParentGroup == null)
3752// "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}", 3701 return;
3753// Name, LocalId, m_redo.Count);
3754
3755 if (m_redo.Count > 0)
3756 {
3757 UndoState gofwd = m_redo.Pop();
3758
3759 if (gofwd != null)
3760 {
3761 if (ParentGroup.GetSceneMaxUndo() > 0)
3762 {
3763 UndoState nUndo = new UndoState(this, gofwd.ForGroup);
3764
3765 m_undo.Push(nUndo);
3766 }
3767
3768 gofwd.PlayState(this);
3769 }
3770 3702
3771// m_log.DebugFormat( 3703 Undoing = true;
3772// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}", 3704 m_UndoRedo.Redo(this);
3773// Name, LocalId, m_redo.Count); 3705 Undoing = false;
3774 }
3775 } 3706 }
3776 } 3707 }
3777 3708
3778 public void ClearUndoState() 3709 public void ClearUndoState()
3779 { 3710 {
3780// m_log.DebugFormat("[SCENE OBJECT PART]: Clearing undo and redo stacks in {0} {1}", Name, LocalId); 3711 lock (m_UndoRedo)
3781
3782 lock (m_undo)
3783 { 3712 {
3784 m_undo.Clear(); 3713 m_UndoRedo.Clear();
3785 m_redo.Clear();
3786 } 3714 }
3787 } 3715 }
3788 3716