aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs27
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs58
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs92
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs93
6 files changed, 217 insertions, 56 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 8414f8b..fa35bd8 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -11242,6 +11242,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11242 } 11242 }
11243 else 11243 else
11244 { 11244 {
11245 // Do this once since fetch parts creates a new array.
11246 SceneObjectPart[] parts = part.ParentGroup.Parts;
11247 for (int j = 0; j < parts.Length; j++)
11248 {
11249 part.StoreUndoState();
11250 parts[j].IgnoreUndoUpdate = true;
11251 }
11252
11245 // UUID partId = part.UUID; 11253 // UUID partId = part.UUID;
11246 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; 11254 UpdatePrimGroupRotation handlerUpdatePrimGroupRotation;
11247 11255
@@ -11257,6 +11265,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11257 handlerUpdatePrimSinglePosition(localId, pos1, this); 11265 handlerUpdatePrimSinglePosition(localId, pos1, this);
11258 } 11266 }
11259 break; 11267 break;
11268
11260 case 2: 11269 case 2:
11261 Quaternion rot1 = new Quaternion(block.Data, 0, true); 11270 Quaternion rot1 = new Quaternion(block.Data, 0, true);
11262 11271
@@ -11267,6 +11276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11267 handlerUpdatePrimSingleRotation(localId, rot1, this); 11276 handlerUpdatePrimSingleRotation(localId, rot1, this);
11268 } 11277 }
11269 break; 11278 break;
11279
11270 case 3: 11280 case 3:
11271 Vector3 rotPos = new Vector3(block.Data, 0); 11281 Vector3 rotPos = new Vector3(block.Data, 0);
11272 Quaternion rot2 = new Quaternion(block.Data, 12, true); 11282 Quaternion rot2 = new Quaternion(block.Data, 12, true);
@@ -11279,6 +11289,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11279 handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); 11289 handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this);
11280 } 11290 }
11281 break; 11291 break;
11292
11282 case 4: 11293 case 4:
11283 case 20: 11294 case 20:
11284 Vector3 scale4 = new Vector3(block.Data, 0); 11295 Vector3 scale4 = new Vector3(block.Data, 0);
@@ -11290,8 +11301,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11290 handlerUpdatePrimScale(localId, scale4, this); 11301 handlerUpdatePrimScale(localId, scale4, this);
11291 } 11302 }
11292 break; 11303 break;
11293 case 5:
11294 11304
11305 case 5:
11295 Vector3 scale1 = new Vector3(block.Data, 12); 11306 Vector3 scale1 = new Vector3(block.Data, 12);
11296 Vector3 pos11 = new Vector3(block.Data, 0); 11307 Vector3 pos11 = new Vector3(block.Data, 0);
11297 11308
@@ -11308,6 +11319,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11308 } 11319 }
11309 } 11320 }
11310 break; 11321 break;
11322
11311 case 9: 11323 case 9:
11312 Vector3 pos2 = new Vector3(block.Data, 0); 11324 Vector3 pos2 = new Vector3(block.Data, 0);
11313 11325
@@ -11315,10 +11327,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11315 11327
11316 if (handlerUpdateVector != null) 11328 if (handlerUpdateVector != null)
11317 { 11329 {
11318
11319 handlerUpdateVector(localId, pos2, this); 11330 handlerUpdateVector(localId, pos2, this);
11320 } 11331 }
11321 break; 11332 break;
11333
11322 case 10: 11334 case 10:
11323 Quaternion rot3 = new Quaternion(block.Data, 0, true); 11335 Quaternion rot3 = new Quaternion(block.Data, 0, true);
11324 11336
@@ -11329,6 +11341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11329 handlerUpdatePrimRotation(localId, rot3, this); 11341 handlerUpdatePrimRotation(localId, rot3, this);
11330 } 11342 }
11331 break; 11343 break;
11344
11332 case 11: 11345 case 11:
11333 Vector3 pos3 = new Vector3(block.Data, 0); 11346 Vector3 pos3 = new Vector3(block.Data, 0);
11334 Quaternion rot4 = new Quaternion(block.Data, 12, true); 11347 Quaternion rot4 = new Quaternion(block.Data, 12, true);
@@ -11352,6 +11365,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11352 handlerUpdatePrimGroupScale(localId, scale7, this); 11365 handlerUpdatePrimGroupScale(localId, scale7, this);
11353 } 11366 }
11354 break; 11367 break;
11368
11355 case 13: 11369 case 13:
11356 Vector3 scale2 = new Vector3(block.Data, 12); 11370 Vector3 scale2 = new Vector3(block.Data, 12);
11357 Vector3 pos4 = new Vector3(block.Data, 0); 11371 Vector3 pos4 = new Vector3(block.Data, 0);
@@ -11371,6 +11385,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11371 } 11385 }
11372 } 11386 }
11373 break; 11387 break;
11388
11374 case 29: 11389 case 29:
11375 Vector3 scale5 = new Vector3(block.Data, 12); 11390 Vector3 scale5 = new Vector3(block.Data, 12);
11376 Vector3 pos5 = new Vector3(block.Data, 0); 11391 Vector3 pos5 = new Vector3(block.Data, 0);
@@ -11388,6 +11403,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11388 } 11403 }
11389 } 11404 }
11390 break; 11405 break;
11406
11391 case 21: 11407 case 21:
11392 Vector3 scale6 = new Vector3(block.Data, 12); 11408 Vector3 scale6 = new Vector3(block.Data, 12);
11393 Vector3 pos6 = new Vector3(block.Data, 0); 11409 Vector3 pos6 = new Vector3(block.Data, 0);
@@ -11404,13 +11420,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11404 } 11420 }
11405 } 11421 }
11406 break; 11422 break;
11423
11407 default: 11424 default:
11408 m_log.Debug("[CLIENT] MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); 11425 m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type));
11409 break; 11426 break;
11410 } 11427 }
11428
11429 for (int j = 0; j < parts.Length; j++)
11430 parts[j].IgnoreUndoUpdate = false;
11411 } 11431 }
11412 } 11432 }
11413 } 11433 }
11434
11414 return true; 11435 return true;
11415 } 11436 }
11416 11437
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index bdb7f95..0a0bde8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -564,6 +564,7 @@ namespace OpenSim.Region.Framework.Scenes
564 part.Undo(); 564 part.Undo();
565 } 565 }
566 } 566 }
567
567 protected internal void HandleRedo(IClientAPI remoteClient, UUID primId) 568 protected internal void HandleRedo(IClientAPI remoteClient, UUID primId)
568 { 569 {
569 if (primId != UUID.Zero) 570 if (primId != UUID.Zero)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index ce5db5f..7254992 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1145,6 +1145,10 @@ namespace OpenSim.Region.Framework.Scenes
1145 1145
1146 public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) 1146 public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient)
1147 { 1147 {
1148// m_log.DebugFormat(
1149// "[SCENE OBJECT GROUP]: Processing OnGrabPart for {0} on {1} {2}, offsetPos {3}",
1150// remoteClient.Name, part.Name, part.LocalId, offsetPos);
1151
1148 part.StoreUndoState(); 1152 part.StoreUndoState();
1149 part.OnGrab(offsetPos, remoteClient); 1153 part.OnGrab(offsetPos, remoteClient);
1150 } 1154 }
@@ -2611,17 +2615,14 @@ namespace OpenSim.Region.Framework.Scenes
2611 2615
2612 #region Resize 2616 #region Resize
2613 2617
2614
2615 /// <summary> 2618 /// <summary>
2616 /// Resize the entire group of prims. 2619 /// Resize the entire group of prims.
2617 /// </summary> 2620 /// </summary>
2618 /// <param name="scale"></param> 2621 /// <param name="scale"></param>
2619 public void GroupResize(Vector3 scale) 2622 public void GroupResize(Vector3 scale)
2620 { 2623 {
2621// m_log.DebugFormat( 2624// m_log.DebugFormat(
2622// "[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);
2623
2624 RootPart.IgnoreUndoUpdate = true;
2625 2626
2626 scale.X = Math.Min(scale.X, Scene.m_maxNonphys); 2627 scale.X = Math.Min(scale.X, Scene.m_maxNonphys);
2627 scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); 2628 scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys);
@@ -2647,7 +2648,7 @@ namespace OpenSim.Region.Framework.Scenes
2647 SceneObjectPart obPart = parts[i]; 2648 SceneObjectPart obPart = parts[i];
2648 if (obPart.UUID != m_rootPart.UUID) 2649 if (obPart.UUID != m_rootPart.UUID)
2649 { 2650 {
2650 obPart.IgnoreUndoUpdate = true; 2651// obPart.IgnoreUndoUpdate = true;
2651 Vector3 oldSize = new Vector3(obPart.Scale); 2652 Vector3 oldSize = new Vector3(obPart.Scale);
2652 2653
2653 float f = 1.0f; 2654 float f = 1.0f;
@@ -2663,6 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes
2663 y *= a; 2664 y *= a;
2664 z *= a; 2665 z *= a;
2665 } 2666 }
2667
2666 if (oldSize.Y * y > m_scene.m_maxPhys) 2668 if (oldSize.Y * y > m_scene.m_maxPhys)
2667 { 2669 {
2668 f = m_scene.m_maxPhys / oldSize.Y; 2670 f = m_scene.m_maxPhys / oldSize.Y;
@@ -2671,6 +2673,7 @@ namespace OpenSim.Region.Framework.Scenes
2671 y *= a; 2673 y *= a;
2672 z *= a; 2674 z *= a;
2673 } 2675 }
2676
2674 if (oldSize.Z * z > m_scene.m_maxPhys) 2677 if (oldSize.Z * z > m_scene.m_maxPhys)
2675 { 2678 {
2676 f = m_scene.m_maxPhys / oldSize.Z; 2679 f = m_scene.m_maxPhys / oldSize.Z;
@@ -2690,6 +2693,7 @@ namespace OpenSim.Region.Framework.Scenes
2690 y *= a; 2693 y *= a;
2691 z *= a; 2694 z *= a;
2692 } 2695 }
2696
2693 if (oldSize.Y * y > m_scene.m_maxNonphys) 2697 if (oldSize.Y * y > m_scene.m_maxNonphys)
2694 { 2698 {
2695 f = m_scene.m_maxNonphys / oldSize.Y; 2699 f = m_scene.m_maxNonphys / oldSize.Y;
@@ -2698,6 +2702,7 @@ namespace OpenSim.Region.Framework.Scenes
2698 y *= a; 2702 y *= a;
2699 z *= a; 2703 z *= a;
2700 } 2704 }
2705
2701 if (oldSize.Z * z > m_scene.m_maxNonphys) 2706 if (oldSize.Z * z > m_scene.m_maxNonphys)
2702 { 2707 {
2703 f = m_scene.m_maxNonphys / oldSize.Z; 2708 f = m_scene.m_maxNonphys / oldSize.Z;
@@ -2708,7 +2713,7 @@ namespace OpenSim.Region.Framework.Scenes
2708 } 2713 }
2709 } 2714 }
2710 2715
2711 obPart.IgnoreUndoUpdate = false; 2716// obPart.IgnoreUndoUpdate = false;
2712 } 2717 }
2713 } 2718 }
2714 } 2719 }
@@ -2723,7 +2728,7 @@ namespace OpenSim.Region.Framework.Scenes
2723 for (int i = 0; i < parts.Length; i++) 2728 for (int i = 0; i < parts.Length; i++)
2724 { 2729 {
2725 SceneObjectPart obPart = parts[i]; 2730 SceneObjectPart obPart = parts[i];
2726 obPart.IgnoreUndoUpdate = true; 2731// obPart.IgnoreUndoUpdate = true;
2727 2732
2728 if (obPart.UUID != m_rootPart.UUID) 2733 if (obPart.UUID != m_rootPart.UUID)
2729 { 2734 {
@@ -2738,16 +2743,18 @@ namespace OpenSim.Region.Framework.Scenes
2738 newSize.Z *= z; 2743 newSize.Z *= z;
2739 2744
2740 obPart.Resize(newSize); 2745 obPart.Resize(newSize);
2746
2747 obPart.IgnoreUndoUpdate = true;
2741 obPart.UpdateOffSet(currentpos); 2748 obPart.UpdateOffSet(currentpos);
2749 obPart.IgnoreUndoUpdate = false;
2742 } 2750 }
2743 2751
2744 obPart.IgnoreUndoUpdate = false; 2752// obPart.IgnoreUndoUpdate = false;
2745 obPart.StoreUndoState(); 2753// obPart.StoreUndoState();
2746 } 2754 }
2747 2755
2748 RootPart.IgnoreUndoUpdate = false; 2756// m_log.DebugFormat(
2749 2757// "[SCENE OBJECT GROUP]: Finished group resizing {0} {1} to {2}", Name, LocalId, RootPart.Scale);
2750 RootPart.StoreUndoState();
2751 } 2758 }
2752 2759
2753 #endregion 2760 #endregion
@@ -2760,6 +2767,8 @@ namespace OpenSim.Region.Framework.Scenes
2760 /// <param name="pos"></param> 2767 /// <param name="pos"></param>
2761 public void UpdateGroupPosition(Vector3 pos) 2768 public void UpdateGroupPosition(Vector3 pos)
2762 { 2769 {
2770// m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos);
2771
2763 SceneObjectPart[] parts = m_parts.GetArray(); 2772 SceneObjectPart[] parts = m_parts.GetArray();
2764 for (int i = 0; i < parts.Length; i++) 2773 for (int i = 0; i < parts.Length; i++)
2765 parts[i].StoreUndoState(); 2774 parts[i].StoreUndoState();
@@ -2805,6 +2814,9 @@ namespace OpenSim.Region.Framework.Scenes
2805 2814
2806 if (part != null) 2815 if (part != null)
2807 { 2816 {
2817// m_log.DebugFormat(
2818// "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos);
2819
2808 if (part.UUID == m_rootPart.UUID) 2820 if (part.UUID == m_rootPart.UUID)
2809 { 2821 {
2810 UpdateRootPosition(pos); 2822 UpdateRootPosition(pos);
@@ -2824,6 +2836,9 @@ namespace OpenSim.Region.Framework.Scenes
2824 /// <param name="pos"></param> 2836 /// <param name="pos"></param>
2825 private void UpdateRootPosition(Vector3 pos) 2837 private void UpdateRootPosition(Vector3 pos)
2826 { 2838 {
2839// m_log.DebugFormat(
2840// "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos);
2841
2827 SceneObjectPart[] parts = m_parts.GetArray(); 2842 SceneObjectPart[] parts = m_parts.GetArray();
2828 for (int i = 0; i < parts.Length; i++) 2843 for (int i = 0; i < parts.Length; i++)
2829 parts[i].StoreUndoState(); 2844 parts[i].StoreUndoState();
@@ -2868,6 +2883,9 @@ namespace OpenSim.Region.Framework.Scenes
2868 /// <param name="rot"></param> 2883 /// <param name="rot"></param>
2869 public void UpdateGroupRotationR(Quaternion rot) 2884 public void UpdateGroupRotationR(Quaternion rot)
2870 { 2885 {
2886// m_log.DebugFormat(
2887// "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot);
2888
2871 SceneObjectPart[] parts = m_parts.GetArray(); 2889 SceneObjectPart[] parts = m_parts.GetArray();
2872 for (int i = 0; i < parts.Length; i++) 2890 for (int i = 0; i < parts.Length; i++)
2873 parts[i].StoreUndoState(); 2891 parts[i].StoreUndoState();
@@ -2892,6 +2910,9 @@ namespace OpenSim.Region.Framework.Scenes
2892 /// <param name="rot"></param> 2910 /// <param name="rot"></param>
2893 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) 2911 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
2894 { 2912 {
2913// m_log.DebugFormat(
2914// "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot);
2915
2895 SceneObjectPart[] parts = m_parts.GetArray(); 2916 SceneObjectPart[] parts = m_parts.GetArray();
2896 for (int i = 0; i < parts.Length; i++) 2917 for (int i = 0; i < parts.Length; i++)
2897 parts[i].StoreUndoState(); 2918 parts[i].StoreUndoState();
@@ -2926,6 +2947,9 @@ namespace OpenSim.Region.Framework.Scenes
2926 2947
2927 if (part != null) 2948 if (part != null)
2928 { 2949 {
2950// m_log.DebugFormat(
2951// "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot);
2952
2929 if (part.UUID == m_rootPart.UUID) 2953 if (part.UUID == m_rootPart.UUID)
2930 { 2954 {
2931 UpdateRootRotation(rot); 2955 UpdateRootRotation(rot);
@@ -2947,6 +2971,10 @@ namespace OpenSim.Region.Framework.Scenes
2947 SceneObjectPart part = GetChildPart(localID); 2971 SceneObjectPart part = GetChildPart(localID);
2948 if (part != null) 2972 if (part != null)
2949 { 2973 {
2974// m_log.DebugFormat(
2975// "[SCENE OBJECT GROUP]: Updating single position and rotation of {0} {1} to {2}",
2976// part.Name, part.LocalId, rot);
2977
2950 if (part.UUID == m_rootPart.UUID) 2978 if (part.UUID == m_rootPart.UUID)
2951 { 2979 {
2952 UpdateRootRotation(rot); 2980 UpdateRootRotation(rot);
@@ -2969,6 +2997,10 @@ namespace OpenSim.Region.Framework.Scenes
2969 /// <param name="rot"></param> 2997 /// <param name="rot"></param>
2970 private void UpdateRootRotation(Quaternion rot) 2998 private void UpdateRootRotation(Quaternion rot)
2971 { 2999 {
3000// m_log.DebugFormat(
3001// "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}",
3002// Name, LocalId, rot);
3003
2972 Quaternion axRot = rot; 3004 Quaternion axRot = rot;
2973 Quaternion oldParentRot = m_rootPart.RotationOffset; 3005 Quaternion oldParentRot = m_rootPart.RotationOffset;
2974 3006
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index a1200ee..aab83b8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1014,15 +1014,19 @@ namespace OpenSim.Region.Framework.Scenes
1014 get { return m_shape; } 1014 get { return m_shape; }
1015 set { m_shape = value; } 1015 set { m_shape = value; }
1016 } 1016 }
1017 1017
1018 /// <summary>
1019 /// Change the scale of this part.
1020 /// </summary>
1018 public Vector3 Scale 1021 public Vector3 Scale
1019 { 1022 {
1020 get { return m_shape.Scale; } 1023 get { return m_shape.Scale; }
1021 set 1024 set
1022 { 1025 {
1023 StoreUndoState();
1024 if (m_shape != null) 1026 if (m_shape != null)
1025 { 1027 {
1028 StoreUndoState();
1029
1026 m_shape.Scale = value; 1030 m_shape.Scale = value;
1027 1031
1028 PhysicsActor actor = PhysActor; 1032 PhysicsActor actor = PhysActor;
@@ -1033,11 +1037,16 @@ namespace OpenSim.Region.Framework.Scenes
1033 if (m_parentGroup.Scene.PhysicsScene != null) 1037 if (m_parentGroup.Scene.PhysicsScene != null)
1034 { 1038 {
1035 actor.Size = m_shape.Scale; 1039 actor.Size = m_shape.Scale;
1036 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 1040
1041 if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh)
1042 CheckSculptAndLoad();
1043 else
1044 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
1037 } 1045 }
1038 } 1046 }
1039 } 1047 }
1040 } 1048 }
1049
1041 TriggerScriptChangedEvent(Changed.SCALE); 1050 TriggerScriptChangedEvent(Changed.SCALE);
1042 } 1051 }
1043 } 1052 }
@@ -2827,8 +2836,12 @@ namespace OpenSim.Region.Framework.Scenes
2827 } 2836 }
2828 2837
2829 /// <summary> 2838 /// <summary>
2830 /// Resize this part. 2839 /// Set the scale of this part.
2831 /// </summary> 2840 /// </summary>
2841 /// <remarks>
2842 /// Unlike the scale property, this checks the new size against scene limits and schedules a full property
2843 /// update to viewers.
2844 /// </remarks>
2832 /// <param name="scale"></param> 2845 /// <param name="scale"></param>
2833 public void Resize(Vector3 scale) 2846 public void Resize(Vector3 scale)
2834 { 2847 {
@@ -2836,33 +2849,18 @@ namespace OpenSim.Region.Framework.Scenes
2836 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); 2849 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys);
2837 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); 2850 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys);
2838 2851
2839// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); 2852 if (PhysActor != null && PhysActor.IsPhysical)
2840
2841 StoreUndoState();
2842 m_shape.Scale = scale;
2843
2844 // If we're a mesh/sculpt, then we need to tell the physics engine about our new size. To do this, we
2845 // need to reinsert the sculpt data into the shape, since the physics engine deletes it when done to
2846 // save memory
2847 if (PhysActor != null)
2848 { 2853 {
2849 if (PhysActor.IsPhysical) 2854 scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys);
2850 { 2855 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys);
2851 scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); 2856 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys);
2852 scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); 2857 }
2853 scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys);
2854 }
2855 2858
2856 PhysActor.Size = scale; 2859// m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale);
2857 2860
2858 if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh) 2861 Scale = scale;
2859 CheckSculptAndLoad();
2860 else
2861 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
2862 }
2863 2862
2864 ParentGroup.HasGroupChanged = true; 2863 ParentGroup.HasGroupChanged = true;
2865 TriggerScriptChangedEvent(Changed.SCALE);
2866 ScheduleFullUpdate(); 2864 ScheduleFullUpdate();
2867 } 2865 }
2868 2866
@@ -3673,8 +3671,6 @@ namespace OpenSim.Region.Framework.Scenes
3673 { 3671 {
3674 if (m_parentGroup != null) 3672 if (m_parentGroup != null)
3675 { 3673 {
3676// m_log.DebugFormat("[SCENE OBJECT PART]: Storing undo state for {0} {1}", Name, LocalId);
3677
3678 lock (m_undo) 3674 lock (m_undo)
3679 { 3675 {
3680 if (m_undo.Count > 0) 3676 if (m_undo.Count > 0)
@@ -3683,15 +3679,29 @@ namespace OpenSim.Region.Framework.Scenes
3683 if (last != null) 3679 if (last != null)
3684 { 3680 {
3685 if (last.Compare(this)) 3681 if (last.Compare(this))
3682 {
3683// m_log.DebugFormat(
3684// "[SCENE OBJECT PART]: Not storing undo for {0} {1} since current state is same as last undo state, initial stack size {2}",
3685// Name, LocalId, m_undo.Count);
3686
3686 return; 3687 return;
3688 }
3687 } 3689 }
3688 } 3690 }
3689 3691
3692// m_log.DebugFormat(
3693// "[SCENE OBJECT PART]: Storing undo state for {0} {1}, initial stack size {2}",
3694// Name, LocalId, m_undo.Count);
3695
3690 if (m_parentGroup.GetSceneMaxUndo() > 0) 3696 if (m_parentGroup.GetSceneMaxUndo() > 0)
3691 { 3697 {
3692 UndoState nUndo = new UndoState(this); 3698 UndoState nUndo = new UndoState(this);
3693 3699
3694 m_undo.Push(nUndo); 3700 m_undo.Push(nUndo);
3701
3702// m_log.DebugFormat(
3703// "[SCENE OBJECT PART]: Stored undo state for {0} {1}, stack size now {2}",
3704// Name, LocalId, m_undo.Count);
3695 } 3705 }
3696 } 3706 }
3697 } 3707 }
@@ -3703,7 +3713,8 @@ namespace OpenSim.Region.Framework.Scenes
3703 } 3713 }
3704// else 3714// else
3705// { 3715// {
3706// m_log.DebugFormat("[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId); 3716// m_log.DebugFormat(
3717// "[SCENE OBJECT PART]: Ignoring undo store for {0} {1} since already undoing", Name, LocalId);
3707// } 3718// }
3708 } 3719 }
3709 3720
@@ -3721,10 +3732,12 @@ namespace OpenSim.Region.Framework.Scenes
3721 3732
3722 public void Undo() 3733 public void Undo()
3723 { 3734 {
3724// m_log.DebugFormat("[SCENE OBJECT PART]: Handling undo request for {0} {1}", Name, LocalId);
3725
3726 lock (m_undo) 3735 lock (m_undo)
3727 { 3736 {
3737// m_log.DebugFormat(
3738// "[SCENE OBJECT PART]: Handling undo request for {0} {1}, stack size {2}",
3739// Name, LocalId, m_undo.Count);
3740
3728 if (m_undo.Count > 0) 3741 if (m_undo.Count > 0)
3729 { 3742 {
3730 UndoState nUndo = null; 3743 UndoState nUndo = null;
@@ -3739,19 +3752,26 @@ namespace OpenSim.Region.Framework.Scenes
3739 if (goback != null) 3752 if (goback != null)
3740 { 3753 {
3741 goback.PlaybackState(this); 3754 goback.PlaybackState(this);
3755
3742 if (nUndo != null) 3756 if (nUndo != null)
3743 m_redo.Push(nUndo); 3757 m_redo.Push(nUndo);
3744 } 3758 }
3745 } 3759 }
3760
3761// m_log.DebugFormat(
3762// "[SCENE OBJECT PART]: Handled undo request for {0} {1}, stack size now {2}",
3763// Name, LocalId, m_undo.Count);
3746 } 3764 }
3747 } 3765 }
3748 3766
3749 public void Redo() 3767 public void Redo()
3750 { 3768 {
3751// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId);
3752
3753 lock (m_redo) 3769 lock (m_redo)
3754 { 3770 {
3771// m_log.DebugFormat(
3772// "[SCENE OBJECT PART]: Handling redo request for {0} {1}, stack size {2}",
3773// Name, LocalId, m_redo.Count);
3774
3755 if (m_parentGroup.GetSceneMaxUndo() > 0) 3775 if (m_parentGroup.GetSceneMaxUndo() > 0)
3756 { 3776 {
3757 UndoState nUndo = new UndoState(this); 3777 UndoState nUndo = new UndoState(this);
@@ -3763,11 +3783,17 @@ namespace OpenSim.Region.Framework.Scenes
3763 3783
3764 if (gofwd != null) 3784 if (gofwd != null)
3765 gofwd.PlayfwdState(this); 3785 gofwd.PlayfwdState(this);
3786
3787// m_log.DebugFormat(
3788// "[SCENE OBJECT PART]: Handled redo request for {0} {1}, stack size now {2}",
3789// Name, LocalId, m_redo.Count);
3766 } 3790 }
3767 } 3791 }
3768 3792
3769 public void ClearUndoState() 3793 public void ClearUndoState()
3770 { 3794 {
3795// m_log.DebugFormat("[SCENE OBJECT PART]: Clearing undo and redo stacks in {0} {1}", Name, LocalId);
3796
3771 lock (m_undo) 3797 lock (m_undo)
3772 { 3798 {
3773 m_undo.Clear(); 3799 m_undo.Clear();
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
index 6dbac3c..c4047ee 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
50 public void TestResizeSceneObject() 50 public void TestResizeSceneObject()
51 { 51 {
52 TestHelper.InMethod(); 52 TestHelper.InMethod();
53 //log4net.Config.XmlConfigurator.Configure(); 53// log4net.Config.XmlConfigurator.Configure();
54 54
55 Scene scene = SceneSetupHelpers.SetupScene(); 55 Scene scene = SceneSetupHelpers.SetupScene();
56 SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup; 56 SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup;
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index 55e407e..38bbeb0 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -25,6 +25,9 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Reflection;
30using log4net;
28using OpenMetaverse; 31using OpenMetaverse;
29using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
30 33
@@ -32,49 +35,80 @@ namespace OpenSim.Region.Framework.Scenes
32{ 35{
33 public class UndoState 36 public class UndoState
34 { 37 {
38// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39
35 public Vector3 Position = Vector3.Zero; 40 public Vector3 Position = Vector3.Zero;
36 public Vector3 Scale = Vector3.Zero; 41 public Vector3 Scale = Vector3.Zero;
37 public Quaternion Rotation = Quaternion.Identity; 42 public Quaternion Rotation = Quaternion.Identity;
38 43
44 /// <summary>
45 /// Constructor.
46 /// </summary>
47 /// <param name="part"></param>
39 public UndoState(SceneObjectPart part) 48 public UndoState(SceneObjectPart part)
40 { 49 {
41 if (part != null) 50 if (part != null)
42 { 51 {
43 if (part.ParentID == 0) 52 if (part.ParentID == 0)
44 { 53 {
54// m_log.DebugFormat(
55// "[UNDO STATE]: Storing undo position {0} for root part", part.ParentGroup.AbsolutePosition);
45 Position = part.ParentGroup.AbsolutePosition; 56 Position = part.ParentGroup.AbsolutePosition;
57
58// m_log.DebugFormat(
59// "[UNDO STATE]: Storing undo rotation {0} for root part", part.RotationOffset);
46 Rotation = part.RotationOffset; 60 Rotation = part.RotationOffset;
61
62// m_log.DebugFormat(
63// "[UNDO STATE]: Storing undo scale {0} for root part", part.Shape.Scale);
47 Scale = part.Shape.Scale; 64 Scale = part.Shape.Scale;
48 } 65 }
49 else 66 else
50 { 67 {
68// m_log.DebugFormat(
69// "[UNDO STATE]: Storing undo position {0} for child part", part.OffsetPosition);
51 Position = part.OffsetPosition; 70 Position = part.OffsetPosition;
71
72// m_log.DebugFormat(
73// "[UNDO STATE]: Storing undo rotation {0} for child part", part.RotationOffset);
52 Rotation = part.RotationOffset; 74 Rotation = part.RotationOffset;
75
76// m_log.DebugFormat(
77// "[UNDO STATE]: Storing undo scale {0} for child part", part.Shape.Scale);
53 Scale = part.Shape.Scale; 78 Scale = part.Shape.Scale;
54 } 79 }
55 } 80 }
56 } 81 }
57 82
83 /// <summary>
84 /// Compare the relevant state in the given part to this state.
85 /// </summary>
86 /// <param name="part"></param>
87 /// <returns>true if both the part's position, rotation and scale match those in this undo state. False otherwise.</returns>
58 public bool Compare(SceneObjectPart part) 88 public bool Compare(SceneObjectPart part)
59 { 89 {
60 if (part != null) 90 if (part != null)
61 { 91 {
62 if (part.ParentID == 0) 92 if (part.ParentID == 0)
63 { 93 {
64 if (Position == part.ParentGroup.AbsolutePosition && Rotation == part.ParentGroup.Rotation) 94 if (Position == part.ParentGroup.AbsolutePosition
95 && Rotation == part.RotationOffset
96 && Scale == part.Shape.Scale)
65 return true; 97 return true;
66 else 98 else
67 return false; 99 return false;
68 } 100 }
69 else 101 else
70 { 102 {
71 if (Position == part.OffsetPosition && Rotation == part.RotationOffset && Scale == part.Shape.Scale) 103 if (Position == part.OffsetPosition
104 && Rotation == part.RotationOffset
105 && Scale == part.Shape.Scale)
72 return true; 106 return true;
73 else 107 else
74 return false; 108 return false;
75
76 } 109 }
77 } 110 }
111
78 return false; 112 return false;
79 } 113 }
80 114
@@ -87,24 +121,64 @@ namespace OpenSim.Region.Framework.Scenes
87 if (part.ParentID == 0) 121 if (part.ParentID == 0)
88 { 122 {
89 if (Position != Vector3.Zero) 123 if (Position != Vector3.Zero)
124 {
125// m_log.DebugFormat(
126// "[UNDO STATE]: Undoing position {0} to {1} for root part {2} {3}",
127// part.ParentGroup.AbsolutePosition, Position, part.Name, part.LocalId);
128
90 part.ParentGroup.AbsolutePosition = Position; 129 part.ParentGroup.AbsolutePosition = Position;
130 }
131
132// m_log.DebugFormat(
133// "[UNDO STATE]: Undoing rotation {0} to {1} for root part {2} {3}",
134// part.RotationOffset, Rotation, part.Name, part.LocalId);
135
91 part.RotationOffset = Rotation; 136 part.RotationOffset = Rotation;
137
92 if (Scale != Vector3.Zero) 138 if (Scale != Vector3.Zero)
139 {
140// m_log.DebugFormat(
141// "[UNDO STATE]: Undoing scale {0} to {1} for root part {2} {3}",
142// part.Shape.Scale, Scale, part.Name, part.LocalId);
143
93 part.Resize(Scale); 144 part.Resize(Scale);
145 }
146
94 part.ParentGroup.ScheduleGroupForTerseUpdate(); 147 part.ParentGroup.ScheduleGroupForTerseUpdate();
95 } 148 }
96 else 149 else
97 { 150 {
98 if (Position != Vector3.Zero) 151 if (Position != Vector3.Zero)
152 {
153// m_log.DebugFormat(
154// "[UNDO STATE]: Undoing position {0} to {1} for child part {2} {3}",
155// part.OffsetPosition, Position, part.Name, part.LocalId);
156
99 part.OffsetPosition = Position; 157 part.OffsetPosition = Position;
158 }
159
160// m_log.DebugFormat(
161// "[UNDO STATE]: Undoing rotation {0} to {1} for child part {2} {3}",
162// part.RotationOffset, Rotation, part.Name, part.LocalId);
163
100 part.UpdateRotation(Rotation); 164 part.UpdateRotation(Rotation);
165
101 if (Scale != Vector3.Zero) 166 if (Scale != Vector3.Zero)
102 part.Resize(Scale); part.ScheduleTerseUpdate(); 167 {
168// m_log.DebugFormat(
169// "[UNDO STATE]: Undoing scale {0} to {1} for child part {2} {3}",
170// part.Shape.Scale, Scale, part.Name, part.LocalId);
171
172 part.Resize(Scale);
173 }
174
175 part.ScheduleTerseUpdate();
103 } 176 }
104 part.Undoing = false;
105 177
178 part.Undoing = false;
106 } 179 }
107 } 180 }
181
108 public void PlayfwdState(SceneObjectPart part) 182 public void PlayfwdState(SceneObjectPart part)
109 { 183 {
110 if (part != null) 184 if (part != null)
@@ -115,27 +189,34 @@ namespace OpenSim.Region.Framework.Scenes
115 { 189 {
116 if (Position != Vector3.Zero) 190 if (Position != Vector3.Zero)
117 part.ParentGroup.AbsolutePosition = Position; 191 part.ParentGroup.AbsolutePosition = Position;
192
118 if (Rotation != Quaternion.Identity) 193 if (Rotation != Quaternion.Identity)
119 part.UpdateRotation(Rotation); 194 part.UpdateRotation(Rotation);
195
120 if (Scale != Vector3.Zero) 196 if (Scale != Vector3.Zero)
121 part.Resize(Scale); 197 part.Resize(Scale);
198
122 part.ParentGroup.ScheduleGroupForTerseUpdate(); 199 part.ParentGroup.ScheduleGroupForTerseUpdate();
123 } 200 }
124 else 201 else
125 { 202 {
126 if (Position != Vector3.Zero) 203 if (Position != Vector3.Zero)
127 part.OffsetPosition = Position; 204 part.OffsetPosition = Position;
205
128 if (Rotation != Quaternion.Identity) 206 if (Rotation != Quaternion.Identity)
129 part.UpdateRotation(Rotation); 207 part.UpdateRotation(Rotation);
208
130 if (Scale != Vector3.Zero) 209 if (Scale != Vector3.Zero)
131 part.Resize(Scale); 210 part.Resize(Scale);
211
132 part.ScheduleTerseUpdate(); 212 part.ScheduleTerseUpdate();
133 } 213 }
134 part.Undoing = false;
135 214
215 part.Undoing = false;
136 } 216 }
137 } 217 }
138 } 218 }
219
139 public class LandUndoState 220 public class LandUndoState
140 { 221 {
141 public ITerrainModule m_terrainModule; 222 public ITerrainModule m_terrainModule;