diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 290 |
1 files changed, 167 insertions, 123 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7a6449d..5521326 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; |
@@ -470,12 +480,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
470 | } | 480 | } |
471 | 481 | ||
472 | /// <value> | 482 | /// <value> |
473 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 483 | /// Get the inventory list |
474 | /// </value> | 484 | /// </value> |
475 | public TaskInventoryDictionary TaskInventory | 485 | public TaskInventoryDictionary TaskInventory |
476 | { | 486 | { |
477 | get { return m_inventory.Items; } | 487 | get { |
478 | set { m_inventory.Items = value; } | 488 | return m_inventory.Items; |
489 | } | ||
490 | set { | ||
491 | m_inventory.Items = value; | ||
492 | } | ||
479 | } | 493 | } |
480 | 494 | ||
481 | /// <summary> | 495 | /// <summary> |
@@ -615,14 +629,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
615 | set { m_LoopSoundSlavePrims = value; } | 629 | set { m_LoopSoundSlavePrims = value; } |
616 | } | 630 | } |
617 | 631 | ||
618 | |||
619 | public Byte[] TextureAnimation | 632 | public Byte[] TextureAnimation |
620 | { | 633 | { |
621 | get { return m_TextureAnimation; } | 634 | get { return m_TextureAnimation; } |
622 | set { m_TextureAnimation = value; } | 635 | set { m_TextureAnimation = value; } |
623 | } | 636 | } |
624 | 637 | ||
625 | |||
626 | public Byte[] ParticleSystem | 638 | public Byte[] ParticleSystem |
627 | { | 639 | { |
628 | get { return m_particleSystem; } | 640 | get { return m_particleSystem; } |
@@ -676,7 +688,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
676 | set | 688 | set |
677 | { | 689 | { |
678 | m_groupPosition = value; | 690 | m_groupPosition = value; |
679 | |||
680 | PhysicsActor actor = PhysActor; | 691 | PhysicsActor actor = PhysActor; |
681 | if (actor != null) | 692 | if (actor != null) |
682 | { | 693 | { |
@@ -696,25 +707,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
696 | 707 | ||
697 | // Tell the physics engines that this prim changed. | 708 | // Tell the physics engines that this prim changed. |
698 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 709 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
710 | |||
699 | } | 711 | } |
700 | catch (Exception e) | 712 | catch (Exception e) |
701 | { | 713 | { |
702 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); | 714 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); |
703 | } | 715 | } |
704 | } | 716 | } |
705 | |||
706 | // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too | ||
707 | if (m_sitTargetAvatar != UUID.Zero) | ||
708 | { | ||
709 | if (m_parentGroup != null) // TODO can there be a SOP without a SOG? | ||
710 | { | ||
711 | ScenePresence avatar; | ||
712 | if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) | ||
713 | { | ||
714 | avatar.ParentPosition = GetWorldPosition(); | ||
715 | } | ||
716 | } | ||
717 | } | ||
718 | } | 717 | } |
719 | } | 718 | } |
720 | 719 | ||
@@ -723,7 +722,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
723 | get { return m_offsetPosition; } | 722 | get { return m_offsetPosition; } |
724 | set | 723 | set |
725 | { | 724 | { |
726 | StoreUndoState(); | 725 | Vector3 oldpos = m_offsetPosition; |
726 | StoreUndoState(UndoType.STATE_PRIM_POSITION); | ||
727 | m_offsetPosition = value; | 727 | m_offsetPosition = value; |
728 | 728 | ||
729 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 729 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -737,7 +737,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
737 | // Tell the physics engines that this prim changed. | 737 | // Tell the physics engines that this prim changed. |
738 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 738 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
739 | } | 739 | } |
740 | |||
741 | if (!m_parentGroup.m_dupeInProgress) | ||
742 | { | ||
743 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
744 | foreach (ScenePresence av in avs) | ||
745 | { | ||
746 | if (av.LinkedPrim == m_uuid) | ||
747 | { | ||
748 | Vector3 offset = (m_offsetPosition - oldpos); | ||
749 | av.OffsetPosition += offset; | ||
750 | av.SendFullUpdateToAllClients(); | ||
751 | } | ||
752 | } | ||
753 | } | ||
740 | } | 754 | } |
755 | TriggerScriptChangedEvent(Changed.POSITION); | ||
741 | } | 756 | } |
742 | } | 757 | } |
743 | 758 | ||
@@ -779,7 +794,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
779 | 794 | ||
780 | set | 795 | set |
781 | { | 796 | { |
782 | StoreUndoState(); | 797 | StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
783 | m_rotationOffset = value; | 798 | m_rotationOffset = value; |
784 | 799 | ||
785 | PhysicsActor actor = PhysActor; | 800 | PhysicsActor actor = PhysActor; |
@@ -863,7 +878,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
863 | /// <summary></summary> | 878 | /// <summary></summary> |
864 | public Vector3 Acceleration | 879 | public Vector3 Acceleration |
865 | { | 880 | { |
866 | get { return m_acceleration; } | 881 | get |
882 | { | ||
883 | PhysicsActor actor = PhysActor; | ||
884 | if (actor != null) | ||
885 | { | ||
886 | m_acceleration = actor.Acceleration; | ||
887 | } | ||
888 | return m_acceleration; | ||
889 | } | ||
890 | |||
867 | set { m_acceleration = value; } | 891 | set { m_acceleration = value; } |
868 | } | 892 | } |
869 | 893 | ||
@@ -968,7 +992,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
968 | get { return m_shape.Scale; } | 992 | get { return m_shape.Scale; } |
969 | set | 993 | set |
970 | { | 994 | { |
971 | StoreUndoState(); | 995 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
972 | if (m_shape != null) | 996 | if (m_shape != null) |
973 | { | 997 | { |
974 | m_shape.Scale = value; | 998 | m_shape.Scale = value; |
@@ -1036,9 +1060,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1036 | { | 1060 | { |
1037 | get { | 1061 | get { |
1038 | if (IsAttachment) | 1062 | if (IsAttachment) |
1039 | return GroupPosition; | 1063 | return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); |
1040 | 1064 | ||
1041 | return m_offsetPosition + m_groupPosition; } | 1065 | // return m_offsetPosition + m_groupPosition; } |
1066 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
1042 | } | 1067 | } |
1043 | 1068 | ||
1044 | public SceneObjectGroup ParentGroup | 1069 | public SceneObjectGroup ParentGroup |
@@ -1197,6 +1222,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1197 | _flags = value; | 1222 | _flags = value; |
1198 | } | 1223 | } |
1199 | } | 1224 | } |
1225 | |||
1226 | [XmlIgnore] | ||
1227 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1228 | { | ||
1229 | get { return m_occupied; } | ||
1230 | set { m_occupied = value; } | ||
1231 | } | ||
1200 | 1232 | ||
1201 | 1233 | ||
1202 | public UUID SitTargetAvatar | 1234 | public UUID SitTargetAvatar |
@@ -1272,14 +1304,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1272 | } | 1304 | } |
1273 | } | 1305 | } |
1274 | 1306 | ||
1275 | /// <summary> | ||
1276 | /// Clear all pending updates of parts to clients | ||
1277 | /// </summary> | ||
1278 | private void ClearUpdateSchedule() | ||
1279 | { | ||
1280 | m_updateFlag = 0; | ||
1281 | } | ||
1282 | |||
1283 | private void SendObjectPropertiesToClient(UUID AgentID) | 1307 | private void SendObjectPropertiesToClient(UUID AgentID) |
1284 | { | 1308 | { |
1285 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1309 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1530,14 +1554,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1530 | // or flexible | 1554 | // or flexible |
1531 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1555 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1532 | { | 1556 | { |
1533 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 1557 | try |
1534 | string.Format("{0}/{1}", Name, UUID), | 1558 | { |
1535 | Shape, | 1559 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
1536 | AbsolutePosition, | 1560 | string.Format("{0}/{1}", Name, UUID), |
1537 | Scale, | 1561 | Shape, |
1538 | RotationOffset, | 1562 | AbsolutePosition, |
1539 | RigidBody); | 1563 | Scale, |
1540 | 1564 | RotationOffset, | |
1565 | RigidBody); | ||
1566 | } | ||
1567 | catch | ||
1568 | { | ||
1569 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
1570 | PhysActor = null; | ||
1571 | } | ||
1541 | // Basic Physics returns null.. joy joy joy. | 1572 | // Basic Physics returns null.. joy joy joy. |
1542 | if (PhysActor != null) | 1573 | if (PhysActor != null) |
1543 | { | 1574 | { |
@@ -1565,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1565 | { | 1596 | { |
1566 | m_redo.Clear(); | 1597 | m_redo.Clear(); |
1567 | } | 1598 | } |
1568 | StoreUndoState(); | 1599 | StoreUndoState(UndoType.STATE_ALL); |
1569 | } | 1600 | } |
1570 | 1601 | ||
1571 | public byte ConvertScriptUintToByte(uint indata) | 1602 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1634,6 +1665,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1634 | 1665 | ||
1635 | // Move afterwards ResetIDs as it clears the localID | 1666 | // Move afterwards ResetIDs as it clears the localID |
1636 | dupe.LocalId = localID; | 1667 | dupe.LocalId = localID; |
1668 | if(dupe.PhysActor != null) | ||
1669 | dupe.PhysActor.LocalID = localID; | ||
1670 | |||
1637 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 1671 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
1638 | dupe._lastOwnerID = OwnerID; | 1672 | dupe._lastOwnerID = OwnerID; |
1639 | 1673 | ||
@@ -1677,7 +1711,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1677 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1711 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1678 | part.Shape = shape; | 1712 | part.Shape = shape; |
1679 | 1713 | ||
1680 | part.Name = "Primitive"; | 1714 | part.Name = "Object"; |
1681 | part._ownerID = UUID.Random(); | 1715 | part._ownerID = UUID.Random(); |
1682 | 1716 | ||
1683 | return part; | 1717 | return part; |
@@ -2037,12 +2071,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2037 | public Vector3 GetWorldPosition() | 2071 | public Vector3 GetWorldPosition() |
2038 | { | 2072 | { |
2039 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 2073 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
2040 | |||
2041 | Vector3 axPos = OffsetPosition; | 2074 | Vector3 axPos = OffsetPosition; |
2042 | |||
2043 | axPos *= parentRot; | 2075 | axPos *= parentRot; |
2044 | Vector3 translationOffsetPosition = axPos; | 2076 | Vector3 translationOffsetPosition = axPos; |
2045 | 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 | } | ||
2046 | } | 2085 | } |
2047 | 2086 | ||
2048 | /// <summary> | 2087 | /// <summary> |
@@ -2053,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2053 | { | 2092 | { |
2054 | Quaternion newRot; | 2093 | Quaternion newRot; |
2055 | 2094 | ||
2056 | if (this.LinkNum == 0) | 2095 | if (this.LinkNum < 2) //KF Single or root prim |
2057 | { | 2096 | { |
2058 | newRot = RotationOffset; | 2097 | newRot = RotationOffset; |
2059 | } | 2098 | } |
@@ -2699,17 +2738,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2699 | //Trys to fetch sound id from prim's inventory. | 2738 | //Trys to fetch sound id from prim's inventory. |
2700 | //Prim's inventory doesn't support non script items yet | 2739 | //Prim's inventory doesn't support non script items yet |
2701 | 2740 | ||
2702 | lock (TaskInventory) | 2741 | TaskInventory.LockItemsForRead(true); |
2742 | |||
2743 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2703 | { | 2744 | { |
2704 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2745 | if (item.Value.Name == sound) |
2705 | { | 2746 | { |
2706 | if (item.Value.Name == sound) | 2747 | soundID = item.Value.ItemID; |
2707 | { | 2748 | break; |
2708 | soundID = item.Value.ItemID; | ||
2709 | break; | ||
2710 | } | ||
2711 | } | 2749 | } |
2712 | } | 2750 | } |
2751 | |||
2752 | TaskInventory.LockItemsForRead(false); | ||
2713 | } | 2753 | } |
2714 | 2754 | ||
2715 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2755 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2769,7 +2809,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2769 | /// <param name="scale"></param> | 2809 | /// <param name="scale"></param> |
2770 | public void Resize(Vector3 scale) | 2810 | public void Resize(Vector3 scale) |
2771 | { | 2811 | { |
2772 | StoreUndoState(); | 2812 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2773 | m_shape.Scale = scale; | 2813 | m_shape.Scale = scale; |
2774 | 2814 | ||
2775 | ParentGroup.HasGroupChanged = true; | 2815 | ParentGroup.HasGroupChanged = true; |
@@ -2778,38 +2818,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2778 | 2818 | ||
2779 | public void RotLookAt(Quaternion target, float strength, float damping) | 2819 | public void RotLookAt(Quaternion target, float strength, float damping) |
2780 | { | 2820 | { |
2781 | rotLookAt(target, strength, damping); | 2821 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2782 | } | ||
2783 | |||
2784 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2785 | { | ||
2786 | if (IsAttachment) | ||
2787 | { | ||
2788 | /* | ||
2789 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2790 | if (avatar != null) | ||
2791 | { | ||
2792 | Rotate the Av? | ||
2793 | } */ | ||
2794 | } | ||
2795 | else | ||
2796 | { | ||
2797 | APIDDamp = damping; | ||
2798 | APIDStrength = strength; | ||
2799 | APIDTarget = target; | ||
2800 | } | ||
2801 | } | ||
2802 | |||
2803 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2804 | { | ||
2805 | APIDDamp = damp; | ||
2806 | APIDStrength = strength; | ||
2807 | APIDTarget = rot; | ||
2808 | } | ||
2809 | |||
2810 | public void stopLookAt() | ||
2811 | { | ||
2812 | APIDTarget = Quaternion.Identity; | ||
2813 | } | 2822 | } |
2814 | 2823 | ||
2815 | /// <summary> | 2824 | /// <summary> |
@@ -2821,7 +2830,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2821 | 2830 | ||
2822 | if (m_parentGroup != null) | 2831 | if (m_parentGroup != null) |
2823 | { | 2832 | { |
2824 | m_parentGroup.QueueForUpdateCheck(); | 2833 | if (!m_parentGroup.areUpdatesSuspended) |
2834 | { | ||
2835 | m_parentGroup.QueueForUpdateCheck(); | ||
2836 | } | ||
2825 | } | 2837 | } |
2826 | 2838 | ||
2827 | int timeNow = Util.UnixTimeSinceEpoch(); | 2839 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -3038,8 +3050,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3038 | { | 3050 | { |
3039 | const float ROTATION_TOLERANCE = 0.01f; | 3051 | const float ROTATION_TOLERANCE = 0.01f; |
3040 | const float VELOCITY_TOLERANCE = 0.001f; | 3052 | const float VELOCITY_TOLERANCE = 0.001f; |
3041 | const float POSITION_TOLERANCE = 0.05f; | 3053 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3042 | const int TIME_MS_TOLERANCE = 3000; | 3054 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3043 | 3055 | ||
3044 | if (m_updateFlag == 1) | 3056 | if (m_updateFlag == 1) |
3045 | { | 3057 | { |
@@ -3053,7 +3065,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3053 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 3065 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
3054 | { | 3066 | { |
3055 | AddTerseUpdateToAllAvatars(); | 3067 | AddTerseUpdateToAllAvatars(); |
3056 | ClearUpdateSchedule(); | 3068 | |
3057 | 3069 | ||
3058 | // 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 |
3059 | // bad, so it's been replaced by an event driven method. | 3071 | // bad, so it's been replaced by an event driven method. |
@@ -3071,16 +3083,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3071 | m_lastAngularVelocity = AngularVelocity; | 3083 | m_lastAngularVelocity = AngularVelocity; |
3072 | m_lastTerseSent = Environment.TickCount; | 3084 | m_lastTerseSent = Environment.TickCount; |
3073 | } | 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* | ||
3074 | } | 3088 | } |
3075 | else | 3089 | else |
3076 | { | 3090 | { |
3077 | 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 |
3078 | { | 3092 | { |
3079 | AddFullUpdateToAllAvatars(); | 3093 | AddFullUpdateToAllAvatars(); |
3080 | ClearUpdateSchedule(); | 3094 | m_updateFlag = 0; //Same here |
3081 | } | 3095 | } |
3082 | } | 3096 | } |
3083 | ClearUpdateSchedule(); | 3097 | m_updateFlag = 0; |
3084 | } | 3098 | } |
3085 | 3099 | ||
3086 | /// <summary> | 3100 | /// <summary> |
@@ -3100,6 +3114,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3100 | UUID ownerID = _ownerID; | 3114 | UUID ownerID = _ownerID; |
3101 | UUID objectID = ParentGroup.RootPart.UUID; | 3115 | UUID objectID = ParentGroup.RootPart.UUID; |
3102 | 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 | |||
3103 | UUID soundID = UUID.Zero; | 3126 | UUID soundID = UUID.Zero; |
3104 | Vector3 position = AbsolutePosition; // region local | 3127 | Vector3 position = AbsolutePosition; // region local |
3105 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; | 3128 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; |
@@ -3107,17 +3130,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3107 | if (!UUID.TryParse(sound, out soundID)) | 3130 | if (!UUID.TryParse(sound, out soundID)) |
3108 | { | 3131 | { |
3109 | // search sound file from inventory | 3132 | // search sound file from inventory |
3110 | lock (TaskInventory) | 3133 | TaskInventory.LockItemsForRead(true); |
3134 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3111 | { | 3135 | { |
3112 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3136 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3113 | { | 3137 | { |
3114 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3138 | soundID = item.Value.ItemID; |
3115 | { | 3139 | break; |
3116 | soundID = item.Value.ItemID; | ||
3117 | break; | ||
3118 | } | ||
3119 | } | 3140 | } |
3120 | } | 3141 | } |
3142 | TaskInventory.LockItemsForRead(false); | ||
3121 | } | 3143 | } |
3122 | 3144 | ||
3123 | if (soundID == UUID.Zero) | 3145 | if (soundID == UUID.Zero) |
@@ -3554,7 +3576,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3554 | 3576 | ||
3555 | public void StopLookAt() | 3577 | public void StopLookAt() |
3556 | { | 3578 | { |
3557 | m_parentGroup.stopLookAt(); | 3579 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3558 | 3580 | ||
3559 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3581 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3560 | } | 3582 | } |
@@ -3581,10 +3603,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3581 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3603 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3582 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3604 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3583 | } | 3605 | } |
3584 | 3606 | public void StoreUndoState(UndoType type) | |
3585 | public void StoreUndoState() | ||
3586 | { | 3607 | { |
3587 | if (!Undoing) | 3608 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3588 | { | 3609 | { |
3589 | if (!IgnoreUndoUpdate) | 3610 | if (!IgnoreUndoUpdate) |
3590 | { | 3611 | { |
@@ -3595,17 +3616,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3595 | if (m_undo.Count > 0) | 3616 | if (m_undo.Count > 0) |
3596 | { | 3617 | { |
3597 | UndoState last = m_undo.Peek(); | 3618 | UndoState last = m_undo.Peek(); |
3598 | if (last != null) | 3619 | |
3599 | { | ||
3600 | if (last.Compare(this)) | ||
3601 | return; | ||
3602 | } | ||
3603 | } | 3620 | } |
3604 | 3621 | ||
3605 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3622 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3606 | { | 3623 | { |
3607 | UndoState nUndo = new UndoState(this); | 3624 | UndoState lastUndo = m_undo.Peek(); |
3625 | |||
3626 | UndoState nUndo = new UndoState(this, type); | ||
3608 | 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 | } | ||
3609 | m_undo.Push(nUndo); | 3638 | m_undo.Push(nUndo); |
3610 | } | 3639 | } |
3611 | 3640 | ||
@@ -4082,11 +4111,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4082 | if (m_undo.Count > 0) | 4111 | if (m_undo.Count > 0) |
4083 | { | 4112 | { |
4084 | UndoState nUndo = null; | 4113 | UndoState nUndo = null; |
4114 | UndoState goback = m_undo.Pop(); | ||
4085 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4115 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4086 | { | 4116 | { |
4087 | nUndo = new UndoState(this); | 4117 | nUndo = new UndoState(this, goback.Type); |
4088 | } | 4118 | } |
4089 | UndoState goback = m_undo.Pop(); | 4119 | |
4120 | |||
4090 | if (goback != null) | 4121 | if (goback != null) |
4091 | { | 4122 | { |
4092 | goback.PlaybackState(this); | 4123 | goback.PlaybackState(this); |
@@ -4101,13 +4132,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4101 | { | 4132 | { |
4102 | lock (m_redo) | 4133 | lock (m_redo) |
4103 | { | 4134 | { |
4135 | UndoState gofwd = m_redo.Pop(); | ||
4104 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4136 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4105 | { | 4137 | { |
4106 | UndoState nUndo = new UndoState(this); | 4138 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4107 | 4139 | ||
4108 | m_undo.Push(nUndo); | 4140 | m_undo.Push(nUndo); |
4109 | } | 4141 | } |
4110 | UndoState gofwd = m_redo.Pop(); | ||
4111 | if (gofwd != null) | 4142 | if (gofwd != null) |
4112 | gofwd.PlayfwdState(this); | 4143 | gofwd.PlayfwdState(this); |
4113 | } | 4144 | } |
@@ -4555,8 +4586,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4555 | { | 4586 | { |
4556 | m_shape.TextureEntry = textureEntry; | 4587 | m_shape.TextureEntry = textureEntry; |
4557 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4588 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4558 | 4589 | m_updateFlag = 1; | |
4559 | ParentGroup.HasGroupChanged = true; | 4590 | ParentGroup.HasGroupChanged = true; |
4591 | |||
4560 | //This is madness.. | 4592 | //This is madness.. |
4561 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4593 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4562 | //This is sparta | 4594 | //This is sparta |
@@ -4789,5 +4821,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4789 | Color color = Color; | 4821 | Color color = Color; |
4790 | 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)); |
4791 | } | 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 | } | ||
4792 | } | 4836 | } |
4793 | } | 4837 | } |