diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 72 |
1 files changed, 27 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0760808..cce606a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -263,8 +263,8 @@ 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 readonly Stack<UndoState> m_undo = new Stack<UndoState>(5); | 266 | private Stack<UndoState> m_undo = new Stack<UndoState>(5); |
267 | private readonly Stack<UndoState> m_redo = new Stack<UndoState>(5); | 267 | private Stack<UndoState> m_redo = new Stack<UndoState>(5); |
268 | 268 | ||
269 | private bool m_passTouches; | 269 | private bool m_passTouches; |
270 | 270 | ||
@@ -1709,6 +1709,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1709 | dupe.Category = Category; | 1709 | dupe.Category = Category; |
1710 | dupe.m_rezzed = m_rezzed; | 1710 | dupe.m_rezzed = m_rezzed; |
1711 | 1711 | ||
1712 | dupe.m_undo = new Stack<UndoState>(5); | ||
1713 | dupe.m_redo = new Stack<UndoState>(5); | ||
1714 | dupe.IgnoreUndoUpdate = false; | ||
1715 | dupe.Undoing = false; | ||
1716 | |||
1712 | dupe.m_inventory = new SceneObjectPartInventory(dupe); | 1717 | dupe.m_inventory = new SceneObjectPartInventory(dupe); |
1713 | dupe.m_inventory.Items = (TaskInventoryDictionary)m_inventory.Items.Clone(); | 1718 | dupe.m_inventory.Items = (TaskInventoryDictionary)m_inventory.Items.Clone(); |
1714 | 1719 | ||
@@ -3659,61 +3664,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
3659 | 3664 | ||
3660 | public void StoreUndoState(bool forGroup) | 3665 | public void StoreUndoState(bool forGroup) |
3661 | { | 3666 | { |
3662 | if (!Undoing) | 3667 | if (!Undoing && !IgnoreUndoUpdate) // just to read better - undo is in progress, or suspended |
3663 | { | 3668 | { |
3664 | if (!IgnoreUndoUpdate) | 3669 | if (ParentGroup != null) |
3665 | { | 3670 | { |
3666 | if (ParentGroup != null) | 3671 | lock (m_undo) |
3667 | { | 3672 | { |
3668 | lock (m_undo) | 3673 | if (m_undo.Count > 0) |
3669 | { | 3674 | { |
3670 | if (m_undo.Count > 0) | 3675 | // see if we had a change |
3671 | { | ||
3672 | UndoState last = m_undo.Peek(); | ||
3673 | if (last != null) | ||
3674 | { | ||
3675 | // TODO: May need to fix for group comparison | ||
3676 | if (last.Compare(this)) | ||
3677 | { | ||
3678 | // m_log.DebugFormat( | ||
3679 | // "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}", | ||
3680 | // Name, LocalId, m_undo.Count); | ||
3681 | 3676 | ||
3682 | return; | 3677 | UndoState last = m_undo.Peek(); |
3683 | } | 3678 | if (last != null) |
3679 | { | ||
3680 | if (last.Compare(this, forGroup)) | ||
3681 | { | ||
3682 | return; | ||
3684 | } | 3683 | } |
3685 | } | 3684 | } |
3686 | 3685 | } | |
3687 | // m_log.DebugFormat( | ||
3688 | // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", | ||
3689 | // Name, LocalId, forGroup, m_undo.Count); | ||
3690 | |||
3691 | if (ParentGroup.GetSceneMaxUndo() > 0) | ||
3692 | { | ||
3693 | UndoState nUndo = new UndoState(this, forGroup); | ||
3694 | 3686 | ||
3695 | m_undo.Push(nUndo); | 3687 | if (ParentGroup.GetSceneMaxUndo() > 0) |
3688 | { | ||
3689 | UndoState nUndo = new UndoState(this, forGroup); | ||
3696 | 3690 | ||
3697 | if (m_redo.Count > 0) | 3691 | m_undo.Push(nUndo); |
3698 | m_redo.Clear(); | ||
3699 | 3692 | ||
3700 | // m_log.DebugFormat( | 3693 | if (m_redo.Count > 0) |
3701 | // "[SCENE OBJECT PART]: Stored undo state for {0} {1}, forGroup {2}, stack size now {3}", | 3694 | m_redo.Clear(); |
3702 | // Name, LocalId, forGroup, m_undo.Count); | ||
3703 | } | ||
3704 | } | 3695 | } |
3705 | } | 3696 | } |
3706 | } | 3697 | } |
3707 | // else | ||
3708 | // { | ||
3709 | // m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1}", Name, LocalId); | ||
3710 | // } | ||
3711 | } | 3698 | } |
3712 | // else | ||
3713 | // { | ||
3714 | // m_log.DebugFormat( | ||
3715 | // "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); | ||
3716 | // } | ||
3717 | } | 3699 | } |
3718 | 3700 | ||
3719 | /// <summary> | 3701 | /// <summary> |
@@ -3749,7 +3731,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3749 | nUndo = new UndoState(this, goback.ForGroup); | 3731 | nUndo = new UndoState(this, goback.ForGroup); |
3750 | } | 3732 | } |
3751 | 3733 | ||
3752 | goback.PlaybackState(this); | 3734 | goback.PlayState(this); |
3753 | 3735 | ||
3754 | if (nUndo != null) | 3736 | if (nUndo != null) |
3755 | m_redo.Push(nUndo); | 3737 | m_redo.Push(nUndo); |
@@ -3783,7 +3765,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3783 | m_undo.Push(nUndo); | 3765 | m_undo.Push(nUndo); |
3784 | } | 3766 | } |
3785 | 3767 | ||
3786 | gofwd.PlayfwdState(this); | 3768 | gofwd.PlayState(this); |
3787 | } | 3769 | } |
3788 | 3770 | ||
3789 | // m_log.DebugFormat( | 3771 | // m_log.DebugFormat( |