diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 277 |
1 files changed, 159 insertions, 118 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a8e76e3..9bb961d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -60,7 +60,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
60 | TELEPORT = 512, | 60 | TELEPORT = 512, |
61 | REGION_RESTART = 1024, | 61 | REGION_RESTART = 1024, |
62 | MEDIA = 2048, | 62 | MEDIA = 2048, |
63 | ANIMATION = 16384 | 63 | ANIMATION = 16384, |
64 | POSITION = 32768 | ||
64 | } | 65 | } |
65 | 66 | ||
66 | // I don't really know where to put this except here. | 67 | // I don't really know where to put this except here. |
@@ -149,8 +150,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
149 | 150 | ||
150 | // TODO: This needs to be persisted in next XML version update! | 151 | // TODO: This needs to be persisted in next XML version update! |
151 | [XmlIgnore] | 152 | [XmlIgnore] |
152 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; | 153 | public int[] PayPrice = {-2,-2,-2,-2,-2}; |
153 | 154 | ||
154 | [XmlIgnore] | 155 | [XmlIgnore] |
155 | public PhysicsActor PhysActor | 156 | public PhysicsActor PhysActor |
156 | { | 157 | { |
@@ -193,6 +194,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
193 | [XmlIgnore] | 194 | [XmlIgnore] |
194 | public UUID FromFolderID; | 195 | public UUID FromFolderID; |
195 | 196 | ||
197 | // The following two are to hold the attachment data | ||
198 | // while an object is inworld | ||
199 | [XmlIgnore] | ||
200 | public byte AttachPoint = 0; | ||
201 | |||
202 | [XmlIgnore] | ||
203 | public Vector3 AttachOffset = Vector3.Zero; | ||
204 | |||
196 | [XmlIgnore] | 205 | [XmlIgnore] |
197 | public int STATUS_ROTATE_X; | 206 | public int STATUS_ROTATE_X; |
198 | 207 | ||
@@ -288,6 +297,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
288 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 297 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
289 | private Vector3 m_sitTargetPosition; | 298 | private Vector3 m_sitTargetPosition; |
290 | private string m_sitAnimation = "SIT"; | 299 | private string m_sitAnimation = "SIT"; |
300 | private bool m_occupied; // KF if any av is sitting on this prim | ||
291 | private string m_text = String.Empty; | 301 | private string m_text = String.Empty; |
292 | private string m_touchName = String.Empty; | 302 | private string m_touchName = String.Empty; |
293 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 303 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
@@ -377,7 +387,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, | 387 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, |
378 | Quaternion rotationOffset, Vector3 offsetPosition) | 388 | Quaternion rotationOffset, Vector3 offsetPosition) |
379 | { | 389 | { |
380 | m_name = "Primitive"; | 390 | m_name = "Object"; |
381 | 391 | ||
382 | Rezzed = DateTime.UtcNow; | 392 | Rezzed = DateTime.UtcNow; |
383 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); | 393 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); |
@@ -473,12 +483,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
473 | } | 483 | } |
474 | 484 | ||
475 | /// <value> | 485 | /// <value> |
476 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 486 | /// Get the inventory list |
477 | /// </value> | 487 | /// </value> |
478 | public TaskInventoryDictionary TaskInventory | 488 | public TaskInventoryDictionary TaskInventory |
479 | { | 489 | { |
480 | get { return m_inventory.Items; } | 490 | get { |
481 | set { m_inventory.Items = value; } | 491 | return m_inventory.Items; |
492 | } | ||
493 | set { | ||
494 | m_inventory.Items = value; | ||
495 | } | ||
482 | } | 496 | } |
483 | 497 | ||
484 | /// <summary> | 498 | /// <summary> |
@@ -618,14 +632,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
618 | set { m_LoopSoundSlavePrims = value; } | 632 | set { m_LoopSoundSlavePrims = value; } |
619 | } | 633 | } |
620 | 634 | ||
621 | [XmlIgnore] | ||
622 | public Byte[] TextureAnimation | 635 | public Byte[] TextureAnimation |
623 | { | 636 | { |
624 | get { return m_TextureAnimation; } | 637 | get { return m_TextureAnimation; } |
625 | set { m_TextureAnimation = value; } | 638 | set { m_TextureAnimation = value; } |
626 | } | 639 | } |
627 | 640 | ||
628 | [XmlIgnore] | ||
629 | public Byte[] ParticleSystem | 641 | public Byte[] ParticleSystem |
630 | { | 642 | { |
631 | get { return m_particleSystem; } | 643 | get { return m_particleSystem; } |
@@ -679,7 +691,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
679 | set | 691 | set |
680 | { | 692 | { |
681 | m_groupPosition = value; | 693 | m_groupPosition = value; |
682 | |||
683 | PhysicsActor actor = PhysActor; | 694 | PhysicsActor actor = PhysActor; |
684 | if (actor != null) | 695 | if (actor != null) |
685 | { | 696 | { |
@@ -699,25 +710,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
699 | 710 | ||
700 | // Tell the physics engines that this prim changed. | 711 | // Tell the physics engines that this prim changed. |
701 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 712 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
713 | |||
702 | } | 714 | } |
703 | catch (Exception e) | 715 | catch (Exception e) |
704 | { | 716 | { |
705 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); | 717 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); |
706 | } | 718 | } |
707 | } | 719 | } |
708 | |||
709 | // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too | ||
710 | if (m_sitTargetAvatar != UUID.Zero) | ||
711 | { | ||
712 | if (m_parentGroup != null) // TODO can there be a SOP without a SOG? | ||
713 | { | ||
714 | ScenePresence avatar; | ||
715 | if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) | ||
716 | { | ||
717 | avatar.ParentPosition = GetWorldPosition(); | ||
718 | } | ||
719 | } | ||
720 | } | ||
721 | } | 720 | } |
722 | } | 721 | } |
723 | 722 | ||
@@ -726,7 +725,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
726 | get { return m_offsetPosition; } | 725 | get { return m_offsetPosition; } |
727 | set | 726 | set |
728 | { | 727 | { |
729 | StoreUndoState(); | 728 | Vector3 oldpos = m_offsetPosition; |
729 | StoreUndoState(UndoType.STATE_PRIM_POSITION); | ||
730 | m_offsetPosition = value; | 730 | m_offsetPosition = value; |
731 | 731 | ||
732 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 732 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -740,7 +740,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
740 | // Tell the physics engines that this prim changed. | 740 | // Tell the physics engines that this prim changed. |
741 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 741 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
742 | } | 742 | } |
743 | |||
744 | if (!m_parentGroup.m_dupeInProgress) | ||
745 | { | ||
746 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
747 | foreach (ScenePresence av in avs) | ||
748 | { | ||
749 | if (av.LinkedPrim == m_uuid) | ||
750 | { | ||
751 | Vector3 offset = (m_offsetPosition - oldpos); | ||
752 | av.OffsetPosition += offset; | ||
753 | av.SendFullUpdateToAllClients(); | ||
754 | } | ||
755 | } | ||
756 | } | ||
743 | } | 757 | } |
758 | TriggerScriptChangedEvent(Changed.POSITION); | ||
744 | } | 759 | } |
745 | } | 760 | } |
746 | 761 | ||
@@ -782,7 +797,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
782 | 797 | ||
783 | set | 798 | set |
784 | { | 799 | { |
785 | StoreUndoState(); | 800 | StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
786 | m_rotationOffset = value; | 801 | m_rotationOffset = value; |
787 | 802 | ||
788 | PhysicsActor actor = PhysActor; | 803 | PhysicsActor actor = PhysActor; |
@@ -866,7 +881,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
866 | /// <summary></summary> | 881 | /// <summary></summary> |
867 | public Vector3 Acceleration | 882 | public Vector3 Acceleration |
868 | { | 883 | { |
869 | get { return m_acceleration; } | 884 | get |
885 | { | ||
886 | PhysicsActor actor = PhysActor; | ||
887 | if (actor != null) | ||
888 | { | ||
889 | m_acceleration = actor.Acceleration; | ||
890 | } | ||
891 | return m_acceleration; | ||
892 | } | ||
893 | |||
870 | set { m_acceleration = value; } | 894 | set { m_acceleration = value; } |
871 | } | 895 | } |
872 | 896 | ||
@@ -971,7 +995,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
971 | get { return m_shape.Scale; } | 995 | get { return m_shape.Scale; } |
972 | set | 996 | set |
973 | { | 997 | { |
974 | StoreUndoState(); | 998 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
975 | if (m_shape != null) | 999 | if (m_shape != null) |
976 | { | 1000 | { |
977 | m_shape.Scale = value; | 1001 | m_shape.Scale = value; |
@@ -1041,7 +1065,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1041 | if (IsAttachment) | 1065 | if (IsAttachment) |
1042 | return GroupPosition; | 1066 | return GroupPosition; |
1043 | 1067 | ||
1044 | return m_offsetPosition + m_groupPosition; } | 1068 | // return m_offsetPosition + m_groupPosition; } |
1069 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
1045 | } | 1070 | } |
1046 | 1071 | ||
1047 | public SceneObjectGroup ParentGroup | 1072 | public SceneObjectGroup ParentGroup |
@@ -1200,6 +1225,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1200 | _flags = value; | 1225 | _flags = value; |
1201 | } | 1226 | } |
1202 | } | 1227 | } |
1228 | |||
1229 | [XmlIgnore] | ||
1230 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1231 | { | ||
1232 | get { return m_occupied; } | ||
1233 | set { m_occupied = value; } | ||
1234 | } | ||
1203 | 1235 | ||
1204 | [XmlIgnore] | 1236 | [XmlIgnore] |
1205 | public UUID SitTargetAvatar | 1237 | public UUID SitTargetAvatar |
@@ -1275,14 +1307,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1275 | } | 1307 | } |
1276 | } | 1308 | } |
1277 | 1309 | ||
1278 | /// <summary> | ||
1279 | /// Clear all pending updates of parts to clients | ||
1280 | /// </summary> | ||
1281 | private void ClearUpdateSchedule() | ||
1282 | { | ||
1283 | m_updateFlag = 0; | ||
1284 | } | ||
1285 | |||
1286 | private void SendObjectPropertiesToClient(UUID AgentID) | 1310 | private void SendObjectPropertiesToClient(UUID AgentID) |
1287 | { | 1311 | { |
1288 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1312 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1533,14 +1557,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1533 | // or flexible | 1557 | // or flexible |
1534 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1558 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1535 | { | 1559 | { |
1536 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 1560 | try |
1537 | string.Format("{0}/{1}", Name, UUID), | 1561 | { |
1538 | Shape, | 1562 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
1539 | AbsolutePosition, | 1563 | string.Format("{0}/{1}", Name, UUID), |
1540 | Scale, | 1564 | Shape, |
1541 | RotationOffset, | 1565 | AbsolutePosition, |
1542 | RigidBody); | 1566 | Scale, |
1543 | 1567 | RotationOffset, | |
1568 | RigidBody); | ||
1569 | } | ||
1570 | catch | ||
1571 | { | ||
1572 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
1573 | PhysActor = null; | ||
1574 | } | ||
1544 | // Basic Physics returns null.. joy joy joy. | 1575 | // Basic Physics returns null.. joy joy joy. |
1545 | if (PhysActor != null) | 1576 | if (PhysActor != null) |
1546 | { | 1577 | { |
@@ -1568,7 +1599,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1568 | { | 1599 | { |
1569 | m_redo.Clear(); | 1600 | m_redo.Clear(); |
1570 | } | 1601 | } |
1571 | StoreUndoState(); | 1602 | StoreUndoState(UndoType.STATE_ALL); |
1572 | } | 1603 | } |
1573 | 1604 | ||
1574 | public byte ConvertScriptUintToByte(uint indata) | 1605 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1680,7 +1711,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1680 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1711 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1681 | part.Shape = shape; | 1712 | part.Shape = shape; |
1682 | 1713 | ||
1683 | part.Name = "Primitive"; | 1714 | part.Name = "Object"; |
1684 | part._ownerID = UUID.Random(); | 1715 | part._ownerID = UUID.Random(); |
1685 | 1716 | ||
1686 | return part; | 1717 | return part; |
@@ -2040,12 +2071,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2040 | public Vector3 GetWorldPosition() | 2071 | public Vector3 GetWorldPosition() |
2041 | { | 2072 | { |
2042 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 2073 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
2043 | |||
2044 | Vector3 axPos = OffsetPosition; | 2074 | Vector3 axPos = OffsetPosition; |
2045 | |||
2046 | axPos *= parentRot; | 2075 | axPos *= parentRot; |
2047 | Vector3 translationOffsetPosition = axPos; | 2076 | Vector3 translationOffsetPosition = axPos; |
2048 | return GroupPosition + translationOffsetPosition; | 2077 | if(_parentID == 0) |
2078 | { | ||
2079 | return GroupPosition; | ||
2080 | } | ||
2081 | else | ||
2082 | { | ||
2083 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
2084 | } | ||
2049 | } | 2085 | } |
2050 | 2086 | ||
2051 | /// <summary> | 2087 | /// <summary> |
@@ -2056,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2056 | { | 2092 | { |
2057 | Quaternion newRot; | 2093 | Quaternion newRot; |
2058 | 2094 | ||
2059 | if (this.LinkNum == 0) | 2095 | if (this.LinkNum < 2) //KF Single or root prim |
2060 | { | 2096 | { |
2061 | newRot = RotationOffset; | 2097 | newRot = RotationOffset; |
2062 | } | 2098 | } |
@@ -2702,17 +2738,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2702 | //Trys to fetch sound id from prim's inventory. | 2738 | //Trys to fetch sound id from prim's inventory. |
2703 | //Prim's inventory doesn't support non script items yet | 2739 | //Prim's inventory doesn't support non script items yet |
2704 | 2740 | ||
2705 | lock (TaskInventory) | 2741 | TaskInventory.LockItemsForRead(true); |
2742 | |||
2743 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2706 | { | 2744 | { |
2707 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2745 | if (item.Value.Name == sound) |
2708 | { | 2746 | { |
2709 | if (item.Value.Name == sound) | 2747 | soundID = item.Value.ItemID; |
2710 | { | 2748 | break; |
2711 | soundID = item.Value.ItemID; | ||
2712 | break; | ||
2713 | } | ||
2714 | } | 2749 | } |
2715 | } | 2750 | } |
2751 | |||
2752 | TaskInventory.LockItemsForRead(false); | ||
2716 | } | 2753 | } |
2717 | 2754 | ||
2718 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2755 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2772,7 +2809,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2772 | /// <param name="scale"></param> | 2809 | /// <param name="scale"></param> |
2773 | public void Resize(Vector3 scale) | 2810 | public void Resize(Vector3 scale) |
2774 | { | 2811 | { |
2775 | StoreUndoState(); | 2812 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2776 | m_shape.Scale = scale; | 2813 | m_shape.Scale = scale; |
2777 | 2814 | ||
2778 | ParentGroup.HasGroupChanged = true; | 2815 | ParentGroup.HasGroupChanged = true; |
@@ -2781,38 +2818,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2781 | 2818 | ||
2782 | public void RotLookAt(Quaternion target, float strength, float damping) | 2819 | public void RotLookAt(Quaternion target, float strength, float damping) |
2783 | { | 2820 | { |
2784 | rotLookAt(target, strength, damping); | 2821 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2785 | } | ||
2786 | |||
2787 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2788 | { | ||
2789 | if (IsAttachment) | ||
2790 | { | ||
2791 | /* | ||
2792 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2793 | if (avatar != null) | ||
2794 | { | ||
2795 | Rotate the Av? | ||
2796 | } */ | ||
2797 | } | ||
2798 | else | ||
2799 | { | ||
2800 | APIDDamp = damping; | ||
2801 | APIDStrength = strength; | ||
2802 | APIDTarget = target; | ||
2803 | } | ||
2804 | } | ||
2805 | |||
2806 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2807 | { | ||
2808 | APIDDamp = damp; | ||
2809 | APIDStrength = strength; | ||
2810 | APIDTarget = rot; | ||
2811 | } | ||
2812 | |||
2813 | public void stopLookAt() | ||
2814 | { | ||
2815 | APIDTarget = Quaternion.Identity; | ||
2816 | } | 2822 | } |
2817 | 2823 | ||
2818 | /// <summary> | 2824 | /// <summary> |
@@ -2824,7 +2830,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2824 | 2830 | ||
2825 | if (m_parentGroup != null) | 2831 | if (m_parentGroup != null) |
2826 | { | 2832 | { |
2827 | m_parentGroup.QueueForUpdateCheck(); | 2833 | if (!m_parentGroup.areUpdatesSuspended) |
2834 | { | ||
2835 | m_parentGroup.QueueForUpdateCheck(); | ||
2836 | } | ||
2828 | } | 2837 | } |
2829 | 2838 | ||
2830 | int timeNow = Util.UnixTimeSinceEpoch(); | 2839 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -3041,8 +3050,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3041 | { | 3050 | { |
3042 | const float ROTATION_TOLERANCE = 0.01f; | 3051 | const float ROTATION_TOLERANCE = 0.01f; |
3043 | const float VELOCITY_TOLERANCE = 0.001f; | 3052 | const float VELOCITY_TOLERANCE = 0.001f; |
3044 | const float POSITION_TOLERANCE = 0.05f; | 3053 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3045 | const int TIME_MS_TOLERANCE = 3000; | 3054 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3046 | 3055 | ||
3047 | if (m_updateFlag == 1) | 3056 | if (m_updateFlag == 1) |
3048 | { | 3057 | { |
@@ -3056,7 +3065,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3056 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 3065 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
3057 | { | 3066 | { |
3058 | AddTerseUpdateToAllAvatars(); | 3067 | AddTerseUpdateToAllAvatars(); |
3059 | ClearUpdateSchedule(); | 3068 | |
3060 | 3069 | ||
3061 | // This causes the Scene to 'poll' physical objects every couple of frames | 3070 | // This causes the Scene to 'poll' physical objects every couple of frames |
3062 | // bad, so it's been replaced by an event driven method. | 3071 | // bad, so it's been replaced by an event driven method. |
@@ -3074,16 +3083,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3074 | m_lastAngularVelocity = AngularVelocity; | 3083 | m_lastAngularVelocity = AngularVelocity; |
3075 | m_lastTerseSent = Environment.TickCount; | 3084 | m_lastTerseSent = Environment.TickCount; |
3076 | } | 3085 | } |
3086 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
3087 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
3077 | } | 3088 | } |
3078 | else | 3089 | else |
3079 | { | 3090 | { |
3080 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 3091 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3081 | { | 3092 | { |
3082 | AddFullUpdateToAllAvatars(); | 3093 | AddFullUpdateToAllAvatars(); |
3083 | ClearUpdateSchedule(); | 3094 | m_updateFlag = 0; //Same here |
3084 | } | 3095 | } |
3085 | } | 3096 | } |
3086 | ClearUpdateSchedule(); | 3097 | m_updateFlag = 0; |
3087 | } | 3098 | } |
3088 | 3099 | ||
3089 | /// <summary> | 3100 | /// <summary> |
@@ -3103,6 +3114,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3103 | UUID ownerID = _ownerID; | 3114 | UUID ownerID = _ownerID; |
3104 | UUID objectID = UUID; | 3115 | UUID objectID = UUID; |
3105 | UUID parentID = GetRootPartUUID(); | 3116 | UUID parentID = GetRootPartUUID(); |
3117 | |||
3118 | if (ParentGroup.IsAttachment && ParentGroup.RootPart.Shape.State > 30) | ||
3119 | { | ||
3120 | // Use the avatar as the parent for HUDs, since the prims | ||
3121 | // are not sent to other avatars | ||
3122 | objectID = _ownerID; | ||
3123 | parentID = _ownerID; | ||
3124 | } | ||
3125 | |||
3106 | UUID soundID = UUID.Zero; | 3126 | UUID soundID = UUID.Zero; |
3107 | Vector3 position = AbsolutePosition; // region local | 3127 | Vector3 position = AbsolutePosition; // region local |
3108 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; | 3128 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; |
@@ -3110,17 +3130,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3110 | if (!UUID.TryParse(sound, out soundID)) | 3130 | if (!UUID.TryParse(sound, out soundID)) |
3111 | { | 3131 | { |
3112 | // search sound file from inventory | 3132 | // search sound file from inventory |
3113 | lock (TaskInventory) | 3133 | TaskInventory.LockItemsForRead(true); |
3134 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3114 | { | 3135 | { |
3115 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3136 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3116 | { | 3137 | { |
3117 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3138 | soundID = item.Value.ItemID; |
3118 | { | 3139 | break; |
3119 | soundID = item.Value.ItemID; | ||
3120 | break; | ||
3121 | } | ||
3122 | } | 3140 | } |
3123 | } | 3141 | } |
3142 | TaskInventory.LockItemsForRead(false); | ||
3124 | } | 3143 | } |
3125 | 3144 | ||
3126 | if (soundID == UUID.Zero) | 3145 | if (soundID == UUID.Zero) |
@@ -3557,7 +3576,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3557 | 3576 | ||
3558 | public void StopLookAt() | 3577 | public void StopLookAt() |
3559 | { | 3578 | { |
3560 | m_parentGroup.stopLookAt(); | 3579 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3561 | 3580 | ||
3562 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3581 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3563 | } | 3582 | } |
@@ -3584,10 +3603,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3584 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3603 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3585 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3604 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3586 | } | 3605 | } |
3587 | 3606 | public void StoreUndoState(UndoType type) | |
3588 | public void StoreUndoState() | ||
3589 | { | 3607 | { |
3590 | if (!Undoing) | 3608 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3591 | { | 3609 | { |
3592 | if (!IgnoreUndoUpdate) | 3610 | if (!IgnoreUndoUpdate) |
3593 | { | 3611 | { |
@@ -3598,17 +3616,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3598 | if (m_undo.Count > 0) | 3616 | if (m_undo.Count > 0) |
3599 | { | 3617 | { |
3600 | UndoState last = m_undo.Peek(); | 3618 | UndoState last = m_undo.Peek(); |
3601 | if (last != null) | 3619 | |
3602 | { | ||
3603 | if (last.Compare(this)) | ||
3604 | return; | ||
3605 | } | ||
3606 | } | 3620 | } |
3607 | 3621 | ||
3608 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3622 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3609 | { | 3623 | { |
3610 | UndoState nUndo = new UndoState(this); | 3624 | UndoState lastUndo = m_undo.Peek(); |
3625 | |||
3626 | UndoState nUndo = new UndoState(this, type); | ||
3611 | 3627 | ||
3628 | if (lastUndo != null) | ||
3629 | { | ||
3630 | TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); | ||
3631 | if (ts.TotalMilliseconds < 500) | ||
3632 | { | ||
3633 | //Delete the last entry since it was less than 500 milliseconds ago | ||
3634 | nUndo.Merge(lastUndo); | ||
3635 | m_undo.Pop(); | ||
3636 | } | ||
3637 | } | ||
3612 | m_undo.Push(nUndo); | 3638 | m_undo.Push(nUndo); |
3613 | } | 3639 | } |
3614 | 3640 | ||
@@ -4085,11 +4111,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4085 | if (m_undo.Count > 0) | 4111 | if (m_undo.Count > 0) |
4086 | { | 4112 | { |
4087 | UndoState nUndo = null; | 4113 | UndoState nUndo = null; |
4114 | UndoState goback = m_undo.Pop(); | ||
4088 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4115 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4089 | { | 4116 | { |
4090 | nUndo = new UndoState(this); | 4117 | nUndo = new UndoState(this, goback.Type); |
4091 | } | 4118 | } |
4092 | UndoState goback = m_undo.Pop(); | 4119 | |
4120 | |||
4093 | if (goback != null) | 4121 | if (goback != null) |
4094 | { | 4122 | { |
4095 | goback.PlaybackState(this); | 4123 | goback.PlaybackState(this); |
@@ -4104,13 +4132,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4104 | { | 4132 | { |
4105 | lock (m_redo) | 4133 | lock (m_redo) |
4106 | { | 4134 | { |
4135 | UndoState gofwd = m_redo.Pop(); | ||
4107 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4136 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4108 | { | 4137 | { |
4109 | UndoState nUndo = new UndoState(this); | 4138 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4110 | 4139 | ||
4111 | m_undo.Push(nUndo); | 4140 | m_undo.Push(nUndo); |
4112 | } | 4141 | } |
4113 | UndoState gofwd = m_redo.Pop(); | ||
4114 | if (gofwd != null) | 4142 | if (gofwd != null) |
4115 | gofwd.PlayfwdState(this); | 4143 | gofwd.PlayfwdState(this); |
4116 | } | 4144 | } |
@@ -4558,8 +4586,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4558 | { | 4586 | { |
4559 | m_shape.TextureEntry = textureEntry; | 4587 | m_shape.TextureEntry = textureEntry; |
4560 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4588 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4561 | 4589 | m_updateFlag = 1; | |
4562 | ParentGroup.HasGroupChanged = true; | 4590 | ParentGroup.HasGroupChanged = true; |
4591 | |||
4563 | //This is madness.. | 4592 | //This is madness.. |
4564 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4593 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4565 | //This is sparta | 4594 | //This is sparta |
@@ -4792,5 +4821,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4792 | Color color = Color; | 4821 | Color color = Color; |
4793 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4822 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4794 | } | 4823 | } |
4824 | |||
4825 | public void ResetOwnerChangeFlag() | ||
4826 | { | ||
4827 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4828 | |||
4829 | foreach (UUID itemID in inv) | ||
4830 | { | ||
4831 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4832 | item.OwnerChanged = false; | ||
4833 | Inventory.UpdateInventoryItem(item); | ||
4834 | } | ||
4835 | } | ||
4795 | } | 4836 | } |
4796 | } | 4837 | } |