diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 42 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UndoState.cs | 24 |
3 files changed, 60 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7254992..3bbf76c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2624,6 +2624,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2624 | // m_log.DebugFormat( | 2624 | // m_log.DebugFormat( |
2625 | // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); | 2625 | // "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); |
2626 | 2626 | ||
2627 | RootPart.StoreUndoState(true); | ||
2628 | |||
2627 | scale.X = Math.Min(scale.X, Scene.m_maxNonphys); | 2629 | scale.X = Math.Min(scale.X, Scene.m_maxNonphys); |
2628 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); | 2630 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); |
2629 | scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); | 2631 | scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); |
@@ -2722,16 +2724,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
2722 | prevScale.X *= x; | 2724 | prevScale.X *= x; |
2723 | prevScale.Y *= y; | 2725 | prevScale.Y *= y; |
2724 | prevScale.Z *= z; | 2726 | prevScale.Z *= z; |
2727 | |||
2728 | // RootPart.IgnoreUndoUpdate = true; | ||
2725 | RootPart.Resize(prevScale); | 2729 | RootPart.Resize(prevScale); |
2730 | // RootPart.IgnoreUndoUpdate = false; | ||
2726 | 2731 | ||
2727 | parts = m_parts.GetArray(); | 2732 | parts = m_parts.GetArray(); |
2728 | for (int i = 0; i < parts.Length; i++) | 2733 | for (int i = 0; i < parts.Length; i++) |
2729 | { | 2734 | { |
2730 | SceneObjectPart obPart = parts[i]; | 2735 | SceneObjectPart obPart = parts[i]; |
2731 | // obPart.IgnoreUndoUpdate = true; | ||
2732 | 2736 | ||
2733 | if (obPart.UUID != m_rootPart.UUID) | 2737 | if (obPart.UUID != m_rootPart.UUID) |
2734 | { | 2738 | { |
2739 | obPart.IgnoreUndoUpdate = true; | ||
2740 | |||
2735 | Vector3 currentpos = new Vector3(obPart.OffsetPosition); | 2741 | Vector3 currentpos = new Vector3(obPart.OffsetPosition); |
2736 | currentpos.X *= x; | 2742 | currentpos.X *= x; |
2737 | currentpos.Y *= y; | 2743 | currentpos.Y *= y; |
@@ -2741,12 +2747,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2741 | newSize.X *= x; | 2747 | newSize.X *= x; |
2742 | newSize.Y *= y; | 2748 | newSize.Y *= y; |
2743 | newSize.Z *= z; | 2749 | newSize.Z *= z; |
2744 | |||
2745 | obPart.Resize(newSize); | ||
2746 | 2750 | ||
2747 | obPart.IgnoreUndoUpdate = true; | 2751 | obPart.Resize(newSize); |
2748 | obPart.UpdateOffSet(currentpos); | 2752 | obPart.UpdateOffSet(currentpos); |
2749 | obPart.IgnoreUndoUpdate = false; | 2753 | |
2754 | obPart.IgnoreUndoUpdate = false; | ||
2750 | } | 2755 | } |
2751 | 2756 | ||
2752 | // obPart.IgnoreUndoUpdate = false; | 2757 | // obPart.IgnoreUndoUpdate = false; |
@@ -2769,9 +2774,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2769 | { | 2774 | { |
2770 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos); | 2775 | // m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos); |
2771 | 2776 | ||
2772 | SceneObjectPart[] parts = m_parts.GetArray(); | 2777 | RootPart.StoreUndoState(true); |
2773 | for (int i = 0; i < parts.Length; i++) | 2778 | |
2774 | parts[i].StoreUndoState(); | 2779 | // SceneObjectPart[] parts = m_parts.GetArray(); |
2780 | // for (int i = 0; i < parts.Length; i++) | ||
2781 | // parts[i].StoreUndoState(); | ||
2775 | 2782 | ||
2776 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) | 2783 | if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) |
2777 | { | 2784 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 44d7ce3..5414cf2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3665,6 +3665,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3665 | 3665 | ||
3666 | public void StoreUndoState() | 3666 | public void StoreUndoState() |
3667 | { | 3667 | { |
3668 | StoreUndoState(false); | ||
3669 | } | ||
3670 | |||
3671 | public void StoreUndoState(bool forGroup) | ||
3672 | { | ||
3668 | if (!Undoing) | 3673 | if (!Undoing) |
3669 | { | 3674 | { |
3670 | if (!IgnoreUndoUpdate) | 3675 | if (!IgnoreUndoUpdate) |
@@ -3678,6 +3683,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3678 | UndoState last = m_undo.Peek(); | 3683 | UndoState last = m_undo.Peek(); |
3679 | if (last != null) | 3684 | if (last != null) |
3680 | { | 3685 | { |
3686 | // TODO: May need to fix for group comparison | ||
3681 | if (last.Compare(this)) | 3687 | if (last.Compare(this)) |
3682 | { | 3688 | { |
3683 | // m_log.DebugFormat( | 3689 | // m_log.DebugFormat( |
@@ -3690,12 +3696,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3690 | } | 3696 | } |
3691 | 3697 | ||
3692 | // m_log.DebugFormat( | 3698 | // m_log.DebugFormat( |
3693 | // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, initial stack size {2}", | 3699 | // "[SCENE OBJECT PART]: Storing undo state for {0} {1}, forGroup {2}, initial stack size {3}", |
3694 | // Name, LocalId, m_undo.Count); | 3700 | // Name, LocalId, forGroup, m_undo.Count); |
3695 | 3701 | ||
3696 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3702 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3697 | { | 3703 | { |
3698 | UndoState nUndo = new UndoState(this); | 3704 | UndoState nUndo = new UndoState(this, forGroup); |
3699 | 3705 | ||
3700 | m_undo.Push(nUndo); | 3706 | m_undo.Push(nUndo); |
3701 | 3707 | ||
@@ -3740,17 +3746,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3740 | 3746 | ||
3741 | if (m_undo.Count > 0) | 3747 | if (m_undo.Count > 0) |
3742 | { | 3748 | { |
3743 | UndoState nUndo = null; | ||
3744 | |||
3745 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
3746 | { | ||
3747 | nUndo = new UndoState(this); | ||
3748 | } | ||
3749 | |||
3750 | UndoState goback = m_undo.Pop(); | 3749 | UndoState goback = m_undo.Pop(); |
3751 | 3750 | ||
3752 | if (goback != null) | 3751 | if (goback != null) |
3753 | { | 3752 | { |
3753 | UndoState nUndo = null; | ||
3754 | |||
3755 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
3756 | { | ||
3757 | nUndo = new UndoState(this, goback.ForGroup); | ||
3758 | } | ||
3759 | |||
3754 | goback.PlaybackState(this); | 3760 | goback.PlaybackState(this); |
3755 | 3761 | ||
3756 | if (nUndo != null) | 3762 | if (nUndo != null) |
@@ -3772,17 +3778,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3772 | // "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}", | 3778 | // "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}", |
3773 | // Name, LocalId, m_redo.Count); | 3779 | // Name, LocalId, m_redo.Count); |
3774 | 3780 | ||
3775 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
3776 | { | ||
3777 | UndoState nUndo = new UndoState(this); | ||
3778 | |||
3779 | m_undo.Push(nUndo); | ||
3780 | } | ||
3781 | |||
3782 | UndoState gofwd = m_redo.Pop(); | 3781 | UndoState gofwd = m_redo.Pop(); |
3783 | 3782 | ||
3784 | if (gofwd != null) | 3783 | if (gofwd != null) |
3784 | { | ||
3785 | if (m_parentGroup.GetSceneMaxUndo() > 0) | ||
3786 | { | ||
3787 | UndoState nUndo = new UndoState(this, gofwd.ForGroup); | ||
3788 | |||
3789 | m_undo.Push(nUndo); | ||
3790 | } | ||
3791 | |||
3785 | gofwd.PlayfwdState(this); | 3792 | gofwd.PlayfwdState(this); |
3793 | } | ||
3786 | 3794 | ||
3787 | // m_log.DebugFormat( | 3795 | // m_log.DebugFormat( |
3788 | // "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}", | 3796 | // "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}", |
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 38bbeb0..1fa8ee2 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs | |||
@@ -42,10 +42,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
42 | public Quaternion Rotation = Quaternion.Identity; | 42 | public Quaternion Rotation = Quaternion.Identity; |
43 | 43 | ||
44 | /// <summary> | 44 | /// <summary> |
45 | /// Is this undo state for an entire group? | ||
46 | /// </summary> | ||
47 | public bool ForGroup; | ||
48 | |||
49 | /// <summary> | ||
45 | /// Constructor. | 50 | /// Constructor. |
46 | /// </summary> | 51 | /// </summary> |
47 | /// <param name="part"></param> | 52 | /// <param name="part"></param> |
48 | public UndoState(SceneObjectPart part) | 53 | /// <param name="forGroup">True if the undo is for an entire group</param> |
54 | public UndoState(SceneObjectPart part, bool forGroup) | ||
49 | { | 55 | { |
50 | if (part != null) | 56 | if (part != null) |
51 | { | 57 | { |
@@ -62,6 +68,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
62 | // m_log.DebugFormat( | 68 | // m_log.DebugFormat( |
63 | // "[UNDO STATE]: Storing undo scale {0} for root part", part.Shape.Scale); | 69 | // "[UNDO STATE]: Storing undo scale {0} for root part", part.Shape.Scale); |
64 | Scale = part.Shape.Scale; | 70 | Scale = part.Shape.Scale; |
71 | |||
72 | ForGroup = forGroup; | ||
65 | } | 73 | } |
66 | else | 74 | else |
67 | { | 75 | { |
@@ -141,7 +149,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
141 | // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", | 149 | // "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}", |
142 | // part.Shape.Scale, Scale, part.Name, part.LocalId); | 150 | // part.Shape.Scale, Scale, part.Name, part.LocalId); |
143 | 151 | ||
144 | part.Resize(Scale); | 152 | if (ForGroup) |
153 | part.ParentGroup.GroupResize(Scale); | ||
154 | else | ||
155 | part.Resize(Scale); | ||
145 | } | 156 | } |
146 | 157 | ||
147 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | 158 | part.ParentGroup.ScheduleGroupForTerseUpdate(); |
@@ -194,7 +205,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
194 | part.UpdateRotation(Rotation); | 205 | part.UpdateRotation(Rotation); |
195 | 206 | ||
196 | if (Scale != Vector3.Zero) | 207 | if (Scale != Vector3.Zero) |
197 | part.Resize(Scale); | 208 | { |
209 | if (ForGroup) | ||
210 | part.ParentGroup.GroupResize(Scale); | ||
211 | else | ||
212 | part.Resize(Scale); | ||
213 | } | ||
198 | 214 | ||
199 | part.ParentGroup.ScheduleGroupForTerseUpdate(); | 215 | part.ParentGroup.ScheduleGroupForTerseUpdate(); |
200 | } | 216 | } |
@@ -241,4 +257,4 @@ namespace OpenSim.Region.Framework.Scenes | |||
241 | m_terrainModule.UndoTerrain(m_terrainChannel); | 257 | m_terrainModule.UndoTerrain(m_terrainChannel); |
242 | } | 258 | } |
243 | } | 259 | } |
244 | } | 260 | } \ No newline at end of file |