diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 293 |
1 files changed, 163 insertions, 130 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 331abb2..4e1d6b6 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. |
@@ -189,7 +190,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | 190 | ||
190 | public UUID FromFolderID; | 191 | public UUID FromFolderID; |
191 | 192 | ||
192 | 193 | // The following two are to hold the attachment data | |
194 | // while an object is inworld | ||
195 | [XmlIgnore] | ||
196 | public byte AttachPoint = 0; | ||
197 | |||
198 | [XmlIgnore] | ||
199 | public Vector3 AttachOffset = Vector3.Zero; | ||
200 | |||
201 | [XmlIgnore] | ||
193 | public int STATUS_ROTATE_X; | 202 | public int STATUS_ROTATE_X; |
194 | 203 | ||
195 | 204 | ||
@@ -284,6 +293,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
284 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 293 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
285 | private Vector3 m_sitTargetPosition; | 294 | private Vector3 m_sitTargetPosition; |
286 | private string m_sitAnimation = "SIT"; | 295 | private string m_sitAnimation = "SIT"; |
296 | private bool m_occupied; // KF if any av is sitting on this prim | ||
287 | private string m_text = String.Empty; | 297 | private string m_text = String.Empty; |
288 | private string m_touchName = String.Empty; | 298 | private string m_touchName = String.Empty; |
289 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 299 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
@@ -373,7 +383,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
373 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, | 383 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, |
374 | Quaternion rotationOffset, Vector3 offsetPosition) | 384 | Quaternion rotationOffset, Vector3 offsetPosition) |
375 | { | 385 | { |
376 | m_name = "Primitive"; | 386 | m_name = "Object"; |
377 | 387 | ||
378 | Rezzed = DateTime.UtcNow; | 388 | Rezzed = DateTime.UtcNow; |
379 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); | 389 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); |
@@ -429,7 +439,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
429 | private uint _ownerMask = (uint)PermissionMask.All; | 439 | private uint _ownerMask = (uint)PermissionMask.All; |
430 | private uint _groupMask = (uint)PermissionMask.None; | 440 | private uint _groupMask = (uint)PermissionMask.None; |
431 | private uint _everyoneMask = (uint)PermissionMask.None; | 441 | private uint _everyoneMask = (uint)PermissionMask.None; |
432 | private uint _nextOwnerMask = (uint)PermissionMask.All; | 442 | private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); |
433 | private PrimFlags _flags = PrimFlags.None; | 443 | private PrimFlags _flags = PrimFlags.None; |
434 | private DateTime m_expires; | 444 | private DateTime m_expires; |
435 | private DateTime m_rezzed; | 445 | private DateTime m_rezzed; |
@@ -528,12 +538,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
528 | } | 538 | } |
529 | 539 | ||
530 | /// <value> | 540 | /// <value> |
531 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 541 | /// Get the inventory list |
532 | /// </value> | 542 | /// </value> |
533 | public TaskInventoryDictionary TaskInventory | 543 | public TaskInventoryDictionary TaskInventory |
534 | { | 544 | { |
535 | get { return m_inventory.Items; } | 545 | get { |
536 | set { m_inventory.Items = value; } | 546 | return m_inventory.Items; |
547 | } | ||
548 | set { | ||
549 | m_inventory.Items = value; | ||
550 | } | ||
537 | } | 551 | } |
538 | 552 | ||
539 | /// <summary> | 553 | /// <summary> |
@@ -673,14 +687,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
673 | set { m_LoopSoundSlavePrims = value; } | 687 | set { m_LoopSoundSlavePrims = value; } |
674 | } | 688 | } |
675 | 689 | ||
676 | |||
677 | public Byte[] TextureAnimation | 690 | public Byte[] TextureAnimation |
678 | { | 691 | { |
679 | get { return m_TextureAnimation; } | 692 | get { return m_TextureAnimation; } |
680 | set { m_TextureAnimation = value; } | 693 | set { m_TextureAnimation = value; } |
681 | } | 694 | } |
682 | 695 | ||
683 | |||
684 | public Byte[] ParticleSystem | 696 | public Byte[] ParticleSystem |
685 | { | 697 | { |
686 | get { return m_particleSystem; } | 698 | get { return m_particleSystem; } |
@@ -717,9 +729,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
717 | { | 729 | { |
718 | // If this is a linkset, we don't want the physics engine mucking up our group position here. | 730 | // If this is a linkset, we don't want the physics engine mucking up our group position here. |
719 | PhysicsActor actor = PhysActor; | 731 | PhysicsActor actor = PhysActor; |
720 | if (actor != null && _parentID == 0) | 732 | if (_parentID == 0) |
721 | { | 733 | { |
722 | m_groupPosition = actor.Position; | 734 | if (actor != null) |
735 | m_groupPosition = actor.Position; | ||
736 | return m_groupPosition; | ||
723 | } | 737 | } |
724 | 738 | ||
725 | if (IsAttachment) | 739 | if (IsAttachment) |
@@ -729,12 +743,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
729 | return sp.AbsolutePosition; | 743 | return sp.AbsolutePosition; |
730 | } | 744 | } |
731 | 745 | ||
746 | // use root prim's group position. Physics may have updated it | ||
747 | if (ParentGroup.RootPart != this) | ||
748 | m_groupPosition = ParentGroup.RootPart.GroupPosition; | ||
732 | return m_groupPosition; | 749 | return m_groupPosition; |
733 | } | 750 | } |
734 | set | 751 | set |
735 | { | 752 | { |
736 | m_groupPosition = value; | 753 | m_groupPosition = value; |
737 | |||
738 | PhysicsActor actor = PhysActor; | 754 | PhysicsActor actor = PhysActor; |
739 | if (actor != null) | 755 | if (actor != null) |
740 | { | 756 | { |
@@ -754,25 +770,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
754 | 770 | ||
755 | // Tell the physics engines that this prim changed. | 771 | // Tell the physics engines that this prim changed. |
756 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 772 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
773 | |||
757 | } | 774 | } |
758 | catch (Exception e) | 775 | catch (Exception e) |
759 | { | 776 | { |
760 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); | 777 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); |
761 | } | 778 | } |
762 | } | 779 | } |
763 | |||
764 | // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too | ||
765 | if (m_sitTargetAvatar != UUID.Zero) | ||
766 | { | ||
767 | if (m_parentGroup != null) // TODO can there be a SOP without a SOG? | ||
768 | { | ||
769 | ScenePresence avatar; | ||
770 | if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) | ||
771 | { | ||
772 | avatar.ParentPosition = GetWorldPosition(); | ||
773 | } | ||
774 | } | ||
775 | } | ||
776 | } | 780 | } |
777 | } | 781 | } |
778 | 782 | ||
@@ -781,7 +785,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
781 | get { return m_offsetPosition; } | 785 | get { return m_offsetPosition; } |
782 | set | 786 | set |
783 | { | 787 | { |
784 | StoreUndoState(); | 788 | Vector3 oldpos = m_offsetPosition; |
789 | StoreUndoState(UndoType.STATE_PRIM_POSITION); | ||
785 | m_offsetPosition = value; | 790 | m_offsetPosition = value; |
786 | 791 | ||
787 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 792 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -795,7 +800,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
795 | // Tell the physics engines that this prim changed. | 800 | // Tell the physics engines that this prim changed. |
796 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 801 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
797 | } | 802 | } |
803 | |||
804 | if (!m_parentGroup.m_dupeInProgress) | ||
805 | { | ||
806 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
807 | foreach (ScenePresence av in avs) | ||
808 | { | ||
809 | if (av.LinkedPrim == m_uuid) | ||
810 | { | ||
811 | Vector3 offset = (m_offsetPosition - oldpos); | ||
812 | av.OffsetPosition += offset; | ||
813 | av.SendAvatarDataToAllAgents(); | ||
814 | } | ||
815 | } | ||
816 | } | ||
798 | } | 817 | } |
818 | TriggerScriptChangedEvent(Changed.POSITION); | ||
799 | } | 819 | } |
800 | } | 820 | } |
801 | 821 | ||
@@ -837,7 +857,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
837 | 857 | ||
838 | set | 858 | set |
839 | { | 859 | { |
840 | StoreUndoState(); | 860 | StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
841 | m_rotationOffset = value; | 861 | m_rotationOffset = value; |
842 | 862 | ||
843 | PhysicsActor actor = PhysActor; | 863 | PhysicsActor actor = PhysActor; |
@@ -921,7 +941,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
921 | /// <summary></summary> | 941 | /// <summary></summary> |
922 | public Vector3 Acceleration | 942 | public Vector3 Acceleration |
923 | { | 943 | { |
924 | get { return m_acceleration; } | 944 | get |
945 | { | ||
946 | PhysicsActor actor = PhysActor; | ||
947 | if (actor != null) | ||
948 | { | ||
949 | m_acceleration = actor.Acceleration; | ||
950 | } | ||
951 | return m_acceleration; | ||
952 | } | ||
953 | |||
925 | set { m_acceleration = value; } | 954 | set { m_acceleration = value; } |
926 | } | 955 | } |
927 | 956 | ||
@@ -1012,7 +1041,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1012 | get { return m_shape.Scale; } | 1041 | get { return m_shape.Scale; } |
1013 | set | 1042 | set |
1014 | { | 1043 | { |
1015 | StoreUndoState(); | 1044 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
1016 | if (m_shape != null) | 1045 | if (m_shape != null) |
1017 | { | 1046 | { |
1018 | m_shape.Scale = value; | 1047 | m_shape.Scale = value; |
@@ -1078,11 +1107,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1078 | 1107 | ||
1079 | public Vector3 AbsolutePosition | 1108 | public Vector3 AbsolutePosition |
1080 | { | 1109 | { |
1081 | get { | 1110 | get |
1082 | if (IsAttachment) | 1111 | { |
1083 | return GroupPosition; | 1112 | return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); |
1084 | 1113 | } | |
1085 | return m_offsetPosition + m_groupPosition; } | ||
1086 | } | 1114 | } |
1087 | 1115 | ||
1088 | public SceneObjectGroup ParentGroup | 1116 | public SceneObjectGroup ParentGroup |
@@ -1241,6 +1269,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1241 | _flags = value; | 1269 | _flags = value; |
1242 | } | 1270 | } |
1243 | } | 1271 | } |
1272 | |||
1273 | [XmlIgnore] | ||
1274 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1275 | { | ||
1276 | get { return m_occupied; } | ||
1277 | set { m_occupied = value; } | ||
1278 | } | ||
1244 | 1279 | ||
1245 | 1280 | ||
1246 | public UUID SitTargetAvatar | 1281 | public UUID SitTargetAvatar |
@@ -1316,14 +1351,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1316 | } | 1351 | } |
1317 | } | 1352 | } |
1318 | 1353 | ||
1319 | /// <summary> | ||
1320 | /// Clear all pending updates of parts to clients | ||
1321 | /// </summary> | ||
1322 | private void ClearUpdateSchedule() | ||
1323 | { | ||
1324 | m_updateFlag = 0; | ||
1325 | } | ||
1326 | |||
1327 | private void SendObjectPropertiesToClient(UUID AgentID) | 1354 | private void SendObjectPropertiesToClient(UUID AgentID) |
1328 | { | 1355 | { |
1329 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1356 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1574,14 +1601,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1574 | // or flexible | 1601 | // or flexible |
1575 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1602 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1576 | { | 1603 | { |
1577 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 1604 | try |
1578 | string.Format("{0}/{1}", Name, UUID), | 1605 | { |
1579 | Shape, | 1606 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
1580 | AbsolutePosition, | 1607 | string.Format("{0}/{1}", Name, UUID), |
1581 | Scale, | 1608 | Shape, |
1582 | RotationOffset, | 1609 | AbsolutePosition, |
1583 | RigidBody); | 1610 | Scale, |
1584 | 1611 | RotationOffset, | |
1612 | RigidBody); | ||
1613 | PhysActor.SetMaterial(Material); | ||
1614 | } | ||
1615 | catch | ||
1616 | { | ||
1617 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
1618 | PhysActor = null; | ||
1619 | } | ||
1585 | // Basic Physics returns null.. joy joy joy. | 1620 | // Basic Physics returns null.. joy joy joy. |
1586 | if (PhysActor != null) | 1621 | if (PhysActor != null) |
1587 | { | 1622 | { |
@@ -1609,7 +1644,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1609 | { | 1644 | { |
1610 | m_redo.Clear(); | 1645 | m_redo.Clear(); |
1611 | } | 1646 | } |
1612 | StoreUndoState(); | 1647 | StoreUndoState(UndoType.STATE_ALL); |
1613 | } | 1648 | } |
1614 | 1649 | ||
1615 | public byte ConvertScriptUintToByte(uint indata) | 1650 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1678,6 +1713,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1678 | 1713 | ||
1679 | // Move afterwards ResetIDs as it clears the localID | 1714 | // Move afterwards ResetIDs as it clears the localID |
1680 | dupe.LocalId = localID; | 1715 | dupe.LocalId = localID; |
1716 | if(dupe.PhysActor != null) | ||
1717 | dupe.PhysActor.LocalID = localID; | ||
1718 | |||
1681 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 1719 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
1682 | dupe._lastOwnerID = OwnerID; | 1720 | dupe._lastOwnerID = OwnerID; |
1683 | 1721 | ||
@@ -1721,7 +1759,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1721 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1759 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1722 | part.Shape = shape; | 1760 | part.Shape = shape; |
1723 | 1761 | ||
1724 | part.Name = "Primitive"; | 1762 | part.Name = "Object"; |
1725 | part._ownerID = UUID.Random(); | 1763 | part._ownerID = UUID.Random(); |
1726 | 1764 | ||
1727 | return part; | 1765 | return part; |
@@ -2074,19 +2112,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2074 | public Vector3 GetWorldPosition() | 2112 | public Vector3 GetWorldPosition() |
2075 | { | 2113 | { |
2076 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 2114 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
2077 | |||
2078 | Vector3 axPos = OffsetPosition; | 2115 | Vector3 axPos = OffsetPosition; |
2079 | |||
2080 | axPos *= parentRot; | 2116 | axPos *= parentRot; |
2081 | Vector3 translationOffsetPosition = axPos; | 2117 | Vector3 translationOffsetPosition = axPos; |
2082 | 2118 | if(_parentID == 0) | |
2083 | // m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name); | 2119 | { |
2084 | 2120 | return GroupPosition; | |
2085 | Vector3 worldPos = GroupPosition + translationOffsetPosition; | 2121 | } |
2086 | 2122 | else | |
2087 | // m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name); | 2123 | { |
2088 | 2124 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | |
2089 | return worldPos; | 2125 | } |
2090 | } | 2126 | } |
2091 | 2127 | ||
2092 | /// <summary> | 2128 | /// <summary> |
@@ -2743,17 +2779,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2743 | //Trys to fetch sound id from prim's inventory. | 2779 | //Trys to fetch sound id from prim's inventory. |
2744 | //Prim's inventory doesn't support non script items yet | 2780 | //Prim's inventory doesn't support non script items yet |
2745 | 2781 | ||
2746 | lock (TaskInventory) | 2782 | TaskInventory.LockItemsForRead(true); |
2783 | |||
2784 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2747 | { | 2785 | { |
2748 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2786 | if (item.Value.Name == sound) |
2749 | { | 2787 | { |
2750 | if (item.Value.Name == sound) | 2788 | soundID = item.Value.ItemID; |
2751 | { | 2789 | break; |
2752 | soundID = item.Value.ItemID; | ||
2753 | break; | ||
2754 | } | ||
2755 | } | 2790 | } |
2756 | } | 2791 | } |
2792 | |||
2793 | TaskInventory.LockItemsForRead(false); | ||
2757 | } | 2794 | } |
2758 | 2795 | ||
2759 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2796 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2813,7 +2850,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2813 | /// <param name="scale"></param> | 2850 | /// <param name="scale"></param> |
2814 | public void Resize(Vector3 scale) | 2851 | public void Resize(Vector3 scale) |
2815 | { | 2852 | { |
2816 | StoreUndoState(); | 2853 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2817 | m_shape.Scale = scale; | 2854 | m_shape.Scale = scale; |
2818 | 2855 | ||
2819 | ParentGroup.HasGroupChanged = true; | 2856 | ParentGroup.HasGroupChanged = true; |
@@ -2822,38 +2859,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2822 | 2859 | ||
2823 | public void RotLookAt(Quaternion target, float strength, float damping) | 2860 | public void RotLookAt(Quaternion target, float strength, float damping) |
2824 | { | 2861 | { |
2825 | rotLookAt(target, strength, damping); | 2862 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2826 | } | ||
2827 | |||
2828 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2829 | { | ||
2830 | if (IsAttachment) | ||
2831 | { | ||
2832 | /* | ||
2833 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2834 | if (avatar != null) | ||
2835 | { | ||
2836 | Rotate the Av? | ||
2837 | } */ | ||
2838 | } | ||
2839 | else | ||
2840 | { | ||
2841 | APIDDamp = damping; | ||
2842 | APIDStrength = strength; | ||
2843 | APIDTarget = target; | ||
2844 | } | ||
2845 | } | ||
2846 | |||
2847 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2848 | { | ||
2849 | APIDDamp = damp; | ||
2850 | APIDStrength = strength; | ||
2851 | APIDTarget = rot; | ||
2852 | } | ||
2853 | |||
2854 | public void stopLookAt() | ||
2855 | { | ||
2856 | APIDTarget = Quaternion.Identity; | ||
2857 | } | 2863 | } |
2858 | 2864 | ||
2859 | /// <summary> | 2865 | /// <summary> |
@@ -2865,7 +2871,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2865 | 2871 | ||
2866 | if (m_parentGroup != null) | 2872 | if (m_parentGroup != null) |
2867 | { | 2873 | { |
2868 | m_parentGroup.QueueForUpdateCheck(); | 2874 | if (!m_parentGroup.areUpdatesSuspended) |
2875 | { | ||
2876 | m_parentGroup.QueueForUpdateCheck(); | ||
2877 | } | ||
2869 | } | 2878 | } |
2870 | 2879 | ||
2871 | int timeNow = Util.UnixTimeSinceEpoch(); | 2880 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -3082,8 +3091,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3082 | { | 3091 | { |
3083 | const float ROTATION_TOLERANCE = 0.01f; | 3092 | const float ROTATION_TOLERANCE = 0.01f; |
3084 | const float VELOCITY_TOLERANCE = 0.001f; | 3093 | const float VELOCITY_TOLERANCE = 0.001f; |
3085 | const float POSITION_TOLERANCE = 0.05f; | 3094 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3086 | const int TIME_MS_TOLERANCE = 3000; | 3095 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3087 | 3096 | ||
3088 | if (m_updateFlag == 1) | 3097 | if (m_updateFlag == 1) |
3089 | { | 3098 | { |
@@ -3097,7 +3106,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3097 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 3106 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
3098 | { | 3107 | { |
3099 | AddTerseUpdateToAllAvatars(); | 3108 | AddTerseUpdateToAllAvatars(); |
3100 | ClearUpdateSchedule(); | 3109 | |
3101 | 3110 | ||
3102 | // This causes the Scene to 'poll' physical objects every couple of frames | 3111 | // This causes the Scene to 'poll' physical objects every couple of frames |
3103 | // bad, so it's been replaced by an event driven method. | 3112 | // bad, so it's been replaced by an event driven method. |
@@ -3115,16 +3124,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3115 | m_lastAngularVelocity = AngularVelocity; | 3124 | m_lastAngularVelocity = AngularVelocity; |
3116 | m_lastTerseSent = Environment.TickCount; | 3125 | m_lastTerseSent = Environment.TickCount; |
3117 | } | 3126 | } |
3127 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
3128 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
3118 | } | 3129 | } |
3119 | else | 3130 | else |
3120 | { | 3131 | { |
3121 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 3132 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3122 | { | 3133 | { |
3123 | AddFullUpdateToAllAvatars(); | 3134 | AddFullUpdateToAllAvatars(); |
3124 | ClearUpdateSchedule(); | 3135 | m_updateFlag = 0; //Same here |
3125 | } | 3136 | } |
3126 | } | 3137 | } |
3127 | ClearUpdateSchedule(); | 3138 | m_updateFlag = 0; |
3128 | } | 3139 | } |
3129 | 3140 | ||
3130 | /// <summary> | 3141 | /// <summary> |
@@ -3152,17 +3163,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3152 | if (!UUID.TryParse(sound, out soundID)) | 3163 | if (!UUID.TryParse(sound, out soundID)) |
3153 | { | 3164 | { |
3154 | // search sound file from inventory | 3165 | // search sound file from inventory |
3155 | lock (TaskInventory) | 3166 | TaskInventory.LockItemsForRead(true); |
3167 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3156 | { | 3168 | { |
3157 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3169 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3158 | { | 3170 | { |
3159 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3171 | soundID = item.Value.ItemID; |
3160 | { | 3172 | break; |
3161 | soundID = item.Value.ItemID; | ||
3162 | break; | ||
3163 | } | ||
3164 | } | 3173 | } |
3165 | } | 3174 | } |
3175 | TaskInventory.LockItemsForRead(false); | ||
3166 | } | 3176 | } |
3167 | 3177 | ||
3168 | if (soundID == UUID.Zero) | 3178 | if (soundID == UUID.Zero) |
@@ -3592,7 +3602,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3592 | 3602 | ||
3593 | public void StopLookAt() | 3603 | public void StopLookAt() |
3594 | { | 3604 | { |
3595 | m_parentGroup.stopLookAt(); | 3605 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3596 | 3606 | ||
3597 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3607 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3598 | } | 3608 | } |
@@ -3619,10 +3629,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3619 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3629 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3620 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3630 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3621 | } | 3631 | } |
3622 | 3632 | public void StoreUndoState(UndoType type) | |
3623 | public void StoreUndoState() | ||
3624 | { | 3633 | { |
3625 | if (!Undoing) | 3634 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3626 | { | 3635 | { |
3627 | if (!IgnoreUndoUpdate) | 3636 | if (!IgnoreUndoUpdate) |
3628 | { | 3637 | { |
@@ -3633,17 +3642,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3633 | if (m_undo.Count > 0) | 3642 | if (m_undo.Count > 0) |
3634 | { | 3643 | { |
3635 | UndoState last = m_undo.Peek(); | 3644 | UndoState last = m_undo.Peek(); |
3636 | if (last != null) | 3645 | |
3637 | { | ||
3638 | if (last.Compare(this)) | ||
3639 | return; | ||
3640 | } | ||
3641 | } | 3646 | } |
3642 | 3647 | ||
3643 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3648 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3644 | { | 3649 | { |
3645 | UndoState nUndo = new UndoState(this); | 3650 | UndoState lastUndo = m_undo.Peek(); |
3646 | 3651 | ||
3652 | UndoState nUndo = new UndoState(this, type); | ||
3653 | |||
3654 | if (lastUndo != null) | ||
3655 | { | ||
3656 | TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); | ||
3657 | if (ts.TotalMilliseconds < 500) | ||
3658 | { | ||
3659 | //Delete the last entry since it was less than 500 milliseconds ago | ||
3660 | nUndo.Merge(lastUndo); | ||
3661 | m_undo.Pop(); | ||
3662 | } | ||
3663 | } | ||
3647 | m_undo.Push(nUndo); | 3664 | m_undo.Push(nUndo); |
3648 | } | 3665 | } |
3649 | 3666 | ||
@@ -4120,11 +4137,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4120 | if (m_undo.Count > 0) | 4137 | if (m_undo.Count > 0) |
4121 | { | 4138 | { |
4122 | UndoState nUndo = null; | 4139 | UndoState nUndo = null; |
4140 | UndoState goback = m_undo.Pop(); | ||
4123 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4141 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4124 | { | 4142 | { |
4125 | nUndo = new UndoState(this); | 4143 | nUndo = new UndoState(this, goback.Type); |
4126 | } | 4144 | } |
4127 | UndoState goback = m_undo.Pop(); | 4145 | |
4146 | |||
4128 | if (goback != null) | 4147 | if (goback != null) |
4129 | { | 4148 | { |
4130 | goback.PlaybackState(this); | 4149 | goback.PlaybackState(this); |
@@ -4139,13 +4158,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4139 | { | 4158 | { |
4140 | lock (m_redo) | 4159 | lock (m_redo) |
4141 | { | 4160 | { |
4161 | UndoState gofwd = m_redo.Pop(); | ||
4142 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4162 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4143 | { | 4163 | { |
4144 | UndoState nUndo = new UndoState(this); | 4164 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4145 | 4165 | ||
4146 | m_undo.Push(nUndo); | 4166 | m_undo.Push(nUndo); |
4147 | } | 4167 | } |
4148 | UndoState gofwd = m_redo.Pop(); | ||
4149 | if (gofwd != null) | 4168 | if (gofwd != null) |
4150 | gofwd.PlayfwdState(this); | 4169 | gofwd.PlayfwdState(this); |
4151 | } | 4170 | } |
@@ -4409,6 +4428,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4409 | Scale, | 4428 | Scale, |
4410 | RotationOffset, | 4429 | RotationOffset, |
4411 | UsePhysics); | 4430 | UsePhysics); |
4431 | PhysActor.SetMaterial(Material); | ||
4412 | 4432 | ||
4413 | pa = PhysActor; | 4433 | pa = PhysActor; |
4414 | if (pa != null) | 4434 | if (pa != null) |
@@ -4594,8 +4614,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4594 | { | 4614 | { |
4595 | m_shape.TextureEntry = textureEntry; | 4615 | m_shape.TextureEntry = textureEntry; |
4596 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4616 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4597 | 4617 | m_updateFlag = 1; | |
4598 | ParentGroup.HasGroupChanged = true; | 4618 | ParentGroup.HasGroupChanged = true; |
4619 | |||
4599 | //This is madness.. | 4620 | //This is madness.. |
4600 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4621 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4601 | //This is sparta | 4622 | //This is sparta |
@@ -4828,5 +4849,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4828 | Color color = Color; | 4849 | Color color = Color; |
4829 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4850 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4830 | } | 4851 | } |
4852 | |||
4853 | public void ResetOwnerChangeFlag() | ||
4854 | { | ||
4855 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4856 | |||
4857 | foreach (UUID itemID in inv) | ||
4858 | { | ||
4859 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4860 | item.OwnerChanged = false; | ||
4861 | Inventory.UpdateInventoryItem(item, false, false); | ||
4862 | } | ||
4863 | } | ||
4831 | } | 4864 | } |
4832 | } | 4865 | } |