diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 283 |
1 files changed, 160 insertions, 123 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4fcd8f5..0297a39 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; |
@@ -529,12 +539,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
529 | } | 539 | } |
530 | 540 | ||
531 | /// <value> | 541 | /// <value> |
532 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 542 | /// Get the inventory list |
533 | /// </value> | 543 | /// </value> |
534 | public TaskInventoryDictionary TaskInventory | 544 | public TaskInventoryDictionary TaskInventory |
535 | { | 545 | { |
536 | get { return m_inventory.Items; } | 546 | get { |
537 | set { m_inventory.Items = value; } | 547 | return m_inventory.Items; |
548 | } | ||
549 | set { | ||
550 | m_inventory.Items = value; | ||
551 | } | ||
538 | } | 552 | } |
539 | 553 | ||
540 | /// <summary> | 554 | /// <summary> |
@@ -674,14 +688,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
674 | set { m_LoopSoundSlavePrims = value; } | 688 | set { m_LoopSoundSlavePrims = value; } |
675 | } | 689 | } |
676 | 690 | ||
677 | |||
678 | public Byte[] TextureAnimation | 691 | public Byte[] TextureAnimation |
679 | { | 692 | { |
680 | get { return m_TextureAnimation; } | 693 | get { return m_TextureAnimation; } |
681 | set { m_TextureAnimation = value; } | 694 | set { m_TextureAnimation = value; } |
682 | } | 695 | } |
683 | 696 | ||
684 | |||
685 | public Byte[] ParticleSystem | 697 | public Byte[] ParticleSystem |
686 | { | 698 | { |
687 | get { return m_particleSystem; } | 699 | get { return m_particleSystem; } |
@@ -735,7 +747,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
735 | set | 747 | set |
736 | { | 748 | { |
737 | m_groupPosition = value; | 749 | m_groupPosition = value; |
738 | |||
739 | PhysicsActor actor = PhysActor; | 750 | PhysicsActor actor = PhysActor; |
740 | if (actor != null) | 751 | if (actor != null) |
741 | { | 752 | { |
@@ -755,25 +766,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
755 | 766 | ||
756 | // Tell the physics engines that this prim changed. | 767 | // Tell the physics engines that this prim changed. |
757 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 768 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
769 | |||
758 | } | 770 | } |
759 | catch (Exception e) | 771 | catch (Exception e) |
760 | { | 772 | { |
761 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); | 773 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); |
762 | } | 774 | } |
763 | } | 775 | } |
764 | |||
765 | // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too | ||
766 | if (m_sitTargetAvatar != UUID.Zero) | ||
767 | { | ||
768 | if (m_parentGroup != null) // TODO can there be a SOP without a SOG? | ||
769 | { | ||
770 | ScenePresence avatar; | ||
771 | if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) | ||
772 | { | ||
773 | avatar.ParentPosition = GetWorldPosition(); | ||
774 | } | ||
775 | } | ||
776 | } | ||
777 | } | 776 | } |
778 | } | 777 | } |
779 | 778 | ||
@@ -782,7 +781,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
782 | get { return m_offsetPosition; } | 781 | get { return m_offsetPosition; } |
783 | set | 782 | set |
784 | { | 783 | { |
785 | StoreUndoState(); | 784 | Vector3 oldpos = m_offsetPosition; |
785 | StoreUndoState(UndoType.STATE_PRIM_POSITION); | ||
786 | m_offsetPosition = value; | 786 | m_offsetPosition = value; |
787 | 787 | ||
788 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 788 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -796,7 +796,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
796 | // Tell the physics engines that this prim changed. | 796 | // Tell the physics engines that this prim changed. |
797 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 797 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
798 | } | 798 | } |
799 | |||
800 | if (!m_parentGroup.m_dupeInProgress) | ||
801 | { | ||
802 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
803 | foreach (ScenePresence av in avs) | ||
804 | { | ||
805 | if (av.LinkedPrim == m_uuid) | ||
806 | { | ||
807 | Vector3 offset = (m_offsetPosition - oldpos); | ||
808 | av.OffsetPosition += offset; | ||
809 | av.SendAvatarDataToAllAgents(); | ||
810 | } | ||
811 | } | ||
812 | } | ||
799 | } | 813 | } |
814 | TriggerScriptChangedEvent(Changed.POSITION); | ||
800 | } | 815 | } |
801 | } | 816 | } |
802 | 817 | ||
@@ -838,7 +853,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
838 | 853 | ||
839 | set | 854 | set |
840 | { | 855 | { |
841 | StoreUndoState(); | 856 | StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
842 | m_rotationOffset = value; | 857 | m_rotationOffset = value; |
843 | 858 | ||
844 | PhysicsActor actor = PhysActor; | 859 | PhysicsActor actor = PhysActor; |
@@ -922,7 +937,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
922 | /// <summary></summary> | 937 | /// <summary></summary> |
923 | public Vector3 Acceleration | 938 | public Vector3 Acceleration |
924 | { | 939 | { |
925 | get { return m_acceleration; } | 940 | get |
941 | { | ||
942 | PhysicsActor actor = PhysActor; | ||
943 | if (actor != null) | ||
944 | { | ||
945 | m_acceleration = actor.Acceleration; | ||
946 | } | ||
947 | return m_acceleration; | ||
948 | } | ||
949 | |||
926 | set { m_acceleration = value; } | 950 | set { m_acceleration = value; } |
927 | } | 951 | } |
928 | 952 | ||
@@ -1013,7 +1037,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1013 | get { return m_shape.Scale; } | 1037 | get { return m_shape.Scale; } |
1014 | set | 1038 | set |
1015 | { | 1039 | { |
1016 | StoreUndoState(); | 1040 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
1017 | if (m_shape != null) | 1041 | if (m_shape != null) |
1018 | { | 1042 | { |
1019 | m_shape.Scale = value; | 1043 | m_shape.Scale = value; |
@@ -1081,9 +1105,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1081 | { | 1105 | { |
1082 | get { | 1106 | get { |
1083 | if (IsAttachment) | 1107 | if (IsAttachment) |
1084 | return GroupPosition; | 1108 | return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); |
1085 | 1109 | ||
1086 | return m_offsetPosition + m_groupPosition; } | 1110 | // return m_offsetPosition + m_groupPosition; } |
1111 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
1087 | } | 1112 | } |
1088 | 1113 | ||
1089 | public SceneObjectGroup ParentGroup | 1114 | public SceneObjectGroup ParentGroup |
@@ -1242,6 +1267,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1242 | _flags = value; | 1267 | _flags = value; |
1243 | } | 1268 | } |
1244 | } | 1269 | } |
1270 | |||
1271 | [XmlIgnore] | ||
1272 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1273 | { | ||
1274 | get { return m_occupied; } | ||
1275 | set { m_occupied = value; } | ||
1276 | } | ||
1245 | 1277 | ||
1246 | 1278 | ||
1247 | public UUID SitTargetAvatar | 1279 | public UUID SitTargetAvatar |
@@ -1317,14 +1349,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1317 | } | 1349 | } |
1318 | } | 1350 | } |
1319 | 1351 | ||
1320 | /// <summary> | ||
1321 | /// Clear all pending updates of parts to clients | ||
1322 | /// </summary> | ||
1323 | private void ClearUpdateSchedule() | ||
1324 | { | ||
1325 | m_updateFlag = 0; | ||
1326 | } | ||
1327 | |||
1328 | private void SendObjectPropertiesToClient(UUID AgentID) | 1352 | private void SendObjectPropertiesToClient(UUID AgentID) |
1329 | { | 1353 | { |
1330 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1354 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1575,14 +1599,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1575 | // or flexible | 1599 | // or flexible |
1576 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1600 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1577 | { | 1601 | { |
1578 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 1602 | try |
1579 | string.Format("{0}/{1}", Name, UUID), | 1603 | { |
1580 | Shape, | 1604 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
1581 | AbsolutePosition, | 1605 | string.Format("{0}/{1}", Name, UUID), |
1582 | Scale, | 1606 | Shape, |
1583 | RotationOffset, | 1607 | AbsolutePosition, |
1584 | RigidBody); | 1608 | Scale, |
1585 | 1609 | RotationOffset, | |
1610 | RigidBody); | ||
1611 | PhysActor.SetMaterial(Material); | ||
1612 | } | ||
1613 | catch | ||
1614 | { | ||
1615 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
1616 | PhysActor = null; | ||
1617 | } | ||
1586 | // Basic Physics returns null.. joy joy joy. | 1618 | // Basic Physics returns null.. joy joy joy. |
1587 | if (PhysActor != null) | 1619 | if (PhysActor != null) |
1588 | { | 1620 | { |
@@ -1610,7 +1642,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1610 | { | 1642 | { |
1611 | m_redo.Clear(); | 1643 | m_redo.Clear(); |
1612 | } | 1644 | } |
1613 | StoreUndoState(); | 1645 | StoreUndoState(UndoType.STATE_ALL); |
1614 | } | 1646 | } |
1615 | 1647 | ||
1616 | public byte ConvertScriptUintToByte(uint indata) | 1648 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1679,6 +1711,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1679 | 1711 | ||
1680 | // Move afterwards ResetIDs as it clears the localID | 1712 | // Move afterwards ResetIDs as it clears the localID |
1681 | dupe.LocalId = localID; | 1713 | dupe.LocalId = localID; |
1714 | if(dupe.PhysActor != null) | ||
1715 | dupe.PhysActor.LocalID = localID; | ||
1716 | |||
1682 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 1717 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
1683 | dupe._lastOwnerID = OwnerID; | 1718 | dupe._lastOwnerID = OwnerID; |
1684 | 1719 | ||
@@ -1722,7 +1757,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1722 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1757 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1723 | part.Shape = shape; | 1758 | part.Shape = shape; |
1724 | 1759 | ||
1725 | part.Name = "Primitive"; | 1760 | part.Name = "Object"; |
1726 | part._ownerID = UUID.Random(); | 1761 | part._ownerID = UUID.Random(); |
1727 | 1762 | ||
1728 | return part; | 1763 | return part; |
@@ -2082,12 +2117,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2082 | public Vector3 GetWorldPosition() | 2117 | public Vector3 GetWorldPosition() |
2083 | { | 2118 | { |
2084 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 2119 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
2085 | |||
2086 | Vector3 axPos = OffsetPosition; | 2120 | Vector3 axPos = OffsetPosition; |
2087 | |||
2088 | axPos *= parentRot; | 2121 | axPos *= parentRot; |
2089 | Vector3 translationOffsetPosition = axPos; | 2122 | Vector3 translationOffsetPosition = axPos; |
2090 | return GroupPosition + translationOffsetPosition; | 2123 | if(_parentID == 0) |
2124 | { | ||
2125 | return GroupPosition; | ||
2126 | } | ||
2127 | else | ||
2128 | { | ||
2129 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
2130 | } | ||
2091 | } | 2131 | } |
2092 | 2132 | ||
2093 | /// <summary> | 2133 | /// <summary> |
@@ -2098,7 +2138,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2098 | { | 2138 | { |
2099 | Quaternion newRot; | 2139 | Quaternion newRot; |
2100 | 2140 | ||
2101 | if (this.LinkNum == 0) | 2141 | if (this.LinkNum < 2) //KF Single or root prim |
2102 | { | 2142 | { |
2103 | newRot = RotationOffset; | 2143 | newRot = RotationOffset; |
2104 | } | 2144 | } |
@@ -2744,17 +2784,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2744 | //Trys to fetch sound id from prim's inventory. | 2784 | //Trys to fetch sound id from prim's inventory. |
2745 | //Prim's inventory doesn't support non script items yet | 2785 | //Prim's inventory doesn't support non script items yet |
2746 | 2786 | ||
2747 | lock (TaskInventory) | 2787 | TaskInventory.LockItemsForRead(true); |
2788 | |||
2789 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2748 | { | 2790 | { |
2749 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2791 | if (item.Value.Name == sound) |
2750 | { | 2792 | { |
2751 | if (item.Value.Name == sound) | 2793 | soundID = item.Value.ItemID; |
2752 | { | 2794 | break; |
2753 | soundID = item.Value.ItemID; | ||
2754 | break; | ||
2755 | } | ||
2756 | } | 2795 | } |
2757 | } | 2796 | } |
2797 | |||
2798 | TaskInventory.LockItemsForRead(false); | ||
2758 | } | 2799 | } |
2759 | 2800 | ||
2760 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2801 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2814,7 +2855,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2814 | /// <param name="scale"></param> | 2855 | /// <param name="scale"></param> |
2815 | public void Resize(Vector3 scale) | 2856 | public void Resize(Vector3 scale) |
2816 | { | 2857 | { |
2817 | StoreUndoState(); | 2858 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2818 | m_shape.Scale = scale; | 2859 | m_shape.Scale = scale; |
2819 | 2860 | ||
2820 | ParentGroup.HasGroupChanged = true; | 2861 | ParentGroup.HasGroupChanged = true; |
@@ -2823,38 +2864,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2823 | 2864 | ||
2824 | public void RotLookAt(Quaternion target, float strength, float damping) | 2865 | public void RotLookAt(Quaternion target, float strength, float damping) |
2825 | { | 2866 | { |
2826 | rotLookAt(target, strength, damping); | 2867 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2827 | } | ||
2828 | |||
2829 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2830 | { | ||
2831 | if (IsAttachment) | ||
2832 | { | ||
2833 | /* | ||
2834 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2835 | if (avatar != null) | ||
2836 | { | ||
2837 | Rotate the Av? | ||
2838 | } */ | ||
2839 | } | ||
2840 | else | ||
2841 | { | ||
2842 | APIDDamp = damping; | ||
2843 | APIDStrength = strength; | ||
2844 | APIDTarget = target; | ||
2845 | } | ||
2846 | } | ||
2847 | |||
2848 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2849 | { | ||
2850 | APIDDamp = damp; | ||
2851 | APIDStrength = strength; | ||
2852 | APIDTarget = rot; | ||
2853 | } | ||
2854 | |||
2855 | public void stopLookAt() | ||
2856 | { | ||
2857 | APIDTarget = Quaternion.Identity; | ||
2858 | } | 2868 | } |
2859 | 2869 | ||
2860 | /// <summary> | 2870 | /// <summary> |
@@ -2866,7 +2876,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2866 | 2876 | ||
2867 | if (m_parentGroup != null) | 2877 | if (m_parentGroup != null) |
2868 | { | 2878 | { |
2869 | m_parentGroup.QueueForUpdateCheck(); | 2879 | if (!m_parentGroup.areUpdatesSuspended) |
2880 | { | ||
2881 | m_parentGroup.QueueForUpdateCheck(); | ||
2882 | } | ||
2870 | } | 2883 | } |
2871 | 2884 | ||
2872 | int timeNow = Util.UnixTimeSinceEpoch(); | 2885 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -3083,8 +3096,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3083 | { | 3096 | { |
3084 | const float ROTATION_TOLERANCE = 0.01f; | 3097 | const float ROTATION_TOLERANCE = 0.01f; |
3085 | const float VELOCITY_TOLERANCE = 0.001f; | 3098 | const float VELOCITY_TOLERANCE = 0.001f; |
3086 | const float POSITION_TOLERANCE = 0.05f; | 3099 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3087 | const int TIME_MS_TOLERANCE = 3000; | 3100 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3088 | 3101 | ||
3089 | if (m_updateFlag == 1) | 3102 | if (m_updateFlag == 1) |
3090 | { | 3103 | { |
@@ -3098,7 +3111,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3098 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 3111 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
3099 | { | 3112 | { |
3100 | AddTerseUpdateToAllAvatars(); | 3113 | AddTerseUpdateToAllAvatars(); |
3101 | ClearUpdateSchedule(); | 3114 | |
3102 | 3115 | ||
3103 | // This causes the Scene to 'poll' physical objects every couple of frames | 3116 | // This causes the Scene to 'poll' physical objects every couple of frames |
3104 | // bad, so it's been replaced by an event driven method. | 3117 | // bad, so it's been replaced by an event driven method. |
@@ -3116,16 +3129,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3116 | m_lastAngularVelocity = AngularVelocity; | 3129 | m_lastAngularVelocity = AngularVelocity; |
3117 | m_lastTerseSent = Environment.TickCount; | 3130 | m_lastTerseSent = Environment.TickCount; |
3118 | } | 3131 | } |
3132 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
3133 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
3119 | } | 3134 | } |
3120 | else | 3135 | else |
3121 | { | 3136 | { |
3122 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 3137 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3123 | { | 3138 | { |
3124 | AddFullUpdateToAllAvatars(); | 3139 | AddFullUpdateToAllAvatars(); |
3125 | ClearUpdateSchedule(); | 3140 | m_updateFlag = 0; //Same here |
3126 | } | 3141 | } |
3127 | } | 3142 | } |
3128 | ClearUpdateSchedule(); | 3143 | m_updateFlag = 0; |
3129 | } | 3144 | } |
3130 | 3145 | ||
3131 | /// <summary> | 3146 | /// <summary> |
@@ -3153,17 +3168,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3153 | if (!UUID.TryParse(sound, out soundID)) | 3168 | if (!UUID.TryParse(sound, out soundID)) |
3154 | { | 3169 | { |
3155 | // search sound file from inventory | 3170 | // search sound file from inventory |
3156 | lock (TaskInventory) | 3171 | TaskInventory.LockItemsForRead(true); |
3172 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3157 | { | 3173 | { |
3158 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3174 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3159 | { | 3175 | { |
3160 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3176 | soundID = item.Value.ItemID; |
3161 | { | 3177 | break; |
3162 | soundID = item.Value.ItemID; | ||
3163 | break; | ||
3164 | } | ||
3165 | } | 3178 | } |
3166 | } | 3179 | } |
3180 | TaskInventory.LockItemsForRead(false); | ||
3167 | } | 3181 | } |
3168 | 3182 | ||
3169 | if (soundID == UUID.Zero) | 3183 | if (soundID == UUID.Zero) |
@@ -3593,7 +3607,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3593 | 3607 | ||
3594 | public void StopLookAt() | 3608 | public void StopLookAt() |
3595 | { | 3609 | { |
3596 | m_parentGroup.stopLookAt(); | 3610 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3597 | 3611 | ||
3598 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3612 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3599 | } | 3613 | } |
@@ -3620,10 +3634,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3620 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3634 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3621 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3635 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3622 | } | 3636 | } |
3623 | 3637 | public void StoreUndoState(UndoType type) | |
3624 | public void StoreUndoState() | ||
3625 | { | 3638 | { |
3626 | if (!Undoing) | 3639 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3627 | { | 3640 | { |
3628 | if (!IgnoreUndoUpdate) | 3641 | if (!IgnoreUndoUpdate) |
3629 | { | 3642 | { |
@@ -3634,17 +3647,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3634 | if (m_undo.Count > 0) | 3647 | if (m_undo.Count > 0) |
3635 | { | 3648 | { |
3636 | UndoState last = m_undo.Peek(); | 3649 | UndoState last = m_undo.Peek(); |
3637 | if (last != null) | 3650 | |
3638 | { | ||
3639 | if (last.Compare(this)) | ||
3640 | return; | ||
3641 | } | ||
3642 | } | 3651 | } |
3643 | 3652 | ||
3644 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3653 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3645 | { | 3654 | { |
3646 | UndoState nUndo = new UndoState(this); | 3655 | UndoState lastUndo = m_undo.Peek(); |
3647 | 3656 | ||
3657 | UndoState nUndo = new UndoState(this, type); | ||
3658 | |||
3659 | if (lastUndo != null) | ||
3660 | { | ||
3661 | TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); | ||
3662 | if (ts.TotalMilliseconds < 500) | ||
3663 | { | ||
3664 | //Delete the last entry since it was less than 500 milliseconds ago | ||
3665 | nUndo.Merge(lastUndo); | ||
3666 | m_undo.Pop(); | ||
3667 | } | ||
3668 | } | ||
3648 | m_undo.Push(nUndo); | 3669 | m_undo.Push(nUndo); |
3649 | } | 3670 | } |
3650 | 3671 | ||
@@ -4121,11 +4142,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4121 | if (m_undo.Count > 0) | 4142 | if (m_undo.Count > 0) |
4122 | { | 4143 | { |
4123 | UndoState nUndo = null; | 4144 | UndoState nUndo = null; |
4145 | UndoState goback = m_undo.Pop(); | ||
4124 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4146 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4125 | { | 4147 | { |
4126 | nUndo = new UndoState(this); | 4148 | nUndo = new UndoState(this, goback.Type); |
4127 | } | 4149 | } |
4128 | UndoState goback = m_undo.Pop(); | 4150 | |
4151 | |||
4129 | if (goback != null) | 4152 | if (goback != null) |
4130 | { | 4153 | { |
4131 | goback.PlaybackState(this); | 4154 | goback.PlaybackState(this); |
@@ -4140,13 +4163,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4140 | { | 4163 | { |
4141 | lock (m_redo) | 4164 | lock (m_redo) |
4142 | { | 4165 | { |
4166 | UndoState gofwd = m_redo.Pop(); | ||
4143 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4167 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4144 | { | 4168 | { |
4145 | UndoState nUndo = new UndoState(this); | 4169 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4146 | 4170 | ||
4147 | m_undo.Push(nUndo); | 4171 | m_undo.Push(nUndo); |
4148 | } | 4172 | } |
4149 | UndoState gofwd = m_redo.Pop(); | ||
4150 | if (gofwd != null) | 4173 | if (gofwd != null) |
4151 | gofwd.PlayfwdState(this); | 4174 | gofwd.PlayfwdState(this); |
4152 | } | 4175 | } |
@@ -4410,6 +4433,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4410 | Scale, | 4433 | Scale, |
4411 | RotationOffset, | 4434 | RotationOffset, |
4412 | UsePhysics); | 4435 | UsePhysics); |
4436 | PhysActor.SetMaterial(Material); | ||
4413 | 4437 | ||
4414 | pa = PhysActor; | 4438 | pa = PhysActor; |
4415 | if (pa != null) | 4439 | if (pa != null) |
@@ -4595,8 +4619,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4595 | { | 4619 | { |
4596 | m_shape.TextureEntry = textureEntry; | 4620 | m_shape.TextureEntry = textureEntry; |
4597 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4621 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4598 | 4622 | m_updateFlag = 1; | |
4599 | ParentGroup.HasGroupChanged = true; | 4623 | ParentGroup.HasGroupChanged = true; |
4624 | |||
4600 | //This is madness.. | 4625 | //This is madness.. |
4601 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4626 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4602 | //This is sparta | 4627 | //This is sparta |
@@ -4829,5 +4854,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4829 | Color color = Color; | 4854 | Color color = Color; |
4830 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4855 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4831 | } | 4856 | } |
4857 | |||
4858 | public void ResetOwnerChangeFlag() | ||
4859 | { | ||
4860 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4861 | |||
4862 | foreach (UUID itemID in inv) | ||
4863 | { | ||
4864 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4865 | item.OwnerChanged = false; | ||
4866 | Inventory.UpdateInventoryItem(item, false, false); | ||
4867 | } | ||
4868 | } | ||
4832 | } | 4869 | } |
4833 | } | 4870 | } |