diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 281 |
1 files changed, 158 insertions, 123 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ba592c4..8cc2be1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -61,7 +61,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | TELEPORT = 512, | 61 | TELEPORT = 512, |
62 | REGION_RESTART = 1024, | 62 | REGION_RESTART = 1024, |
63 | MEDIA = 2048, | 63 | MEDIA = 2048, |
64 | ANIMATION = 16384 | 64 | ANIMATION = 16384, |
65 | POSITION = 32768 | ||
65 | } | 66 | } |
66 | 67 | ||
67 | // I don't really know where to put this except here. | 68 | // I don't really know where to put this except here. |
@@ -145,10 +146,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
145 | public Vector3 StatusSandboxPos; | 146 | public Vector3 StatusSandboxPos; |
146 | 147 | ||
147 | // TODO: This needs to be persisted in next XML version update! | 148 | // TODO: This needs to be persisted in next XML version update! |
148 | 149 | [XmlIgnore] | |
149 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; | 150 | public int[] PayPrice = {-2,-2,-2,-2,-2}; |
150 | 151 | ||
151 | 152 | [XmlIgnore] | |
152 | public PhysicsActor PhysActor | 153 | public PhysicsActor PhysActor |
153 | { | 154 | { |
154 | get { return m_physActor; } | 155 | get { return m_physActor; } |
@@ -190,7 +191,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
190 | 191 | ||
191 | public UUID FromFolderID; | 192 | public UUID FromFolderID; |
192 | 193 | ||
193 | 194 | // The following two are to hold the attachment data | |
195 | // while an object is inworld | ||
196 | [XmlIgnore] | ||
197 | public byte AttachPoint = 0; | ||
198 | |||
199 | [XmlIgnore] | ||
200 | public Vector3 AttachOffset = Vector3.Zero; | ||
201 | |||
202 | [XmlIgnore] | ||
194 | public int STATUS_ROTATE_X; | 203 | public int STATUS_ROTATE_X; |
195 | 204 | ||
196 | 205 | ||
@@ -285,6 +294,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
285 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 294 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
286 | private Vector3 m_sitTargetPosition; | 295 | private Vector3 m_sitTargetPosition; |
287 | private string m_sitAnimation = "SIT"; | 296 | private string m_sitAnimation = "SIT"; |
297 | private bool m_occupied; // KF if any av is sitting on this prim | ||
288 | private string m_text = String.Empty; | 298 | private string m_text = String.Empty; |
289 | private string m_touchName = String.Empty; | 299 | private string m_touchName = String.Empty; |
290 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 300 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
@@ -374,7 +384,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
374 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, | 384 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, |
375 | Quaternion rotationOffset, Vector3 offsetPosition) | 385 | Quaternion rotationOffset, Vector3 offsetPosition) |
376 | { | 386 | { |
377 | m_name = "Primitive"; | 387 | m_name = "Object"; |
378 | 388 | ||
379 | Rezzed = DateTime.UtcNow; | 389 | Rezzed = DateTime.UtcNow; |
380 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); | 390 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); |
@@ -430,7 +440,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
430 | private uint _ownerMask = (uint)PermissionMask.All; | 440 | private uint _ownerMask = (uint)PermissionMask.All; |
431 | private uint _groupMask = (uint)PermissionMask.None; | 441 | private uint _groupMask = (uint)PermissionMask.None; |
432 | private uint _everyoneMask = (uint)PermissionMask.None; | 442 | private uint _everyoneMask = (uint)PermissionMask.None; |
433 | private uint _nextOwnerMask = (uint)PermissionMask.All; | 443 | private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); |
434 | private PrimFlags _flags = PrimFlags.None; | 444 | private PrimFlags _flags = PrimFlags.None; |
435 | private DateTime m_expires; | 445 | private DateTime m_expires; |
436 | private DateTime m_rezzed; | 446 | private DateTime m_rezzed; |
@@ -526,12 +536,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
526 | } | 536 | } |
527 | 537 | ||
528 | /// <value> | 538 | /// <value> |
529 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 539 | /// Get the inventory list |
530 | /// </value> | 540 | /// </value> |
531 | public TaskInventoryDictionary TaskInventory | 541 | public TaskInventoryDictionary TaskInventory |
532 | { | 542 | { |
533 | get { return m_inventory.Items; } | 543 | get { |
534 | set { m_inventory.Items = value; } | 544 | return m_inventory.Items; |
545 | } | ||
546 | set { | ||
547 | m_inventory.Items = value; | ||
548 | } | ||
535 | } | 549 | } |
536 | 550 | ||
537 | /// <summary> | 551 | /// <summary> |
@@ -671,14 +685,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
671 | set { m_LoopSoundSlavePrims = value; } | 685 | set { m_LoopSoundSlavePrims = value; } |
672 | } | 686 | } |
673 | 687 | ||
674 | |||
675 | public Byte[] TextureAnimation | 688 | public Byte[] TextureAnimation |
676 | { | 689 | { |
677 | get { return m_TextureAnimation; } | 690 | get { return m_TextureAnimation; } |
678 | set { m_TextureAnimation = value; } | 691 | set { m_TextureAnimation = value; } |
679 | } | 692 | } |
680 | 693 | ||
681 | |||
682 | public Byte[] ParticleSystem | 694 | public Byte[] ParticleSystem |
683 | { | 695 | { |
684 | get { return m_particleSystem; } | 696 | get { return m_particleSystem; } |
@@ -732,7 +744,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
732 | set | 744 | set |
733 | { | 745 | { |
734 | m_groupPosition = value; | 746 | m_groupPosition = value; |
735 | |||
736 | PhysicsActor actor = PhysActor; | 747 | PhysicsActor actor = PhysActor; |
737 | if (actor != null) | 748 | if (actor != null) |
738 | { | 749 | { |
@@ -752,25 +763,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
752 | 763 | ||
753 | // Tell the physics engines that this prim changed. | 764 | // Tell the physics engines that this prim changed. |
754 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 765 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
766 | |||
755 | } | 767 | } |
756 | catch (Exception e) | 768 | catch (Exception e) |
757 | { | 769 | { |
758 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); | 770 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); |
759 | } | 771 | } |
760 | } | 772 | } |
761 | |||
762 | // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too | ||
763 | if (m_sitTargetAvatar != UUID.Zero) | ||
764 | { | ||
765 | if (m_parentGroup != null) // TODO can there be a SOP without a SOG? | ||
766 | { | ||
767 | ScenePresence avatar; | ||
768 | if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) | ||
769 | { | ||
770 | avatar.ParentPosition = GetWorldPosition(); | ||
771 | } | ||
772 | } | ||
773 | } | ||
774 | } | 773 | } |
775 | } | 774 | } |
776 | 775 | ||
@@ -779,7 +778,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
779 | get { return m_offsetPosition; } | 778 | get { return m_offsetPosition; } |
780 | set | 779 | set |
781 | { | 780 | { |
782 | StoreUndoState(); | 781 | Vector3 oldpos = m_offsetPosition; |
782 | StoreUndoState(UndoType.STATE_PRIM_POSITION); | ||
783 | m_offsetPosition = value; | 783 | m_offsetPosition = value; |
784 | 784 | ||
785 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 785 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -793,7 +793,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
793 | // Tell the physics engines that this prim changed. | 793 | // Tell the physics engines that this prim changed. |
794 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 794 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
795 | } | 795 | } |
796 | |||
797 | if (!m_parentGroup.m_dupeInProgress) | ||
798 | { | ||
799 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
800 | foreach (ScenePresence av in avs) | ||
801 | { | ||
802 | if (av.LinkedPrim == m_uuid) | ||
803 | { | ||
804 | Vector3 offset = (m_offsetPosition - oldpos); | ||
805 | av.OffsetPosition += offset; | ||
806 | av.SendAvatarDataToAllAgents(); | ||
807 | } | ||
808 | } | ||
809 | } | ||
796 | } | 810 | } |
811 | TriggerScriptChangedEvent(Changed.POSITION); | ||
797 | } | 812 | } |
798 | } | 813 | } |
799 | 814 | ||
@@ -835,7 +850,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
835 | 850 | ||
836 | set | 851 | set |
837 | { | 852 | { |
838 | StoreUndoState(); | 853 | StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
839 | m_rotationOffset = value; | 854 | m_rotationOffset = value; |
840 | 855 | ||
841 | PhysicsActor actor = PhysActor; | 856 | PhysicsActor actor = PhysActor; |
@@ -919,7 +934,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
919 | /// <summary></summary> | 934 | /// <summary></summary> |
920 | public Vector3 Acceleration | 935 | public Vector3 Acceleration |
921 | { | 936 | { |
922 | get { return m_acceleration; } | 937 | get |
938 | { | ||
939 | PhysicsActor actor = PhysActor; | ||
940 | if (actor != null) | ||
941 | { | ||
942 | m_acceleration = actor.Acceleration; | ||
943 | } | ||
944 | return m_acceleration; | ||
945 | } | ||
946 | |||
923 | set { m_acceleration = value; } | 947 | set { m_acceleration = value; } |
924 | } | 948 | } |
925 | 949 | ||
@@ -1010,7 +1034,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1010 | get { return m_shape.Scale; } | 1034 | get { return m_shape.Scale; } |
1011 | set | 1035 | set |
1012 | { | 1036 | { |
1013 | StoreUndoState(); | 1037 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
1014 | if (m_shape != null) | 1038 | if (m_shape != null) |
1015 | { | 1039 | { |
1016 | m_shape.Scale = value; | 1040 | m_shape.Scale = value; |
@@ -1078,9 +1102,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1078 | { | 1102 | { |
1079 | get { | 1103 | get { |
1080 | if (IsAttachment) | 1104 | if (IsAttachment) |
1081 | return GroupPosition; | 1105 | return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); |
1082 | 1106 | ||
1083 | return m_offsetPosition + m_groupPosition; } | 1107 | // return m_offsetPosition + m_groupPosition; } |
1108 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
1084 | } | 1109 | } |
1085 | 1110 | ||
1086 | public SceneObjectGroup ParentGroup | 1111 | public SceneObjectGroup ParentGroup |
@@ -1239,6 +1264,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1239 | _flags = value; | 1264 | _flags = value; |
1240 | } | 1265 | } |
1241 | } | 1266 | } |
1267 | |||
1268 | [XmlIgnore] | ||
1269 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1270 | { | ||
1271 | get { return m_occupied; } | ||
1272 | set { m_occupied = value; } | ||
1273 | } | ||
1242 | 1274 | ||
1243 | 1275 | ||
1244 | public UUID SitTargetAvatar | 1276 | public UUID SitTargetAvatar |
@@ -1314,14 +1346,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1314 | } | 1346 | } |
1315 | } | 1347 | } |
1316 | 1348 | ||
1317 | /// <summary> | ||
1318 | /// Clear all pending updates of parts to clients | ||
1319 | /// </summary> | ||
1320 | private void ClearUpdateSchedule() | ||
1321 | { | ||
1322 | m_updateFlag = 0; | ||
1323 | } | ||
1324 | |||
1325 | private void SendObjectPropertiesToClient(UUID AgentID) | 1349 | private void SendObjectPropertiesToClient(UUID AgentID) |
1326 | { | 1350 | { |
1327 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1351 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1572,14 +1596,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1572 | // or flexible | 1596 | // or flexible |
1573 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1597 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1574 | { | 1598 | { |
1575 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 1599 | try |
1576 | string.Format("{0}/{1}", Name, UUID), | 1600 | { |
1577 | Shape, | 1601 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
1578 | AbsolutePosition, | 1602 | string.Format("{0}/{1}", Name, UUID), |
1579 | Scale, | 1603 | Shape, |
1580 | RotationOffset, | 1604 | AbsolutePosition, |
1581 | RigidBody); | 1605 | Scale, |
1582 | 1606 | RotationOffset, | |
1607 | RigidBody); | ||
1608 | } | ||
1609 | catch | ||
1610 | { | ||
1611 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
1612 | PhysActor = null; | ||
1613 | } | ||
1583 | // Basic Physics returns null.. joy joy joy. | 1614 | // Basic Physics returns null.. joy joy joy. |
1584 | if (PhysActor != null) | 1615 | if (PhysActor != null) |
1585 | { | 1616 | { |
@@ -1607,7 +1638,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1607 | { | 1638 | { |
1608 | m_redo.Clear(); | 1639 | m_redo.Clear(); |
1609 | } | 1640 | } |
1610 | StoreUndoState(); | 1641 | StoreUndoState(UndoType.STATE_ALL); |
1611 | } | 1642 | } |
1612 | 1643 | ||
1613 | public byte ConvertScriptUintToByte(uint indata) | 1644 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1676,6 +1707,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1676 | 1707 | ||
1677 | // Move afterwards ResetIDs as it clears the localID | 1708 | // Move afterwards ResetIDs as it clears the localID |
1678 | dupe.LocalId = localID; | 1709 | dupe.LocalId = localID; |
1710 | if(dupe.PhysActor != null) | ||
1711 | dupe.PhysActor.LocalID = localID; | ||
1712 | |||
1679 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 1713 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
1680 | dupe._lastOwnerID = OwnerID; | 1714 | dupe._lastOwnerID = OwnerID; |
1681 | 1715 | ||
@@ -1719,7 +1753,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1719 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1753 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1720 | part.Shape = shape; | 1754 | part.Shape = shape; |
1721 | 1755 | ||
1722 | part.Name = "Primitive"; | 1756 | part.Name = "Object"; |
1723 | part._ownerID = UUID.Random(); | 1757 | part._ownerID = UUID.Random(); |
1724 | 1758 | ||
1725 | return part; | 1759 | return part; |
@@ -2079,12 +2113,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2079 | public Vector3 GetWorldPosition() | 2113 | public Vector3 GetWorldPosition() |
2080 | { | 2114 | { |
2081 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 2115 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
2082 | |||
2083 | Vector3 axPos = OffsetPosition; | 2116 | Vector3 axPos = OffsetPosition; |
2084 | |||
2085 | axPos *= parentRot; | 2117 | axPos *= parentRot; |
2086 | Vector3 translationOffsetPosition = axPos; | 2118 | Vector3 translationOffsetPosition = axPos; |
2087 | return GroupPosition + translationOffsetPosition; | 2119 | if(_parentID == 0) |
2120 | { | ||
2121 | return GroupPosition; | ||
2122 | } | ||
2123 | else | ||
2124 | { | ||
2125 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
2126 | } | ||
2088 | } | 2127 | } |
2089 | 2128 | ||
2090 | /// <summary> | 2129 | /// <summary> |
@@ -2095,7 +2134,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2095 | { | 2134 | { |
2096 | Quaternion newRot; | 2135 | Quaternion newRot; |
2097 | 2136 | ||
2098 | if (this.LinkNum == 0) | 2137 | if (this.LinkNum < 2) //KF Single or root prim |
2099 | { | 2138 | { |
2100 | newRot = RotationOffset; | 2139 | newRot = RotationOffset; |
2101 | } | 2140 | } |
@@ -2741,17 +2780,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2741 | //Trys to fetch sound id from prim's inventory. | 2780 | //Trys to fetch sound id from prim's inventory. |
2742 | //Prim's inventory doesn't support non script items yet | 2781 | //Prim's inventory doesn't support non script items yet |
2743 | 2782 | ||
2744 | lock (TaskInventory) | 2783 | TaskInventory.LockItemsForRead(true); |
2784 | |||
2785 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2745 | { | 2786 | { |
2746 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2787 | if (item.Value.Name == sound) |
2747 | { | 2788 | { |
2748 | if (item.Value.Name == sound) | 2789 | soundID = item.Value.ItemID; |
2749 | { | 2790 | break; |
2750 | soundID = item.Value.ItemID; | ||
2751 | break; | ||
2752 | } | ||
2753 | } | 2791 | } |
2754 | } | 2792 | } |
2793 | |||
2794 | TaskInventory.LockItemsForRead(false); | ||
2755 | } | 2795 | } |
2756 | 2796 | ||
2757 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2797 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2811,7 +2851,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2811 | /// <param name="scale"></param> | 2851 | /// <param name="scale"></param> |
2812 | public void Resize(Vector3 scale) | 2852 | public void Resize(Vector3 scale) |
2813 | { | 2853 | { |
2814 | StoreUndoState(); | 2854 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2815 | m_shape.Scale = scale; | 2855 | m_shape.Scale = scale; |
2816 | 2856 | ||
2817 | ParentGroup.HasGroupChanged = true; | 2857 | ParentGroup.HasGroupChanged = true; |
@@ -2820,38 +2860,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2820 | 2860 | ||
2821 | public void RotLookAt(Quaternion target, float strength, float damping) | 2861 | public void RotLookAt(Quaternion target, float strength, float damping) |
2822 | { | 2862 | { |
2823 | rotLookAt(target, strength, damping); | 2863 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2824 | } | ||
2825 | |||
2826 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2827 | { | ||
2828 | if (IsAttachment) | ||
2829 | { | ||
2830 | /* | ||
2831 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2832 | if (avatar != null) | ||
2833 | { | ||
2834 | Rotate the Av? | ||
2835 | } */ | ||
2836 | } | ||
2837 | else | ||
2838 | { | ||
2839 | APIDDamp = damping; | ||
2840 | APIDStrength = strength; | ||
2841 | APIDTarget = target; | ||
2842 | } | ||
2843 | } | ||
2844 | |||
2845 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2846 | { | ||
2847 | APIDDamp = damp; | ||
2848 | APIDStrength = strength; | ||
2849 | APIDTarget = rot; | ||
2850 | } | ||
2851 | |||
2852 | public void stopLookAt() | ||
2853 | { | ||
2854 | APIDTarget = Quaternion.Identity; | ||
2855 | } | 2864 | } |
2856 | 2865 | ||
2857 | /// <summary> | 2866 | /// <summary> |
@@ -2863,7 +2872,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2863 | 2872 | ||
2864 | if (m_parentGroup != null) | 2873 | if (m_parentGroup != null) |
2865 | { | 2874 | { |
2866 | m_parentGroup.QueueForUpdateCheck(); | 2875 | if (!m_parentGroup.areUpdatesSuspended) |
2876 | { | ||
2877 | m_parentGroup.QueueForUpdateCheck(); | ||
2878 | } | ||
2867 | } | 2879 | } |
2868 | 2880 | ||
2869 | int timeNow = Util.UnixTimeSinceEpoch(); | 2881 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -3080,8 +3092,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3080 | { | 3092 | { |
3081 | const float ROTATION_TOLERANCE = 0.01f; | 3093 | const float ROTATION_TOLERANCE = 0.01f; |
3082 | const float VELOCITY_TOLERANCE = 0.001f; | 3094 | const float VELOCITY_TOLERANCE = 0.001f; |
3083 | const float POSITION_TOLERANCE = 0.05f; | 3095 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3084 | const int TIME_MS_TOLERANCE = 3000; | 3096 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3085 | 3097 | ||
3086 | if (m_updateFlag == 1) | 3098 | if (m_updateFlag == 1) |
3087 | { | 3099 | { |
@@ -3095,7 +3107,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3095 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 3107 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
3096 | { | 3108 | { |
3097 | AddTerseUpdateToAllAvatars(); | 3109 | AddTerseUpdateToAllAvatars(); |
3098 | ClearUpdateSchedule(); | 3110 | |
3099 | 3111 | ||
3100 | // This causes the Scene to 'poll' physical objects every couple of frames | 3112 | // This causes the Scene to 'poll' physical objects every couple of frames |
3101 | // bad, so it's been replaced by an event driven method. | 3113 | // bad, so it's been replaced by an event driven method. |
@@ -3113,16 +3125,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3113 | m_lastAngularVelocity = AngularVelocity; | 3125 | m_lastAngularVelocity = AngularVelocity; |
3114 | m_lastTerseSent = Environment.TickCount; | 3126 | m_lastTerseSent = Environment.TickCount; |
3115 | } | 3127 | } |
3128 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
3129 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
3116 | } | 3130 | } |
3117 | else | 3131 | else |
3118 | { | 3132 | { |
3119 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 3133 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3120 | { | 3134 | { |
3121 | AddFullUpdateToAllAvatars(); | 3135 | AddFullUpdateToAllAvatars(); |
3122 | ClearUpdateSchedule(); | 3136 | m_updateFlag = 0; //Same here |
3123 | } | 3137 | } |
3124 | } | 3138 | } |
3125 | ClearUpdateSchedule(); | 3139 | m_updateFlag = 0; |
3126 | } | 3140 | } |
3127 | 3141 | ||
3128 | /// <summary> | 3142 | /// <summary> |
@@ -3150,17 +3164,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3150 | if (!UUID.TryParse(sound, out soundID)) | 3164 | if (!UUID.TryParse(sound, out soundID)) |
3151 | { | 3165 | { |
3152 | // search sound file from inventory | 3166 | // search sound file from inventory |
3153 | lock (TaskInventory) | 3167 | TaskInventory.LockItemsForRead(true); |
3168 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3154 | { | 3169 | { |
3155 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3170 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3156 | { | 3171 | { |
3157 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3172 | soundID = item.Value.ItemID; |
3158 | { | 3173 | break; |
3159 | soundID = item.Value.ItemID; | ||
3160 | break; | ||
3161 | } | ||
3162 | } | 3174 | } |
3163 | } | 3175 | } |
3176 | TaskInventory.LockItemsForRead(false); | ||
3164 | } | 3177 | } |
3165 | 3178 | ||
3166 | if (soundID == UUID.Zero) | 3179 | if (soundID == UUID.Zero) |
@@ -3597,7 +3610,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3597 | 3610 | ||
3598 | public void StopLookAt() | 3611 | public void StopLookAt() |
3599 | { | 3612 | { |
3600 | m_parentGroup.stopLookAt(); | 3613 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3601 | 3614 | ||
3602 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3615 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3603 | } | 3616 | } |
@@ -3624,10 +3637,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3624 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3637 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3625 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3638 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3626 | } | 3639 | } |
3627 | 3640 | public void StoreUndoState(UndoType type) | |
3628 | public void StoreUndoState() | ||
3629 | { | 3641 | { |
3630 | if (!Undoing) | 3642 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3631 | { | 3643 | { |
3632 | if (!IgnoreUndoUpdate) | 3644 | if (!IgnoreUndoUpdate) |
3633 | { | 3645 | { |
@@ -3638,17 +3650,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3638 | if (m_undo.Count > 0) | 3650 | if (m_undo.Count > 0) |
3639 | { | 3651 | { |
3640 | UndoState last = m_undo.Peek(); | 3652 | UndoState last = m_undo.Peek(); |
3641 | if (last != null) | 3653 | |
3642 | { | ||
3643 | if (last.Compare(this)) | ||
3644 | return; | ||
3645 | } | ||
3646 | } | 3654 | } |
3647 | 3655 | ||
3648 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3656 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3649 | { | 3657 | { |
3650 | UndoState nUndo = new UndoState(this); | 3658 | UndoState lastUndo = m_undo.Peek(); |
3651 | 3659 | ||
3660 | UndoState nUndo = new UndoState(this, type); | ||
3661 | |||
3662 | if (lastUndo != null) | ||
3663 | { | ||
3664 | TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); | ||
3665 | if (ts.TotalMilliseconds < 500) | ||
3666 | { | ||
3667 | //Delete the last entry since it was less than 500 milliseconds ago | ||
3668 | nUndo.Merge(lastUndo); | ||
3669 | m_undo.Pop(); | ||
3670 | } | ||
3671 | } | ||
3652 | m_undo.Push(nUndo); | 3672 | m_undo.Push(nUndo); |
3653 | } | 3673 | } |
3654 | 3674 | ||
@@ -4125,11 +4145,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4125 | if (m_undo.Count > 0) | 4145 | if (m_undo.Count > 0) |
4126 | { | 4146 | { |
4127 | UndoState nUndo = null; | 4147 | UndoState nUndo = null; |
4148 | UndoState goback = m_undo.Pop(); | ||
4128 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4149 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4129 | { | 4150 | { |
4130 | nUndo = new UndoState(this); | 4151 | nUndo = new UndoState(this, goback.Type); |
4131 | } | 4152 | } |
4132 | UndoState goback = m_undo.Pop(); | 4153 | |
4154 | |||
4133 | if (goback != null) | 4155 | if (goback != null) |
4134 | { | 4156 | { |
4135 | goback.PlaybackState(this); | 4157 | goback.PlaybackState(this); |
@@ -4144,13 +4166,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4144 | { | 4166 | { |
4145 | lock (m_redo) | 4167 | lock (m_redo) |
4146 | { | 4168 | { |
4169 | UndoState gofwd = m_redo.Pop(); | ||
4147 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4170 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4148 | { | 4171 | { |
4149 | UndoState nUndo = new UndoState(this); | 4172 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4150 | 4173 | ||
4151 | m_undo.Push(nUndo); | 4174 | m_undo.Push(nUndo); |
4152 | } | 4175 | } |
4153 | UndoState gofwd = m_redo.Pop(); | ||
4154 | if (gofwd != null) | 4176 | if (gofwd != null) |
4155 | gofwd.PlayfwdState(this); | 4177 | gofwd.PlayfwdState(this); |
4156 | } | 4178 | } |
@@ -4599,8 +4621,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4599 | { | 4621 | { |
4600 | m_shape.TextureEntry = textureEntry; | 4622 | m_shape.TextureEntry = textureEntry; |
4601 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4623 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4602 | 4624 | m_updateFlag = 1; | |
4603 | ParentGroup.HasGroupChanged = true; | 4625 | ParentGroup.HasGroupChanged = true; |
4626 | |||
4604 | //This is madness.. | 4627 | //This is madness.. |
4605 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4628 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4606 | //This is sparta | 4629 | //This is sparta |
@@ -4833,5 +4856,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4833 | Color color = Color; | 4856 | Color color = Color; |
4834 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4857 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4835 | } | 4858 | } |
4859 | |||
4860 | public void ResetOwnerChangeFlag() | ||
4861 | { | ||
4862 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4863 | |||
4864 | foreach (UUID itemID in inv) | ||
4865 | { | ||
4866 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4867 | item.OwnerChanged = false; | ||
4868 | Inventory.UpdateInventoryItem(item, false, false); | ||
4869 | } | ||
4870 | } | ||
4836 | } | 4871 | } |
4837 | } | 4872 | } |