aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-07-18 01:33:57 +0100
committerJustin Clark-Casey (justincc)2011-07-18 01:33:57 +0100
commite9a739f45fdc464b19ad520c3efcb202d8bd5458 (patch)
tree620e9ab9e4b2d09a958f74c7227af53fa0052bec
parentReplace ifs in SOG.GroupResize() with Math.Min() (diff)
downloadopensim-SC-e9a739f45fdc464b19ad520c3efcb202d8bd5458.zip
opensim-SC-e9a739f45fdc464b19ad520c3efcb202d8bd5458.tar.gz
opensim-SC-e9a739f45fdc464b19ad520c3efcb202d8bd5458.tar.bz2
opensim-SC-e9a739f45fdc464b19ad520c3efcb202d8bd5458.tar.xz
refactor: group all the undo/redo code in SOP into one place for easier code reading
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs121
1 files changed, 62 insertions, 59 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6b9607c..253326e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -414,7 +414,6 @@ namespace OpenSim.Region.Framework.Scenes
414 CreateSelected = true; 414 CreateSelected = true;
415 415
416 TrimPermissions(); 416 TrimPermissions();
417 //m_undo = new UndoStack<UndoState>(ParentGroup.GetSceneMaxUndo());
418 417
419 m_inventory = new SceneObjectPartInventory(this); 418 m_inventory = new SceneObjectPartInventory(this);
420 } 419 }
@@ -1621,19 +1620,6 @@ namespace OpenSim.Region.Framework.Scenes
1621 } 1620 }
1622 } 1621 }
1623 1622
1624 public void ClearUndoState()
1625 {
1626 lock (m_undo)
1627 {
1628 m_undo.Clear();
1629 }
1630 lock (m_redo)
1631 {
1632 m_redo.Clear();
1633 }
1634 StoreUndoState();
1635 }
1636
1637 public byte ConvertScriptUintToByte(uint indata) 1623 public byte ConvertScriptUintToByte(uint indata)
1638 { 1624 {
1639 byte outdata = (byte)TextureAnimFlags.NONE; 1625 byte outdata = (byte)TextureAnimFlags.NONE;
@@ -3721,6 +3707,68 @@ namespace OpenSim.Region.Framework.Scenes
3721// } 3707// }
3722 } 3708 }
3723 3709
3710 public void Undo()
3711 {
3712// m_log.DebugFormat("[SCENE OBJECT PART]: Handling undo request for {0} {1}", Name, LocalId);
3713
3714 lock (m_undo)
3715 {
3716 if (m_undo.Count > 0)
3717 {
3718 UndoState nUndo = null;
3719
3720 if (m_parentGroup.GetSceneMaxUndo() > 0)
3721 {
3722 nUndo = new UndoState(this);
3723 }
3724
3725 UndoState goback = m_undo.Pop();
3726
3727 if (goback != null)
3728 {
3729 goback.PlaybackState(this);
3730 if (nUndo != null)
3731 m_redo.Push(nUndo);
3732 }
3733 }
3734 }
3735 }
3736
3737 public void Redo()
3738 {
3739// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId);
3740
3741 lock (m_redo)
3742 {
3743 if (m_parentGroup.GetSceneMaxUndo() > 0)
3744 {
3745 UndoState nUndo = new UndoState(this);
3746
3747 m_undo.Push(nUndo);
3748 }
3749
3750 UndoState gofwd = m_redo.Pop();
3751
3752 if (gofwd != null)
3753 gofwd.PlayfwdState(this);
3754 }
3755 }
3756
3757 public void ClearUndoState()
3758 {
3759 lock (m_undo)
3760 {
3761 m_undo.Clear();
3762 }
3763
3764 lock (m_redo)
3765 {
3766 m_redo.Clear();
3767 }
3768
3769 StoreUndoState();
3770 }
3771
3724 public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) 3772 public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot)
3725 { 3773 {
3726 // In this case we're using a sphere with a radius of the largest dimension of the prim 3774 // In this case we're using a sphere with a radius of the largest dimension of the prim
@@ -4181,51 +4229,6 @@ namespace OpenSim.Region.Framework.Scenes
4181 _nextOwnerMask &= (uint)PermissionMask.All; 4229 _nextOwnerMask &= (uint)PermissionMask.All;
4182 } 4230 }
4183 4231
4184 public void Undo()
4185 {
4186 lock (m_undo)
4187 {
4188 if (m_undo.Count > 0)
4189 {
4190 UndoState nUndo = null;
4191
4192 if (m_parentGroup.GetSceneMaxUndo() > 0)
4193 {
4194 nUndo = new UndoState(this);
4195 }
4196
4197 UndoState goback = m_undo.Pop();
4198
4199 if (goback != null)
4200 {
4201 goback.PlaybackState(this);
4202 if (nUndo != null)
4203 m_redo.Push(nUndo);
4204 }
4205 }
4206 }
4207 }
4208
4209 public void Redo()
4210 {
4211// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId);
4212
4213 lock (m_redo)
4214 {
4215 if (m_parentGroup.GetSceneMaxUndo() > 0)
4216 {
4217 UndoState nUndo = new UndoState(this);
4218
4219 m_undo.Push(nUndo);
4220 }
4221
4222 UndoState gofwd = m_redo.Pop();
4223
4224 if (gofwd != null)
4225 gofwd.PlayfwdState(this);
4226 }
4227 }
4228
4229 public void UpdateExtraParam(ushort type, bool inUse, byte[] data) 4232 public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
4230 { 4233 {
4231 m_shape.ReadInUpdateExtraParam(type, inUse, data); 4234 m_shape.ReadInUpdateExtraParam(type, inUse, data);