diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 301 |
1 files changed, 167 insertions, 134 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8a8a699..e7e3014 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; } |
@@ -718,9 +730,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
718 | { | 730 | { |
719 | // If this is a linkset, we don't want the physics engine mucking up our group position here. | 731 | // If this is a linkset, we don't want the physics engine mucking up our group position here. |
720 | PhysicsActor actor = PhysActor; | 732 | PhysicsActor actor = PhysActor; |
721 | if (actor != null && _parentID == 0) | 733 | if (_parentID == 0) |
722 | { | 734 | { |
723 | m_groupPosition = actor.Position; | 735 | if (actor != null) |
736 | m_groupPosition = actor.Position; | ||
737 | return m_groupPosition; | ||
724 | } | 738 | } |
725 | 739 | ||
726 | if (IsAttachment) | 740 | if (IsAttachment) |
@@ -730,12 +744,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
730 | return sp.AbsolutePosition; | 744 | return sp.AbsolutePosition; |
731 | } | 745 | } |
732 | 746 | ||
747 | // use root prim's group position. Physics may have updated it | ||
748 | if (ParentGroup.RootPart != this) | ||
749 | m_groupPosition = ParentGroup.RootPart.GroupPosition; | ||
733 | return m_groupPosition; | 750 | return m_groupPosition; |
734 | } | 751 | } |
735 | set | 752 | set |
736 | { | 753 | { |
737 | m_groupPosition = value; | 754 | m_groupPosition = value; |
738 | |||
739 | PhysicsActor actor = PhysActor; | 755 | PhysicsActor actor = PhysActor; |
740 | if (actor != null) | 756 | if (actor != null) |
741 | { | 757 | { |
@@ -755,25 +771,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
755 | 771 | ||
756 | // Tell the physics engines that this prim changed. | 772 | // Tell the physics engines that this prim changed. |
757 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 773 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
774 | |||
758 | } | 775 | } |
759 | catch (Exception e) | 776 | catch (Exception e) |
760 | { | 777 | { |
761 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); | 778 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); |
762 | } | 779 | } |
763 | } | 780 | } |
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 | } | 781 | } |
778 | } | 782 | } |
779 | 783 | ||
@@ -782,7 +786,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
782 | get { return m_offsetPosition; } | 786 | get { return m_offsetPosition; } |
783 | set | 787 | set |
784 | { | 788 | { |
785 | StoreUndoState(); | 789 | Vector3 oldpos = m_offsetPosition; |
790 | StoreUndoState(UndoType.STATE_PRIM_POSITION); | ||
786 | m_offsetPosition = value; | 791 | m_offsetPosition = value; |
787 | 792 | ||
788 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 793 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -796,7 +801,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
796 | // Tell the physics engines that this prim changed. | 801 | // Tell the physics engines that this prim changed. |
797 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 802 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
798 | } | 803 | } |
804 | |||
805 | if (!m_parentGroup.m_dupeInProgress) | ||
806 | { | ||
807 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
808 | foreach (ScenePresence av in avs) | ||
809 | { | ||
810 | if (av.LinkedPrim == m_uuid) | ||
811 | { | ||
812 | Vector3 offset = (m_offsetPosition - oldpos); | ||
813 | av.OffsetPosition += offset; | ||
814 | av.SendAvatarDataToAllAgents(); | ||
815 | } | ||
816 | } | ||
817 | } | ||
799 | } | 818 | } |
819 | TriggerScriptChangedEvent(Changed.POSITION); | ||
800 | } | 820 | } |
801 | } | 821 | } |
802 | 822 | ||
@@ -838,7 +858,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
838 | 858 | ||
839 | set | 859 | set |
840 | { | 860 | { |
841 | StoreUndoState(); | 861 | StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
842 | m_rotationOffset = value; | 862 | m_rotationOffset = value; |
843 | 863 | ||
844 | PhysicsActor actor = PhysActor; | 864 | PhysicsActor actor = PhysActor; |
@@ -922,7 +942,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
922 | /// <summary></summary> | 942 | /// <summary></summary> |
923 | public Vector3 Acceleration | 943 | public Vector3 Acceleration |
924 | { | 944 | { |
925 | get { return m_acceleration; } | 945 | get |
946 | { | ||
947 | PhysicsActor actor = PhysActor; | ||
948 | if (actor != null) | ||
949 | { | ||
950 | m_acceleration = actor.Acceleration; | ||
951 | } | ||
952 | return m_acceleration; | ||
953 | } | ||
954 | |||
926 | set { m_acceleration = value; } | 955 | set { m_acceleration = value; } |
927 | } | 956 | } |
928 | 957 | ||
@@ -1013,7 +1042,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1013 | get { return m_shape.Scale; } | 1042 | get { return m_shape.Scale; } |
1014 | set | 1043 | set |
1015 | { | 1044 | { |
1016 | StoreUndoState(); | 1045 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
1017 | if (m_shape != null) | 1046 | if (m_shape != null) |
1018 | { | 1047 | { |
1019 | m_shape.Scale = value; | 1048 | m_shape.Scale = value; |
@@ -1079,11 +1108,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1079 | 1108 | ||
1080 | public Vector3 AbsolutePosition | 1109 | public Vector3 AbsolutePosition |
1081 | { | 1110 | { |
1082 | get { | 1111 | get |
1083 | if (IsAttachment) | 1112 | { |
1084 | return GroupPosition; | 1113 | return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); |
1085 | 1114 | } | |
1086 | return m_offsetPosition + m_groupPosition; } | ||
1087 | } | 1115 | } |
1088 | 1116 | ||
1089 | public SceneObjectGroup ParentGroup | 1117 | public SceneObjectGroup ParentGroup |
@@ -1242,6 +1270,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1242 | _flags = value; | 1270 | _flags = value; |
1243 | } | 1271 | } |
1244 | } | 1272 | } |
1273 | |||
1274 | [XmlIgnore] | ||
1275 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1276 | { | ||
1277 | get { return m_occupied; } | ||
1278 | set { m_occupied = value; } | ||
1279 | } | ||
1245 | 1280 | ||
1246 | 1281 | ||
1247 | public UUID SitTargetAvatar | 1282 | public UUID SitTargetAvatar |
@@ -1317,14 +1352,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1317 | } | 1352 | } |
1318 | } | 1353 | } |
1319 | 1354 | ||
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) | 1355 | private void SendObjectPropertiesToClient(UUID AgentID) |
1329 | { | 1356 | { |
1330 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1357 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1575,14 +1602,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1575 | // or flexible | 1602 | // or flexible |
1576 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1603 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1577 | { | 1604 | { |
1578 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 1605 | try |
1579 | string.Format("{0}/{1}", Name, UUID), | 1606 | { |
1580 | Shape, | 1607 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
1581 | AbsolutePosition, | 1608 | string.Format("{0}/{1}", Name, UUID), |
1582 | Scale, | 1609 | Shape, |
1583 | RotationOffset, | 1610 | AbsolutePosition, |
1584 | RigidBody); | 1611 | Scale, |
1585 | 1612 | RotationOffset, | |
1613 | RigidBody); | ||
1614 | PhysActor.SetMaterial(Material); | ||
1615 | } | ||
1616 | catch | ||
1617 | { | ||
1618 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
1619 | PhysActor = null; | ||
1620 | } | ||
1586 | // Basic Physics returns null.. joy joy joy. | 1621 | // Basic Physics returns null.. joy joy joy. |
1587 | if (PhysActor != null) | 1622 | if (PhysActor != null) |
1588 | { | 1623 | { |
@@ -1610,7 +1645,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1610 | { | 1645 | { |
1611 | m_redo.Clear(); | 1646 | m_redo.Clear(); |
1612 | } | 1647 | } |
1613 | StoreUndoState(); | 1648 | StoreUndoState(UndoType.STATE_ALL); |
1614 | } | 1649 | } |
1615 | 1650 | ||
1616 | public byte ConvertScriptUintToByte(uint indata) | 1651 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1679,6 +1714,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1679 | 1714 | ||
1680 | // Move afterwards ResetIDs as it clears the localID | 1715 | // Move afterwards ResetIDs as it clears the localID |
1681 | dupe.LocalId = localID; | 1716 | dupe.LocalId = localID; |
1717 | if(dupe.PhysActor != null) | ||
1718 | dupe.PhysActor.LocalID = localID; | ||
1719 | |||
1682 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 1720 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
1683 | dupe._lastOwnerID = OwnerID; | 1721 | dupe._lastOwnerID = OwnerID; |
1684 | 1722 | ||
@@ -1722,7 +1760,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1722 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1760 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1723 | part.Shape = shape; | 1761 | part.Shape = shape; |
1724 | 1762 | ||
1725 | part.Name = "Primitive"; | 1763 | part.Name = "Object"; |
1726 | part._ownerID = UUID.Random(); | 1764 | part._ownerID = UUID.Random(); |
1727 | 1765 | ||
1728 | return part; | 1766 | return part; |
@@ -2075,19 +2113,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2075 | public Vector3 GetWorldPosition() | 2113 | public Vector3 GetWorldPosition() |
2076 | { | 2114 | { |
2077 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 2115 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
2078 | |||
2079 | Vector3 axPos = OffsetPosition; | 2116 | Vector3 axPos = OffsetPosition; |
2080 | |||
2081 | axPos *= parentRot; | 2117 | axPos *= parentRot; |
2082 | Vector3 translationOffsetPosition = axPos; | 2118 | Vector3 translationOffsetPosition = axPos; |
2083 | 2119 | if(_parentID == 0) | |
2084 | // m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name); | 2120 | { |
2085 | 2121 | return GroupPosition; | |
2086 | Vector3 worldPos = GroupPosition + translationOffsetPosition; | 2122 | } |
2087 | 2123 | else | |
2088 | // m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name); | 2124 | { |
2089 | 2125 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | |
2090 | return worldPos; | 2126 | } |
2091 | } | 2127 | } |
2092 | 2128 | ||
2093 | /// <summary> | 2129 | /// <summary> |
@@ -2744,17 +2780,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2744 | //Trys to fetch sound id from prim's inventory. | 2780 | //Trys to fetch sound id from prim's inventory. |
2745 | //Prim's inventory doesn't support non script items yet | 2781 | //Prim's inventory doesn't support non script items yet |
2746 | 2782 | ||
2747 | lock (TaskInventory) | 2783 | TaskInventory.LockItemsForRead(true); |
2784 | |||
2785 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2748 | { | 2786 | { |
2749 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2787 | if (item.Value.Name == sound) |
2750 | { | 2788 | { |
2751 | if (item.Value.Name == sound) | 2789 | soundID = item.Value.ItemID; |
2752 | { | 2790 | break; |
2753 | soundID = item.Value.ItemID; | ||
2754 | break; | ||
2755 | } | ||
2756 | } | 2791 | } |
2757 | } | 2792 | } |
2793 | |||
2794 | TaskInventory.LockItemsForRead(false); | ||
2758 | } | 2795 | } |
2759 | 2796 | ||
2760 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2797 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2814,7 +2851,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2814 | /// <param name="scale"></param> | 2851 | /// <param name="scale"></param> |
2815 | public void Resize(Vector3 scale) | 2852 | public void Resize(Vector3 scale) |
2816 | { | 2853 | { |
2817 | StoreUndoState(); | 2854 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2818 | m_shape.Scale = scale; | 2855 | m_shape.Scale = scale; |
2819 | 2856 | ||
2820 | ParentGroup.HasGroupChanged = true; | 2857 | ParentGroup.HasGroupChanged = true; |
@@ -2823,38 +2860,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2823 | 2860 | ||
2824 | public void RotLookAt(Quaternion target, float strength, float damping) | 2861 | public void RotLookAt(Quaternion target, float strength, float damping) |
2825 | { | 2862 | { |
2826 | rotLookAt(target, strength, damping); | 2863 | 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 | } | 2864 | } |
2859 | 2865 | ||
2860 | /// <summary> | 2866 | /// <summary> |
@@ -2866,7 +2872,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2866 | 2872 | ||
2867 | if (m_parentGroup != null) | 2873 | if (m_parentGroup != null) |
2868 | { | 2874 | { |
2869 | m_parentGroup.QueueForUpdateCheck(); | 2875 | if (!m_parentGroup.areUpdatesSuspended) |
2876 | { | ||
2877 | m_parentGroup.QueueForUpdateCheck(); | ||
2878 | } | ||
2870 | } | 2879 | } |
2871 | 2880 | ||
2872 | int timeNow = Util.UnixTimeSinceEpoch(); | 2881 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -3083,8 +3092,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3083 | { | 3092 | { |
3084 | const float ROTATION_TOLERANCE = 0.01f; | 3093 | const float ROTATION_TOLERANCE = 0.01f; |
3085 | const float VELOCITY_TOLERANCE = 0.001f; | 3094 | const float VELOCITY_TOLERANCE = 0.001f; |
3086 | const float POSITION_TOLERANCE = 0.05f; | 3095 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3087 | const int TIME_MS_TOLERANCE = 3000; | 3096 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3088 | 3097 | ||
3089 | if (m_updateFlag == 1) | 3098 | if (m_updateFlag == 1) |
3090 | { | 3099 | { |
@@ -3098,7 +3107,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3098 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 3107 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
3099 | { | 3108 | { |
3100 | AddTerseUpdateToAllAvatars(); | 3109 | AddTerseUpdateToAllAvatars(); |
3101 | ClearUpdateSchedule(); | 3110 | |
3102 | 3111 | ||
3103 | // 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 |
3104 | // bad, so it's been replaced by an event driven method. | 3113 | // bad, so it's been replaced by an event driven method. |
@@ -3116,16 +3125,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3116 | m_lastAngularVelocity = AngularVelocity; | 3125 | m_lastAngularVelocity = AngularVelocity; |
3117 | m_lastTerseSent = Environment.TickCount; | 3126 | m_lastTerseSent = Environment.TickCount; |
3118 | } | 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* | ||
3119 | } | 3130 | } |
3120 | else | 3131 | else |
3121 | { | 3132 | { |
3122 | 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 |
3123 | { | 3134 | { |
3124 | AddFullUpdateToAllAvatars(); | 3135 | AddFullUpdateToAllAvatars(); |
3125 | ClearUpdateSchedule(); | 3136 | m_updateFlag = 0; //Same here |
3126 | } | 3137 | } |
3127 | } | 3138 | } |
3128 | ClearUpdateSchedule(); | 3139 | m_updateFlag = 0; |
3129 | } | 3140 | } |
3130 | 3141 | ||
3131 | /// <summary> | 3142 | /// <summary> |
@@ -3153,17 +3164,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3153 | if (!UUID.TryParse(sound, out soundID)) | 3164 | if (!UUID.TryParse(sound, out soundID)) |
3154 | { | 3165 | { |
3155 | // search sound file from inventory | 3166 | // search sound file from inventory |
3156 | lock (TaskInventory) | 3167 | TaskInventory.LockItemsForRead(true); |
3168 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3157 | { | 3169 | { |
3158 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3170 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3159 | { | 3171 | { |
3160 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3172 | soundID = item.Value.ItemID; |
3161 | { | 3173 | break; |
3162 | soundID = item.Value.ItemID; | ||
3163 | break; | ||
3164 | } | ||
3165 | } | 3174 | } |
3166 | } | 3175 | } |
3176 | TaskInventory.LockItemsForRead(false); | ||
3167 | } | 3177 | } |
3168 | 3178 | ||
3169 | if (soundID == UUID.Zero) | 3179 | if (soundID == UUID.Zero) |
@@ -3593,7 +3603,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3593 | 3603 | ||
3594 | public void StopLookAt() | 3604 | public void StopLookAt() |
3595 | { | 3605 | { |
3596 | m_parentGroup.stopLookAt(); | 3606 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3597 | 3607 | ||
3598 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3608 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3599 | } | 3609 | } |
@@ -3620,10 +3630,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3620 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3630 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3621 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3631 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3622 | } | 3632 | } |
3623 | 3633 | public void StoreUndoState(UndoType type) | |
3624 | public void StoreUndoState() | ||
3625 | { | 3634 | { |
3626 | if (!Undoing) | 3635 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3627 | { | 3636 | { |
3628 | if (!IgnoreUndoUpdate) | 3637 | if (!IgnoreUndoUpdate) |
3629 | { | 3638 | { |
@@ -3634,17 +3643,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3634 | if (m_undo.Count > 0) | 3643 | if (m_undo.Count > 0) |
3635 | { | 3644 | { |
3636 | UndoState last = m_undo.Peek(); | 3645 | UndoState last = m_undo.Peek(); |
3637 | if (last != null) | 3646 | |
3638 | { | ||
3639 | if (last.Compare(this)) | ||
3640 | return; | ||
3641 | } | ||
3642 | } | 3647 | } |
3643 | 3648 | ||
3644 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3649 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3645 | { | 3650 | { |
3646 | UndoState nUndo = new UndoState(this); | 3651 | UndoState lastUndo = m_undo.Peek(); |
3647 | 3652 | ||
3653 | UndoState nUndo = new UndoState(this, type); | ||
3654 | |||
3655 | if (lastUndo != null) | ||
3656 | { | ||
3657 | TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); | ||
3658 | if (ts.TotalMilliseconds < 500) | ||
3659 | { | ||
3660 | //Delete the last entry since it was less than 500 milliseconds ago | ||
3661 | nUndo.Merge(lastUndo); | ||
3662 | m_undo.Pop(); | ||
3663 | } | ||
3664 | } | ||
3648 | m_undo.Push(nUndo); | 3665 | m_undo.Push(nUndo); |
3649 | } | 3666 | } |
3650 | 3667 | ||
@@ -4121,11 +4138,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4121 | if (m_undo.Count > 0) | 4138 | if (m_undo.Count > 0) |
4122 | { | 4139 | { |
4123 | UndoState nUndo = null; | 4140 | UndoState nUndo = null; |
4141 | UndoState goback = m_undo.Pop(); | ||
4124 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4142 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4125 | { | 4143 | { |
4126 | nUndo = new UndoState(this); | 4144 | nUndo = new UndoState(this, goback.Type); |
4127 | } | 4145 | } |
4128 | UndoState goback = m_undo.Pop(); | 4146 | |
4147 | |||
4129 | if (goback != null) | 4148 | if (goback != null) |
4130 | { | 4149 | { |
4131 | goback.PlaybackState(this); | 4150 | goback.PlaybackState(this); |
@@ -4140,13 +4159,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4140 | { | 4159 | { |
4141 | lock (m_redo) | 4160 | lock (m_redo) |
4142 | { | 4161 | { |
4162 | UndoState gofwd = m_redo.Pop(); | ||
4143 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4163 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4144 | { | 4164 | { |
4145 | UndoState nUndo = new UndoState(this); | 4165 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4146 | 4166 | ||
4147 | m_undo.Push(nUndo); | 4167 | m_undo.Push(nUndo); |
4148 | } | 4168 | } |
4149 | UndoState gofwd = m_redo.Pop(); | ||
4150 | if (gofwd != null) | 4169 | if (gofwd != null) |
4151 | gofwd.PlayfwdState(this); | 4170 | gofwd.PlayfwdState(this); |
4152 | } | 4171 | } |
@@ -4410,6 +4429,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4410 | Scale, | 4429 | Scale, |
4411 | RotationOffset, | 4430 | RotationOffset, |
4412 | UsePhysics); | 4431 | UsePhysics); |
4432 | PhysActor.SetMaterial(Material); | ||
4413 | 4433 | ||
4414 | pa = PhysActor; | 4434 | pa = PhysActor; |
4415 | if (pa != null) | 4435 | if (pa != null) |
@@ -4595,8 +4615,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4595 | { | 4615 | { |
4596 | m_shape.TextureEntry = textureEntry; | 4616 | m_shape.TextureEntry = textureEntry; |
4597 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4617 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4598 | 4618 | m_updateFlag = 1; | |
4599 | ParentGroup.HasGroupChanged = true; | 4619 | ParentGroup.HasGroupChanged = true; |
4620 | |||
4600 | //This is madness.. | 4621 | //This is madness.. |
4601 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4622 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4602 | //This is sparta | 4623 | //This is sparta |
@@ -4829,5 +4850,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4829 | Color color = Color; | 4850 | Color color = Color; |
4830 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4851 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4831 | } | 4852 | } |
4853 | |||
4854 | public void ResetOwnerChangeFlag() | ||
4855 | { | ||
4856 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4857 | |||
4858 | foreach (UUID itemID in inv) | ||
4859 | { | ||
4860 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4861 | item.OwnerChanged = false; | ||
4862 | Inventory.UpdateInventoryItem(item, false, false); | ||
4863 | } | ||
4864 | } | ||
4832 | } | 4865 | } |
4833 | } | 4866 | } |