aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs479
1 files changed, 235 insertions, 244 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index fa23fcd..b6fb5a4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -236,6 +236,38 @@ namespace OpenSim.Region.Framework.Scenes
236 get { return m_rootPart.RotationOffset; } 236 get { return m_rootPart.RotationOffset; }
237 } 237 }
238 238
239 public Vector3 GroupScale
240 {
241 get
242 {
243 Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
244 Vector3 maxScale = Vector3.Zero;
245 Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
246
247 SceneObjectPart[] parts = m_parts.GetArray();
248 for (int i = 0; i < parts.Length; i++)
249 {
250 SceneObjectPart part = parts[i];
251 Vector3 partscale = part.Scale;
252 Vector3 partoffset = part.OffsetPosition;
253
254 minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X;
255 minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y;
256 minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z;
257
258 maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X;
259 maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y;
260 maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z;
261 }
262
263 finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X;
264 finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y;
265 finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z;
266
267 return finalScale;
268 }
269 }
270
239 public UUID GroupID 271 public UUID GroupID
240 { 272 {
241 get { return m_rootPart.GroupID; } 273 get { return m_rootPart.GroupID; }
@@ -584,7 +616,7 @@ namespace OpenSim.Region.Framework.Scenes
584 part.ParentID = m_rootPart.LocalId; 616 part.ParentID = m_rootPart.LocalId;
585 //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); 617 //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID);
586 } 618 }
587 619
588 ApplyPhysics(m_scene.m_physicalPrim); 620 ApplyPhysics(m_scene.m_physicalPrim);
589 621
590 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled 622 // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
@@ -592,34 +624,6 @@ namespace OpenSim.Region.Framework.Scenes
592 //ScheduleGroupForFullUpdate(); 624 //ScheduleGroupForFullUpdate();
593 } 625 }
594 626
595 public Vector3 GroupScale()
596 {
597 Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
598 Vector3 maxScale = Vector3.Zero;
599 Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
600
601 SceneObjectPart[] parts = m_parts.GetArray();
602 for (int i = 0; i < parts.Length; i++)
603 {
604 SceneObjectPart part = parts[i];
605 Vector3 partscale = part.Scale;
606 Vector3 partoffset = part.OffsetPosition;
607
608 minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X;
609 minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y;
610 minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z;
611
612 maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X;
613 maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y;
614 maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z;
615 }
616
617 finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X;
618 finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y;
619 finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z;
620 return finalScale;
621
622 }
623 public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters) 627 public EntityIntersection TestIntersection(Ray hRay, bool frontFacesOnly, bool faceCenters)
624 { 628 {
625 // We got a request from the inner_scene to raytrace along the Ray hRay 629 // We got a request from the inner_scene to raytrace along the Ray hRay
@@ -1141,6 +1145,10 @@ namespace OpenSim.Region.Framework.Scenes
1141 1145
1142 public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient) 1146 public virtual void OnGrabPart(SceneObjectPart part, Vector3 offsetPos, IClientAPI remoteClient)
1143 { 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
1144 part.StoreUndoState(); 1152 part.StoreUndoState();
1145 part.OnGrab(offsetPos, remoteClient); 1153 part.OnGrab(offsetPos, remoteClient);
1146 } 1154 }
@@ -1463,17 +1471,17 @@ namespace OpenSim.Region.Framework.Scenes
1463 // Need to duplicate the physics actor as well 1471 // Need to duplicate the physics actor as well
1464 if (part.PhysActor != null && userExposed) 1472 if (part.PhysActor != null && userExposed)
1465 { 1473 {
1466 PrimitiveBaseShape pbs = part.Shape; 1474 PrimitiveBaseShape pbs = newPart.Shape;
1467 1475
1468 newPart.PhysActor 1476 newPart.PhysActor
1469 = m_scene.PhysicsScene.AddPrimShape( 1477 = m_scene.PhysicsScene.AddPrimShape(
1470 part.LocalId, 1478 string.Format("{0}/{1}", newPart.Name, newPart.UUID),
1471 string.Format("{0}/{1}", part.Name, part.UUID),
1472 pbs, 1479 pbs,
1473 part.AbsolutePosition, 1480 newPart.AbsolutePosition,
1474 part.Scale, 1481 newPart.Scale,
1475 part.RotationOffset, 1482 newPart.RotationOffset,
1476 part.PhysActor.IsPhysical); 1483 part.PhysActor.IsPhysical,
1484 newPart.LocalId);
1477 1485
1478 newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); 1486 newPart.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
1479 } 1487 }
@@ -2608,195 +2616,150 @@ namespace OpenSim.Region.Framework.Scenes
2608 #region Resize 2616 #region Resize
2609 2617
2610 /// <summary> 2618 /// <summary>
2611 /// Resize the given part 2619 /// Resize the entire group of prims.
2612 /// </summary> 2620 /// </summary>
2613 /// <param name="scale"></param> 2621 /// <param name="scale"></param>
2614 /// <param name="localID"></param> 2622 public void GroupResize(Vector3 scale)
2615 public void Resize(Vector3 scale, uint localID)
2616 { 2623 {
2617 if (scale.X > m_scene.m_maxNonphys) 2624// m_log.DebugFormat(
2618 scale.X = m_scene.m_maxNonphys; 2625// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale);
2619 if (scale.Y > m_scene.m_maxNonphys)
2620 scale.Y = m_scene.m_maxNonphys;
2621 if (scale.Z > m_scene.m_maxNonphys)
2622 scale.Z = m_scene.m_maxNonphys;
2623 2626
2624 SceneObjectPart part = GetChildPart(localID); 2627 RootPart.StoreUndoState(true);
2625 if (part != null)
2626 {
2627 part.Resize(scale);
2628 if (part.PhysActor != null)
2629 {
2630 if (part.PhysActor.IsPhysical)
2631 {
2632 if (scale.X > m_scene.m_maxPhys)
2633 scale.X = m_scene.m_maxPhys;
2634 if (scale.Y > m_scene.m_maxPhys)
2635 scale.Y = m_scene.m_maxPhys;
2636 if (scale.Z > m_scene.m_maxPhys)
2637 scale.Z = m_scene.m_maxPhys;
2638 }
2639 part.PhysActor.Size = scale;
2640 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor);
2641 }
2642 //if (part.UUID != m_rootPart.UUID)
2643 2628
2644 HasGroupChanged = true; 2629 scale.X = Math.Min(scale.X, Scene.m_maxNonphys);
2645 part.TriggerScriptChangedEvent(Changed.SCALE); 2630 scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys);
2646 ScheduleGroupForFullUpdate(); 2631 scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys);
2647 2632
2648 //if (part.UUID == m_rootPart.UUID) 2633 if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical)
2649 //{ 2634 {
2650 //if (m_rootPart.PhysActor != null) 2635 scale.X = Math.Min(scale.X, Scene.m_maxPhys);
2651 //{ 2636 scale.Y = Math.Min(scale.Y, Scene.m_maxPhys);
2652 //m_rootPart.PhysActor.Size = 2637 scale.Z = Math.Min(scale.Z, Scene.m_maxPhys);
2653 //new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z);
2654 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
2655 //}
2656 //}
2657 } 2638 }
2658 }
2659 2639
2660 public void GroupResize(Vector3 scale, uint localID) 2640 float x = (scale.X / RootPart.Scale.X);
2661 { 2641 float y = (scale.Y / RootPart.Scale.Y);
2662 SceneObjectPart part = GetChildPart(localID); 2642 float z = (scale.Z / RootPart.Scale.Z);
2663 if (part != null)
2664 {
2665 part.IgnoreUndoUpdate = true;
2666 if (scale.X > m_scene.m_maxNonphys)
2667 scale.X = m_scene.m_maxNonphys;
2668 if (scale.Y > m_scene.m_maxNonphys)
2669 scale.Y = m_scene.m_maxNonphys;
2670 if (scale.Z > m_scene.m_maxNonphys)
2671 scale.Z = m_scene.m_maxNonphys;
2672 if (part.PhysActor != null && part.PhysActor.IsPhysical)
2673 {
2674 if (scale.X > m_scene.m_maxPhys)
2675 scale.X = m_scene.m_maxPhys;
2676 if (scale.Y > m_scene.m_maxPhys)
2677 scale.Y = m_scene.m_maxPhys;
2678 if (scale.Z > m_scene.m_maxPhys)
2679 scale.Z = m_scene.m_maxPhys;
2680 }
2681 float x = (scale.X / part.Scale.X);
2682 float y = (scale.Y / part.Scale.Y);
2683 float z = (scale.Z / part.Scale.Z);
2684 2643
2685 SceneObjectPart[] parts; 2644 SceneObjectPart[] parts;
2686 if (x > 1.0f || y > 1.0f || z > 1.0f) 2645 if (x > 1.0f || y > 1.0f || z > 1.0f)
2646 {
2647 parts = m_parts.GetArray();
2648 for (int i = 0; i < parts.Length; i++)
2687 { 2649 {
2688 parts = m_parts.GetArray(); 2650 SceneObjectPart obPart = parts[i];
2689 for (int i = 0; i < parts.Length; i++) 2651 if (obPart.UUID != m_rootPart.UUID)
2690 { 2652 {
2691 SceneObjectPart obPart = parts[i]; 2653// obPart.IgnoreUndoUpdate = true;
2692 if (obPart.UUID != m_rootPart.UUID) 2654 Vector3 oldSize = new Vector3(obPart.Scale);
2655
2656 float f = 1.0f;
2657 float a = 1.0f;
2658
2659 if (RootPart.PhysActor != null && RootPart.PhysActor.IsPhysical)
2693 { 2660 {
2694 obPart.IgnoreUndoUpdate = true; 2661 if (oldSize.X * x > m_scene.m_maxPhys)
2695 Vector3 oldSize = new Vector3(obPart.Scale); 2662 {
2663 f = m_scene.m_maxPhys / oldSize.X;
2664 a = f / x;
2665 x *= a;
2666 y *= a;
2667 z *= a;
2668 }
2696 2669
2697 float f = 1.0f; 2670 if (oldSize.Y * y > m_scene.m_maxPhys)
2698 float a = 1.0f; 2671 {
2672 f = m_scene.m_maxPhys / oldSize.Y;
2673 a = f / y;
2674 x *= a;
2675 y *= a;
2676 z *= a;
2677 }
2699 2678
2700 if (part.PhysActor != null && part.PhysActor.IsPhysical) 2679 if (oldSize.Z * z > m_scene.m_maxPhys)
2701 { 2680 {
2702 if (oldSize.X * x > m_scene.m_maxPhys) 2681 f = m_scene.m_maxPhys / oldSize.Z;
2703 { 2682 a = f / z;
2704 f = m_scene.m_maxPhys / oldSize.X; 2683 x *= a;
2705 a = f / x; 2684 y *= a;
2706 x *= a; 2685 z *= a;
2707 y *= a; 2686 }
2708 z *= a; 2687 }
2709 } 2688 else
2710 if (oldSize.Y * y > m_scene.m_maxPhys) 2689 {
2711 { 2690 if (oldSize.X * x > m_scene.m_maxNonphys)
2712 f = m_scene.m_maxPhys / oldSize.Y; 2691 {
2713 a = f / y; 2692 f = m_scene.m_maxNonphys / oldSize.X;
2714 x *= a; 2693 a = f / x;
2715 y *= a; 2694 x *= a;
2716 z *= a; 2695 y *= a;
2717 } 2696 z *= a;
2718 if (oldSize.Z * z > m_scene.m_maxPhys)
2719 {
2720 f = m_scene.m_maxPhys / oldSize.Z;
2721 a = f / z;
2722 x *= a;
2723 y *= a;
2724 z *= a;
2725 }
2726 } 2697 }
2727 else 2698
2699 if (oldSize.Y * y > m_scene.m_maxNonphys)
2728 { 2700 {
2729 if (oldSize.X * x > m_scene.m_maxNonphys) 2701 f = m_scene.m_maxNonphys / oldSize.Y;
2730 { 2702 a = f / y;
2731 f = m_scene.m_maxNonphys / oldSize.X; 2703 x *= a;
2732 a = f / x; 2704 y *= a;
2733 x *= a; 2705 z *= a;
2734 y *= a; 2706 }
2735 z *= a; 2707
2736 } 2708 if (oldSize.Z * z > m_scene.m_maxNonphys)
2737 if (oldSize.Y * y > m_scene.m_maxNonphys) 2709 {
2738 { 2710 f = m_scene.m_maxNonphys / oldSize.Z;
2739 f = m_scene.m_maxNonphys / oldSize.Y; 2711 a = f / z;
2740 a = f / y; 2712 x *= a;
2741 x *= a; 2713 y *= a;
2742 y *= a; 2714 z *= a;
2743 z *= a;
2744 }
2745 if (oldSize.Z * z > m_scene.m_maxNonphys)
2746 {
2747 f = m_scene.m_maxNonphys / oldSize.Z;
2748 a = f / z;
2749 x *= a;
2750 y *= a;
2751 z *= a;
2752 }
2753 } 2715 }
2754 obPart.IgnoreUndoUpdate = false;
2755 obPart.StoreUndoState();
2756 } 2716 }
2717
2718// obPart.IgnoreUndoUpdate = false;
2757 } 2719 }
2758 } 2720 }
2721 }
2759 2722
2760 Vector3 prevScale = part.Scale; 2723 Vector3 prevScale = RootPart.Scale;
2761 prevScale.X *= x; 2724 prevScale.X *= x;
2762 prevScale.Y *= y; 2725 prevScale.Y *= y;
2763 prevScale.Z *= z; 2726 prevScale.Z *= z;
2764 part.Resize(prevScale);
2765 2727
2766 parts = m_parts.GetArray(); 2728// RootPart.IgnoreUndoUpdate = true;
2767 for (int i = 0; i < parts.Length; i++) 2729 RootPart.Resize(prevScale);
2730// RootPart.IgnoreUndoUpdate = false;
2731
2732 parts = m_parts.GetArray();
2733 for (int i = 0; i < parts.Length; i++)
2734 {
2735 SceneObjectPart obPart = parts[i];
2736
2737 if (obPart.UUID != m_rootPart.UUID)
2768 { 2738 {
2769 SceneObjectPart obPart = parts[i];
2770 obPart.IgnoreUndoUpdate = true; 2739 obPart.IgnoreUndoUpdate = true;
2771 if (obPart.UUID != m_rootPart.UUID)
2772 {
2773 Vector3 currentpos = new Vector3(obPart.OffsetPosition);
2774 currentpos.X *= x;
2775 currentpos.Y *= y;
2776 currentpos.Z *= z;
2777 Vector3 newSize = new Vector3(obPart.Scale);
2778 newSize.X *= x;
2779 newSize.Y *= y;
2780 newSize.Z *= z;
2781 obPart.Resize(newSize);
2782 obPart.UpdateOffSet(currentpos);
2783 }
2784 obPart.IgnoreUndoUpdate = false;
2785 obPart.StoreUndoState();
2786 }
2787 2740
2788 if (part.PhysActor != null) 2741 Vector3 currentpos = new Vector3(obPart.OffsetPosition);
2789 { 2742 currentpos.X *= x;
2790 part.PhysActor.Size = prevScale; 2743 currentpos.Y *= y;
2791 m_scene.PhysicsScene.AddPhysicsActorTaint(part.PhysActor); 2744 currentpos.Z *= z;
2745
2746 Vector3 newSize = new Vector3(obPart.Scale);
2747 newSize.X *= x;
2748 newSize.Y *= y;
2749 newSize.Z *= z;
2750
2751 obPart.Resize(newSize);
2752 obPart.UpdateOffSet(currentpos);
2753
2754 obPart.IgnoreUndoUpdate = false;
2792 } 2755 }
2793 2756
2794 part.IgnoreUndoUpdate = false; 2757// obPart.IgnoreUndoUpdate = false;
2795 part.StoreUndoState(); 2758// obPart.StoreUndoState();
2796 HasGroupChanged = true;
2797 m_rootPart.TriggerScriptChangedEvent(Changed.SCALE);
2798 ScheduleGroupForTerseUpdate();
2799 } 2759 }
2760
2761// m_log.DebugFormat(
2762// "[SCENE OBJECT GROUP]: Finished group resizing {0} {1} to {2}", Name, LocalId, RootPart.Scale);
2800 } 2763 }
2801 2764
2802 #endregion 2765 #endregion
@@ -2809,9 +2772,13 @@ namespace OpenSim.Region.Framework.Scenes
2809 /// <param name="pos"></param> 2772 /// <param name="pos"></param>
2810 public void UpdateGroupPosition(Vector3 pos) 2773 public void UpdateGroupPosition(Vector3 pos)
2811 { 2774 {
2812 SceneObjectPart[] parts = m_parts.GetArray(); 2775// m_log.DebugFormat("[SCENE OBJECT GROUP]: Updating group position on {0} {1} to {2}", Name, LocalId, pos);
2813 for (int i = 0; i < parts.Length; i++) 2776
2814 parts[i].StoreUndoState(); 2777 RootPart.StoreUndoState(true);
2778
2779// SceneObjectPart[] parts = m_parts.GetArray();
2780// for (int i = 0; i < parts.Length; i++)
2781// parts[i].StoreUndoState();
2815 2782
2816 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 2783 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
2817 { 2784 {
@@ -2848,12 +2815,18 @@ namespace OpenSim.Region.Framework.Scenes
2848 { 2815 {
2849 SceneObjectPart part = GetChildPart(localID); 2816 SceneObjectPart part = GetChildPart(localID);
2850 2817
2851 SceneObjectPart[] parts = m_parts.GetArray(); 2818// SceneObjectPart[] parts = m_parts.GetArray();
2852 for (int i = 0; i < parts.Length; i++) 2819// for (int i = 0; i < parts.Length; i++)
2853 parts[i].StoreUndoState(); 2820// parts[i].StoreUndoState();
2854 2821
2855 if (part != null) 2822 if (part != null)
2856 { 2823 {
2824// m_log.DebugFormat(
2825// "[SCENE OBJECT GROUP]: Updating single position of {0} {1} to {2}", part.Name, part.LocalId, pos);
2826
2827 part.StoreUndoState(false);
2828 part.IgnoreUndoUpdate = true;
2829
2857 if (part.UUID == m_rootPart.UUID) 2830 if (part.UUID == m_rootPart.UUID)
2858 { 2831 {
2859 UpdateRootPosition(pos); 2832 UpdateRootPosition(pos);
@@ -2864,18 +2837,22 @@ namespace OpenSim.Region.Framework.Scenes
2864 } 2837 }
2865 2838
2866 HasGroupChanged = true; 2839 HasGroupChanged = true;
2840 part.IgnoreUndoUpdate = false;
2867 } 2841 }
2868 } 2842 }
2869 2843
2870 /// <summary> 2844 /// <summary>
2871 /// 2845 /// Update just the root prim position in a linkset
2872 /// </summary> 2846 /// </summary>
2873 /// <param name="pos"></param> 2847 /// <param name="pos"></param>
2874 private void UpdateRootPosition(Vector3 pos) 2848 public void UpdateRootPosition(Vector3 pos)
2875 { 2849 {
2876 SceneObjectPart[] parts = m_parts.GetArray(); 2850// m_log.DebugFormat(
2877 for (int i = 0; i < parts.Length; i++) 2851// "[SCENE OBJECT GROUP]: Updating root position of {0} {1} to {2}", Name, LocalId, pos);
2878 parts[i].StoreUndoState(); 2852
2853// SceneObjectPart[] parts = m_parts.GetArray();
2854// for (int i = 0; i < parts.Length; i++)
2855// parts[i].StoreUndoState();
2879 2856
2880 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); 2857 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
2881 Vector3 oldPos = 2858 Vector3 oldPos =
@@ -2888,7 +2865,7 @@ namespace OpenSim.Region.Framework.Scenes
2888 axDiff *= Quaternion.Inverse(partRotation); 2865 axDiff *= Quaternion.Inverse(partRotation);
2889 diff = axDiff; 2866 diff = axDiff;
2890 2867
2891 parts = m_parts.GetArray(); 2868 SceneObjectPart[] parts = m_parts.GetArray();
2892 for (int i = 0; i < parts.Length; i++) 2869 for (int i = 0; i < parts.Length; i++)
2893 { 2870 {
2894 SceneObjectPart obPart = parts[i]; 2871 SceneObjectPart obPart = parts[i];
@@ -2917,9 +2894,14 @@ namespace OpenSim.Region.Framework.Scenes
2917 /// <param name="rot"></param> 2894 /// <param name="rot"></param>
2918 public void UpdateGroupRotationR(Quaternion rot) 2895 public void UpdateGroupRotationR(Quaternion rot)
2919 { 2896 {
2920 SceneObjectPart[] parts = m_parts.GetArray(); 2897// m_log.DebugFormat(
2921 for (int i = 0; i < parts.Length; i++) 2898// "[SCENE OBJECT GROUP]: Updating group rotation R of {0} {1} to {2}", Name, LocalId, rot);
2922 parts[i].StoreUndoState(); 2899
2900// SceneObjectPart[] parts = m_parts.GetArray();
2901// for (int i = 0; i < parts.Length; i++)
2902// parts[i].StoreUndoState();
2903
2904 m_rootPart.StoreUndoState(true);
2923 2905
2924 m_rootPart.UpdateRotation(rot); 2906 m_rootPart.UpdateRotation(rot);
2925 2907
@@ -2941,9 +2923,15 @@ namespace OpenSim.Region.Framework.Scenes
2941 /// <param name="rot"></param> 2923 /// <param name="rot"></param>
2942 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot) 2924 public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
2943 { 2925 {
2944 SceneObjectPart[] parts = m_parts.GetArray(); 2926// m_log.DebugFormat(
2945 for (int i = 0; i < parts.Length; i++) 2927// "[SCENE OBJECT GROUP]: Updating group rotation PR of {0} {1} to {2}", Name, LocalId, rot);
2946 parts[i].StoreUndoState(); 2928
2929// SceneObjectPart[] parts = m_parts.GetArray();
2930// for (int i = 0; i < parts.Length; i++)
2931// parts[i].StoreUndoState();
2932
2933 RootPart.StoreUndoState(true);
2934 RootPart.IgnoreUndoUpdate = true;
2947 2935
2948 m_rootPart.UpdateRotation(rot); 2936 m_rootPart.UpdateRotation(rot);
2949 2937
@@ -2958,6 +2946,8 @@ namespace OpenSim.Region.Framework.Scenes
2958 2946
2959 HasGroupChanged = true; 2947 HasGroupChanged = true;
2960 ScheduleGroupForTerseUpdate(); 2948 ScheduleGroupForTerseUpdate();
2949
2950 RootPart.IgnoreUndoUpdate = false;
2961 } 2951 }
2962 2952
2963 /// <summary> 2953 /// <summary>
@@ -2975,6 +2965,9 @@ namespace OpenSim.Region.Framework.Scenes
2975 2965
2976 if (part != null) 2966 if (part != null)
2977 { 2967 {
2968// m_log.DebugFormat(
2969// "[SCENE OBJECT GROUP]: Updating single rotation of {0} {1} to {2}", part.Name, part.LocalId, rot);
2970
2978 if (part.UUID == m_rootPart.UUID) 2971 if (part.UUID == m_rootPart.UUID)
2979 { 2972 {
2980 UpdateRootRotation(rot); 2973 UpdateRootRotation(rot);
@@ -2996,6 +2989,13 @@ namespace OpenSim.Region.Framework.Scenes
2996 SceneObjectPart part = GetChildPart(localID); 2989 SceneObjectPart part = GetChildPart(localID);
2997 if (part != null) 2990 if (part != null)
2998 { 2991 {
2992// m_log.DebugFormat(
2993// "[SCENE OBJECT GROUP]: Updating single position and rotation of {0} {1} to {2}",
2994// part.Name, part.LocalId, rot);
2995
2996 part.StoreUndoState();
2997 part.IgnoreUndoUpdate = true;
2998
2999 if (part.UUID == m_rootPart.UUID) 2999 if (part.UUID == m_rootPart.UUID)
3000 { 3000 {
3001 UpdateRootRotation(rot); 3001 UpdateRootRotation(rot);
@@ -3003,12 +3003,11 @@ namespace OpenSim.Region.Framework.Scenes
3003 } 3003 }
3004 else 3004 else
3005 { 3005 {
3006 part.IgnoreUndoUpdate = true;
3007 part.UpdateRotation(rot); 3006 part.UpdateRotation(rot);
3008 part.OffsetPosition = pos; 3007 part.OffsetPosition = pos;
3009 part.IgnoreUndoUpdate = false;
3010 part.StoreUndoState();
3011 } 3008 }
3009
3010 part.IgnoreUndoUpdate = false;
3012 } 3011 }
3013 } 3012 }
3014 3013
@@ -3016,8 +3015,12 @@ namespace OpenSim.Region.Framework.Scenes
3016 /// 3015 ///
3017 /// </summary> 3016 /// </summary>
3018 /// <param name="rot"></param> 3017 /// <param name="rot"></param>
3019 private void UpdateRootRotation(Quaternion rot) 3018 public void UpdateRootRotation(Quaternion rot)
3020 { 3019 {
3020// m_log.DebugFormat(
3021// "[SCENE OBJECT GROUP]: Updating root rotation of {0} {1} to {2}",
3022// Name, LocalId, rot);
3023
3021 Quaternion axRot = rot; 3024 Quaternion axRot = rot;
3022 Quaternion oldParentRot = m_rootPart.RotationOffset; 3025 Quaternion oldParentRot = m_rootPart.RotationOffset;
3023 3026
@@ -3045,20 +3048,25 @@ namespace OpenSim.Region.Framework.Scenes
3045 newRot *= Quaternion.Inverse(axRot); 3048 newRot *= Quaternion.Inverse(axRot);
3046 prim.RotationOffset = newRot; 3049 prim.RotationOffset = newRot;
3047 prim.ScheduleTerseUpdate(); 3050 prim.ScheduleTerseUpdate();
3051 prim.IgnoreUndoUpdate = false;
3048 } 3052 }
3049 } 3053 }
3050 3054
3051 for (int i = 0; i < parts.Length; i++) 3055// for (int i = 0; i < parts.Length; i++)
3052 { 3056// {
3053 SceneObjectPart childpart = parts[i]; 3057// SceneObjectPart childpart = parts[i];
3054 if (childpart != m_rootPart) 3058// if (childpart != m_rootPart)
3055 { 3059// {
3056 childpart.IgnoreUndoUpdate = false; 3060//// childpart.IgnoreUndoUpdate = false;
3057 childpart.StoreUndoState(); 3061//// childpart.StoreUndoState();
3058 } 3062// }
3059 } 3063// }
3060 3064
3061 m_rootPart.ScheduleTerseUpdate(); 3065 m_rootPart.ScheduleTerseUpdate();
3066
3067// m_log.DebugFormat(
3068// "[SCENE OBJECT GROUP]: Updated root rotation of {0} {1} to {2}",
3069// Name, LocalId, rot);
3062 } 3070 }
3063 3071
3064 #endregion 3072 #endregion
@@ -3313,23 +3321,6 @@ namespace OpenSim.Region.Framework.Scenes
3313 } 3321 }
3314 3322
3315 /// <summary> 3323 /// <summary>
3316 /// Handle an asset received asynchronously from the asset service.
3317 /// </summary>
3318 /// <param name="id"></param>
3319 /// <param name="sender"></param>
3320 /// <param name="asset"></param>
3321 protected void AssetReceived(string id, Object sender, AssetBase asset)
3322 {
3323 SceneObjectPart sop = (SceneObjectPart)sender;
3324
3325 if (sop != null)
3326 {
3327 if (asset != null)
3328 sop.SculptTextureCallback(asset.FullID, asset);
3329 }
3330 }
3331
3332 /// <summary>
3333 /// Set the user group to which this scene object belongs. 3324 /// Set the user group to which this scene object belongs.
3334 /// </summary> 3325 /// </summary>
3335 /// <param name="GroupID"></param> 3326 /// <param name="GroupID"></param>