diff options
author | Tom Grimshaw | 2010-07-04 19:28:39 -0700 |
---|---|---|
committer | Tom Grimshaw | 2010-07-04 19:28:39 -0700 |
commit | 5b68343361cbd000a2f024b37797ec235abb7207 (patch) | |
tree | a8977cb2d9392c83081675f24f8043a3cc56ad73 /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |
parent | Correct positioning of timeout modifier in the SynchronousRestObjectRequester (diff) | |
download | opensim-SC-5b68343361cbd000a2f024b37797ec235abb7207.zip opensim-SC-5b68343361cbd000a2f024b37797ec235abb7207.tar.gz opensim-SC-5b68343361cbd000a2f024b37797ec235abb7207.tar.bz2 opensim-SC-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.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 61 |
1 files changed, 30 insertions, 31 deletions
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 | } |