aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-07-19 03:01:54 +0100
committerJustin Clark-Casey (justincc)2011-07-19 03:01:54 +0100
commit430a4aeba8e98b8285ea3ebdf264baf429a55e22 (patch)
tree68ca3695b7422f0d73aaa45555a77f2babae51d7 /OpenSim
parentremove undo state storage in a few places where it's pointless (diff)
downloadopensim-SC_OLD-430a4aeba8e98b8285ea3ebdf264baf429a55e22.zip
opensim-SC_OLD-430a4aeba8e98b8285ea3ebdf264baf429a55e22.tar.gz
opensim-SC_OLD-430a4aeba8e98b8285ea3ebdf264baf429a55e22.tar.bz2
opensim-SC_OLD-430a4aeba8e98b8285ea3ebdf264baf429a55e22.tar.xz
Fix undo for resizing linksets
This involves implementing a boolean in UndoState to signal whether the undo needs to be done for an entire group/linkset or just a single prim Resizing individual components of linksets is still dodgy. Resizing still has to be down twice, since for some reason the client is sending two multiobjectupdate packets on every resize except the very first. This applies to single prims and linksets. Need to look into this.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs37
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs42
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs24
4 files changed, 85 insertions, 41 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index fa35bd8..4c0b53c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -11220,8 +11220,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11220 protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet) 11220 protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet)
11221 { 11221 {
11222 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; 11222 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
11223 if (multipleupdate.AgentData.SessionID != SessionId) return false; 11223
11224 // m_log.Debug("new multi update packet " + multipleupdate.ToString()); 11224 if (multipleupdate.AgentData.SessionID != SessionId)
11225 return false;
11226
11227// m_log.DebugFormat(
11228// "[CLIENT]: Incoming MultipleObjectUpdatePacket contained {0} blocks", multipleupdate.ObjectData.Length);
11229
11225 Scene tScene = (Scene)m_scene; 11230 Scene tScene = (Scene)m_scene;
11226 11231
11227 for (int i = 0; i < multipleupdate.ObjectData.Length; i++) 11232 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
@@ -11242,15 +11247,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11242 } 11247 }
11243 else 11248 else
11244 { 11249 {
11245 // Do this once since fetch parts creates a new array. 11250// m_log.DebugFormat(
11246 SceneObjectPart[] parts = part.ParentGroup.Parts; 11251// "[CLIENT]: Processing block {0} type {1} for {2} {3}",
11247 for (int j = 0; j < parts.Length; j++) 11252// i, block.Type, part.Name, part.LocalId);
11248 { 11253
11249 part.StoreUndoState(); 11254// // Do this once since fetch parts creates a new array.
11250 parts[j].IgnoreUndoUpdate = true; 11255// SceneObjectPart[] parts = part.ParentGroup.Parts;
11251 } 11256// for (int j = 0; j < parts.Length; j++)
11257// {
11258// part.StoreUndoState();
11259// parts[j].IgnoreUndoUpdate = true;
11260// }
11252 11261
11253 // UUID partId = part.UUID;
11254 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; 11262 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation;
11255 11263
11256 switch (block.Type) 11264 switch (block.Type)
@@ -11394,6 +11402,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11394 if (handlerUpdatePrimGroupScale != null) 11402 if (handlerUpdatePrimGroupScale != null)
11395 { 11403 {
11396 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); 11404 // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
11405 part.StoreUndoState(true);
11406 part.IgnoreUndoUpdate = true;
11397 handlerUpdatePrimGroupScale(localId, scale5, this); 11407 handlerUpdatePrimGroupScale(localId, scale5, this);
11398 handlerUpdateVector = OnUpdatePrimGroupPosition; 11408 handlerUpdateVector = OnUpdatePrimGroupPosition;
11399 11409
@@ -11401,7 +11411,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11401 { 11411 {
11402 handlerUpdateVector(localId, pos5, this); 11412 handlerUpdateVector(localId, pos5, this);
11403 } 11413 }
11414
11415 part.IgnoreUndoUpdate = false;
11404 } 11416 }
11417
11405 break; 11418 break;
11406 11419
11407 case 21: 11420 case 21:
@@ -11426,8 +11439,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11426 break; 11439 break;
11427 } 11440 }
11428 11441
11429 for (int j = 0; j < parts.Length; j++) 11442// for (int j = 0; j < parts.Length; j++)
11430 parts[j].IgnoreUndoUpdate = false; 11443// parts[j].IgnoreUndoUpdate = false;
11431 } 11444 }
11432 } 11445 }
11433 } 11446 }
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