diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 316 |
1 files changed, 177 insertions, 139 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c6d8c73..e3744bd 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); |
@@ -328,6 +338,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
328 | protected Vector3 m_lastAcceleration; | 338 | protected Vector3 m_lastAcceleration; |
329 | protected Vector3 m_lastAngularVelocity; | 339 | protected Vector3 m_lastAngularVelocity; |
330 | protected int m_lastTerseSent; | 340 | protected int m_lastTerseSent; |
341 | protected float m_buoyancy = 0.0f; | ||
331 | 342 | ||
332 | /// <summary> | 343 | /// <summary> |
333 | /// Stores media texture data | 344 | /// Stores media texture data |
@@ -380,7 +391,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
380 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, | 391 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, |
381 | Quaternion rotationOffset, Vector3 offsetPosition) | 392 | Quaternion rotationOffset, Vector3 offsetPosition) |
382 | { | 393 | { |
383 | m_name = "Primitive"; | 394 | m_name = "Object"; |
384 | 395 | ||
385 | Rezzed = DateTime.UtcNow; | 396 | Rezzed = DateTime.UtcNow; |
386 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); | 397 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); |
@@ -436,7 +447,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
436 | private uint _ownerMask = (uint)PermissionMask.All; | 447 | private uint _ownerMask = (uint)PermissionMask.All; |
437 | private uint _groupMask = (uint)PermissionMask.None; | 448 | private uint _groupMask = (uint)PermissionMask.None; |
438 | private uint _everyoneMask = (uint)PermissionMask.None; | 449 | private uint _everyoneMask = (uint)PermissionMask.None; |
439 | private uint _nextOwnerMask = (uint)PermissionMask.All; | 450 | private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer); |
440 | private PrimFlags _flags = PrimFlags.None; | 451 | private PrimFlags _flags = PrimFlags.None; |
441 | private DateTime m_expires; | 452 | private DateTime m_expires; |
442 | private DateTime m_rezzed; | 453 | private DateTime m_rezzed; |
@@ -535,12 +546,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
535 | } | 546 | } |
536 | 547 | ||
537 | /// <value> | 548 | /// <value> |
538 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 549 | /// Get the inventory list |
539 | /// </value> | 550 | /// </value> |
540 | public TaskInventoryDictionary TaskInventory | 551 | public TaskInventoryDictionary TaskInventory |
541 | { | 552 | { |
542 | get { return m_inventory.Items; } | 553 | get { |
543 | set { m_inventory.Items = value; } | 554 | return m_inventory.Items; |
555 | } | ||
556 | set { | ||
557 | m_inventory.Items = value; | ||
558 | } | ||
544 | } | 559 | } |
545 | 560 | ||
546 | /// <summary> | 561 | /// <summary> |
@@ -680,14 +695,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
680 | set { m_LoopSoundSlavePrims = value; } | 695 | set { m_LoopSoundSlavePrims = value; } |
681 | } | 696 | } |
682 | 697 | ||
683 | |||
684 | public Byte[] TextureAnimation | 698 | public Byte[] TextureAnimation |
685 | { | 699 | { |
686 | get { return m_TextureAnimation; } | 700 | get { return m_TextureAnimation; } |
687 | set { m_TextureAnimation = value; } | 701 | set { m_TextureAnimation = value; } |
688 | } | 702 | } |
689 | 703 | ||
690 | |||
691 | public Byte[] ParticleSystem | 704 | public Byte[] ParticleSystem |
692 | { | 705 | { |
693 | get { return m_particleSystem; } | 706 | get { return m_particleSystem; } |
@@ -724,9 +737,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
724 | { | 737 | { |
725 | // If this is a linkset, we don't want the physics engine mucking up our group position here. | 738 | // If this is a linkset, we don't want the physics engine mucking up our group position here. |
726 | PhysicsActor actor = PhysActor; | 739 | PhysicsActor actor = PhysActor; |
727 | if (actor != null && _parentID == 0) | 740 | if (_parentID == 0) |
728 | { | 741 | { |
729 | m_groupPosition = actor.Position; | 742 | if (actor != null) |
743 | m_groupPosition = actor.Position; | ||
744 | return m_groupPosition; | ||
730 | } | 745 | } |
731 | 746 | ||
732 | if (IsAttachment) | 747 | if (IsAttachment) |
@@ -736,12 +751,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
736 | return sp.AbsolutePosition; | 751 | return sp.AbsolutePosition; |
737 | } | 752 | } |
738 | 753 | ||
754 | // use root prim's group position. Physics may have updated it | ||
755 | if (ParentGroup.RootPart != this) | ||
756 | m_groupPosition = ParentGroup.RootPart.GroupPosition; | ||
739 | return m_groupPosition; | 757 | return m_groupPosition; |
740 | } | 758 | } |
741 | set | 759 | set |
742 | { | 760 | { |
743 | m_groupPosition = value; | 761 | m_groupPosition = value; |
744 | |||
745 | PhysicsActor actor = PhysActor; | 762 | PhysicsActor actor = PhysActor; |
746 | if (actor != null) | 763 | if (actor != null) |
747 | { | 764 | { |
@@ -761,25 +778,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
761 | 778 | ||
762 | // Tell the physics engines that this prim changed. | 779 | // Tell the physics engines that this prim changed. |
763 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 780 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
781 | |||
764 | } | 782 | } |
765 | catch (Exception e) | 783 | catch (Exception e) |
766 | { | 784 | { |
767 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); | 785 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); |
768 | } | 786 | } |
769 | } | 787 | } |
770 | |||
771 | // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too | ||
772 | if (m_sitTargetAvatar != UUID.Zero) | ||
773 | { | ||
774 | if (m_parentGroup != null) // TODO can there be a SOP without a SOG? | ||
775 | { | ||
776 | ScenePresence avatar; | ||
777 | if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) | ||
778 | { | ||
779 | avatar.ParentPosition = GetWorldPosition(); | ||
780 | } | ||
781 | } | ||
782 | } | ||
783 | } | 788 | } |
784 | } | 789 | } |
785 | 790 | ||
@@ -788,7 +793,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
788 | get { return m_offsetPosition; } | 793 | get { return m_offsetPosition; } |
789 | set | 794 | set |
790 | { | 795 | { |
791 | StoreUndoState(); | 796 | Vector3 oldpos = m_offsetPosition; |
797 | StoreUndoState(UndoType.STATE_PRIM_POSITION); | ||
792 | m_offsetPosition = value; | 798 | m_offsetPosition = value; |
793 | 799 | ||
794 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 800 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -802,7 +808,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
802 | // Tell the physics engines that this prim changed. | 808 | // Tell the physics engines that this prim changed. |
803 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 809 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
804 | } | 810 | } |
811 | |||
812 | if (!m_parentGroup.m_dupeInProgress) | ||
813 | { | ||
814 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
815 | foreach (ScenePresence av in avs) | ||
816 | { | ||
817 | if (av.LinkedPrim == m_uuid) | ||
818 | { | ||
819 | Vector3 offset = (m_offsetPosition - oldpos); | ||
820 | av.OffsetPosition += offset; | ||
821 | av.SendAvatarDataToAllAgents(); | ||
822 | } | ||
823 | } | ||
824 | } | ||
805 | } | 825 | } |
826 | TriggerScriptChangedEvent(Changed.POSITION); | ||
806 | } | 827 | } |
807 | } | 828 | } |
808 | 829 | ||
@@ -844,7 +865,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
844 | 865 | ||
845 | set | 866 | set |
846 | { | 867 | { |
847 | StoreUndoState(); | 868 | StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
848 | m_rotationOffset = value; | 869 | m_rotationOffset = value; |
849 | 870 | ||
850 | PhysicsActor actor = PhysActor; | 871 | PhysicsActor actor = PhysActor; |
@@ -928,7 +949,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
928 | /// <summary></summary> | 949 | /// <summary></summary> |
929 | public Vector3 Acceleration | 950 | public Vector3 Acceleration |
930 | { | 951 | { |
931 | get { return m_acceleration; } | 952 | get |
953 | { | ||
954 | PhysicsActor actor = PhysActor; | ||
955 | if (actor != null) | ||
956 | { | ||
957 | m_acceleration = actor.Acceleration; | ||
958 | } | ||
959 | return m_acceleration; | ||
960 | } | ||
961 | |||
932 | set { m_acceleration = value; } | 962 | set { m_acceleration = value; } |
933 | } | 963 | } |
934 | 964 | ||
@@ -1019,7 +1049,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1019 | get { return m_shape.Scale; } | 1049 | get { return m_shape.Scale; } |
1020 | set | 1050 | set |
1021 | { | 1051 | { |
1022 | StoreUndoState(); | 1052 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
1023 | if (m_shape != null) | 1053 | if (m_shape != null) |
1024 | { | 1054 | { |
1025 | m_shape.Scale = value; | 1055 | m_shape.Scale = value; |
@@ -1085,11 +1115,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1085 | 1115 | ||
1086 | public Vector3 AbsolutePosition | 1116 | public Vector3 AbsolutePosition |
1087 | { | 1117 | { |
1088 | get { | 1118 | get |
1089 | if (IsAttachment) | 1119 | { |
1090 | return GroupPosition; | 1120 | return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset); |
1091 | 1121 | } | |
1092 | return m_offsetPosition + m_groupPosition; } | ||
1093 | } | 1122 | } |
1094 | 1123 | ||
1095 | public SceneObjectGroup ParentGroup | 1124 | public SceneObjectGroup ParentGroup |
@@ -1248,6 +1277,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1248 | _flags = value; | 1277 | _flags = value; |
1249 | } | 1278 | } |
1250 | } | 1279 | } |
1280 | |||
1281 | [XmlIgnore] | ||
1282 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1283 | { | ||
1284 | get { return m_occupied; } | ||
1285 | set { m_occupied = value; } | ||
1286 | } | ||
1251 | 1287 | ||
1252 | 1288 | ||
1253 | public UUID SitTargetAvatar | 1289 | public UUID SitTargetAvatar |
@@ -1307,6 +1343,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1307 | set { m_collisionSoundVolume = value; } | 1343 | set { m_collisionSoundVolume = value; } |
1308 | } | 1344 | } |
1309 | 1345 | ||
1346 | public float Buoyancy | ||
1347 | { | ||
1348 | get { return m_buoyancy; } | ||
1349 | set | ||
1350 | { | ||
1351 | m_buoyancy = value; | ||
1352 | if (PhysActor != null) | ||
1353 | { | ||
1354 | PhysActor.Buoyancy = value; | ||
1355 | } | ||
1356 | } | ||
1357 | } | ||
1358 | |||
1310 | #endregion Public Properties with only Get | 1359 | #endregion Public Properties with only Get |
1311 | 1360 | ||
1312 | #region Private Methods | 1361 | #region Private Methods |
@@ -1323,14 +1372,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1323 | } | 1372 | } |
1324 | } | 1373 | } |
1325 | 1374 | ||
1326 | /// <summary> | ||
1327 | /// Clear all pending updates of parts to clients | ||
1328 | /// </summary> | ||
1329 | private void ClearUpdateSchedule() | ||
1330 | { | ||
1331 | m_updateFlag = 0; | ||
1332 | } | ||
1333 | |||
1334 | private void SendObjectPropertiesToClient(UUID AgentID) | 1375 | private void SendObjectPropertiesToClient(UUID AgentID) |
1335 | { | 1376 | { |
1336 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1377 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1581,15 +1622,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1581 | // or flexible | 1622 | // or flexible |
1582 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1623 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1583 | { | 1624 | { |
1584 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 1625 | try |
1585 | LocalId, | 1626 | { |
1586 | string.Format("{0}/{1}", Name, UUID), | 1627 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
1587 | Shape, | 1628 | string.Format("{0}/{1}", Name, UUID), |
1588 | AbsolutePosition, | 1629 | Shape, |
1589 | Scale, | 1630 | AbsolutePosition, |
1590 | RotationOffset, | 1631 | Scale, |
1591 | RigidBody); | 1632 | RotationOffset, |
1592 | 1633 | RigidBody); | |
1634 | PhysActor.SetMaterial(Material); | ||
1635 | } | ||
1636 | catch | ||
1637 | { | ||
1638 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
1639 | PhysActor = null; | ||
1640 | } | ||
1593 | // Basic Physics returns null.. joy joy joy. | 1641 | // Basic Physics returns null.. joy joy joy. |
1594 | if (PhysActor != null) | 1642 | if (PhysActor != null) |
1595 | { | 1643 | { |
@@ -1616,7 +1664,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1616 | { | 1664 | { |
1617 | m_redo.Clear(); | 1665 | m_redo.Clear(); |
1618 | } | 1666 | } |
1619 | StoreUndoState(); | 1667 | StoreUndoState(UndoType.STATE_ALL); |
1620 | } | 1668 | } |
1621 | 1669 | ||
1622 | public byte ConvertScriptUintToByte(uint indata) | 1670 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1685,6 +1733,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1685 | 1733 | ||
1686 | // Move afterwards ResetIDs as it clears the localID | 1734 | // Move afterwards ResetIDs as it clears the localID |
1687 | dupe.LocalId = localID; | 1735 | dupe.LocalId = localID; |
1736 | if(dupe.PhysActor != null) | ||
1737 | dupe.PhysActor.LocalID = localID; | ||
1738 | |||
1688 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. | 1739 | // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. |
1689 | dupe._lastOwnerID = OwnerID; | 1740 | dupe._lastOwnerID = OwnerID; |
1690 | 1741 | ||
@@ -1728,7 +1779,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1728 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1779 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1729 | part.Shape = shape; | 1780 | part.Shape = shape; |
1730 | 1781 | ||
1731 | part.Name = "Primitive"; | 1782 | part.Name = "Object"; |
1732 | part._ownerID = UUID.Random(); | 1783 | part._ownerID = UUID.Random(); |
1733 | 1784 | ||
1734 | return part; | 1785 | return part; |
@@ -2081,19 +2132,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2081 | public Vector3 GetWorldPosition() | 2132 | public Vector3 GetWorldPosition() |
2082 | { | 2133 | { |
2083 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 2134 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
2084 | |||
2085 | Vector3 axPos = OffsetPosition; | 2135 | Vector3 axPos = OffsetPosition; |
2086 | |||
2087 | axPos *= parentRot; | 2136 | axPos *= parentRot; |
2088 | Vector3 translationOffsetPosition = axPos; | 2137 | Vector3 translationOffsetPosition = axPos; |
2089 | 2138 | if(_parentID == 0) | |
2090 | // m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name); | 2139 | { |
2091 | 2140 | return GroupPosition; | |
2092 | Vector3 worldPos = GroupPosition + translationOffsetPosition; | 2141 | } |
2093 | 2142 | else | |
2094 | // m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name); | 2143 | { |
2095 | 2144 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | |
2096 | return worldPos; | 2145 | } |
2097 | } | 2146 | } |
2098 | 2147 | ||
2099 | /// <summary> | 2148 | /// <summary> |
@@ -2750,17 +2799,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2750 | //Trys to fetch sound id from prim's inventory. | 2799 | //Trys to fetch sound id from prim's inventory. |
2751 | //Prim's inventory doesn't support non script items yet | 2800 | //Prim's inventory doesn't support non script items yet |
2752 | 2801 | ||
2753 | lock (TaskInventory) | 2802 | TaskInventory.LockItemsForRead(true); |
2803 | |||
2804 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2754 | { | 2805 | { |
2755 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2806 | if (item.Value.Name == sound) |
2756 | { | 2807 | { |
2757 | if (item.Value.Name == sound) | 2808 | soundID = item.Value.ItemID; |
2758 | { | 2809 | break; |
2759 | soundID = item.Value.ItemID; | ||
2760 | break; | ||
2761 | } | ||
2762 | } | 2810 | } |
2763 | } | 2811 | } |
2812 | |||
2813 | TaskInventory.LockItemsForRead(false); | ||
2764 | } | 2814 | } |
2765 | 2815 | ||
2766 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2816 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2820,7 +2870,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2820 | /// <param name="scale"></param> | 2870 | /// <param name="scale"></param> |
2821 | public void Resize(Vector3 scale) | 2871 | public void Resize(Vector3 scale) |
2822 | { | 2872 | { |
2823 | StoreUndoState(); | 2873 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2824 | m_shape.Scale = scale; | 2874 | m_shape.Scale = scale; |
2825 | 2875 | ||
2826 | ParentGroup.HasGroupChanged = true; | 2876 | ParentGroup.HasGroupChanged = true; |
@@ -2829,38 +2879,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2829 | 2879 | ||
2830 | public void RotLookAt(Quaternion target, float strength, float damping) | 2880 | public void RotLookAt(Quaternion target, float strength, float damping) |
2831 | { | 2881 | { |
2832 | rotLookAt(target, strength, damping); | 2882 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2833 | } | ||
2834 | |||
2835 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2836 | { | ||
2837 | if (IsAttachment) | ||
2838 | { | ||
2839 | /* | ||
2840 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2841 | if (avatar != null) | ||
2842 | { | ||
2843 | Rotate the Av? | ||
2844 | } */ | ||
2845 | } | ||
2846 | else | ||
2847 | { | ||
2848 | APIDDamp = damping; | ||
2849 | APIDStrength = strength; | ||
2850 | APIDTarget = target; | ||
2851 | } | ||
2852 | } | ||
2853 | |||
2854 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2855 | { | ||
2856 | APIDDamp = damp; | ||
2857 | APIDStrength = strength; | ||
2858 | APIDTarget = rot; | ||
2859 | } | ||
2860 | |||
2861 | public void stopLookAt() | ||
2862 | { | ||
2863 | APIDTarget = Quaternion.Identity; | ||
2864 | } | 2883 | } |
2865 | 2884 | ||
2866 | /// <summary> | 2885 | /// <summary> |
@@ -2872,7 +2891,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2872 | 2891 | ||
2873 | if (m_parentGroup != null) | 2892 | if (m_parentGroup != null) |
2874 | { | 2893 | { |
2875 | m_parentGroup.QueueForUpdateCheck(); | 2894 | if (!m_parentGroup.areUpdatesSuspended) |
2895 | { | ||
2896 | m_parentGroup.QueueForUpdateCheck(); | ||
2897 | } | ||
2876 | } | 2898 | } |
2877 | 2899 | ||
2878 | int timeNow = Util.UnixTimeSinceEpoch(); | 2900 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -3089,8 +3111,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3089 | { | 3111 | { |
3090 | const float ROTATION_TOLERANCE = 0.01f; | 3112 | const float ROTATION_TOLERANCE = 0.01f; |
3091 | const float VELOCITY_TOLERANCE = 0.001f; | 3113 | const float VELOCITY_TOLERANCE = 0.001f; |
3092 | const float POSITION_TOLERANCE = 0.05f; | 3114 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3093 | const int TIME_MS_TOLERANCE = 3000; | 3115 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3094 | 3116 | ||
3095 | if (m_updateFlag == 1) | 3117 | if (m_updateFlag == 1) |
3096 | { | 3118 | { |
@@ -3104,7 +3126,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3104 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 3126 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
3105 | { | 3127 | { |
3106 | AddTerseUpdateToAllAvatars(); | 3128 | AddTerseUpdateToAllAvatars(); |
3107 | ClearUpdateSchedule(); | 3129 | |
3108 | 3130 | ||
3109 | // This causes the Scene to 'poll' physical objects every couple of frames | 3131 | // This causes the Scene to 'poll' physical objects every couple of frames |
3110 | // bad, so it's been replaced by an event driven method. | 3132 | // bad, so it's been replaced by an event driven method. |
@@ -3122,16 +3144,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3122 | m_lastAngularVelocity = AngularVelocity; | 3144 | m_lastAngularVelocity = AngularVelocity; |
3123 | m_lastTerseSent = Environment.TickCount; | 3145 | m_lastTerseSent = Environment.TickCount; |
3124 | } | 3146 | } |
3147 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
3148 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
3125 | } | 3149 | } |
3126 | else | 3150 | else |
3127 | { | 3151 | { |
3128 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 3152 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3129 | { | 3153 | { |
3130 | AddFullUpdateToAllAvatars(); | 3154 | AddFullUpdateToAllAvatars(); |
3131 | ClearUpdateSchedule(); | 3155 | m_updateFlag = 0; //Same here |
3132 | } | 3156 | } |
3133 | } | 3157 | } |
3134 | ClearUpdateSchedule(); | 3158 | m_updateFlag = 0; |
3135 | } | 3159 | } |
3136 | 3160 | ||
3137 | /// <summary> | 3161 | /// <summary> |
@@ -3159,17 +3183,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3159 | if (!UUID.TryParse(sound, out soundID)) | 3183 | if (!UUID.TryParse(sound, out soundID)) |
3160 | { | 3184 | { |
3161 | // search sound file from inventory | 3185 | // search sound file from inventory |
3162 | lock (TaskInventory) | 3186 | TaskInventory.LockItemsForRead(true); |
3187 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3163 | { | 3188 | { |
3164 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3189 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3165 | { | 3190 | { |
3166 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3191 | soundID = item.Value.ItemID; |
3167 | { | 3192 | break; |
3168 | soundID = item.Value.ItemID; | ||
3169 | break; | ||
3170 | } | ||
3171 | } | 3193 | } |
3172 | } | 3194 | } |
3195 | TaskInventory.LockItemsForRead(false); | ||
3173 | } | 3196 | } |
3174 | 3197 | ||
3175 | if (soundID == UUID.Zero) | 3198 | if (soundID == UUID.Zero) |
@@ -3272,14 +3295,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3272 | STATUS_ROTATE_Z = rotate; | 3295 | STATUS_ROTATE_Z = rotate; |
3273 | } | 3296 | } |
3274 | 3297 | ||
3275 | public void SetBuoyancy(float fvalue) | ||
3276 | { | ||
3277 | if (PhysActor != null) | ||
3278 | { | ||
3279 | PhysActor.Buoyancy = fvalue; | ||
3280 | } | ||
3281 | } | ||
3282 | |||
3283 | public void SetDieAtEdge(bool p) | 3298 | public void SetDieAtEdge(bool p) |
3284 | { | 3299 | { |
3285 | if (m_parentGroup == null) | 3300 | if (m_parentGroup == null) |
@@ -3599,7 +3614,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3599 | 3614 | ||
3600 | public void StopLookAt() | 3615 | public void StopLookAt() |
3601 | { | 3616 | { |
3602 | m_parentGroup.stopLookAt(); | 3617 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3603 | 3618 | ||
3604 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3619 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3605 | } | 3620 | } |
@@ -3626,10 +3641,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3626 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3641 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3627 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3642 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3628 | } | 3643 | } |
3629 | 3644 | public void StoreUndoState(UndoType type) | |
3630 | public void StoreUndoState() | ||
3631 | { | 3645 | { |
3632 | if (!Undoing) | 3646 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3633 | { | 3647 | { |
3634 | if (!IgnoreUndoUpdate) | 3648 | if (!IgnoreUndoUpdate) |
3635 | { | 3649 | { |
@@ -3640,17 +3654,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3640 | if (m_undo.Count > 0) | 3654 | if (m_undo.Count > 0) |
3641 | { | 3655 | { |
3642 | UndoState last = m_undo.Peek(); | 3656 | UndoState last = m_undo.Peek(); |
3643 | if (last != null) | 3657 | |
3644 | { | ||
3645 | if (last.Compare(this)) | ||
3646 | return; | ||
3647 | } | ||
3648 | } | 3658 | } |
3649 | 3659 | ||
3650 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3660 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3651 | { | 3661 | { |
3652 | UndoState nUndo = new UndoState(this); | 3662 | UndoState lastUndo = m_undo.Peek(); |
3663 | |||
3664 | UndoState nUndo = new UndoState(this, type); | ||
3653 | 3665 | ||
3666 | if (lastUndo != null) | ||
3667 | { | ||
3668 | TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); | ||
3669 | if (ts.TotalMilliseconds < 500) | ||
3670 | { | ||
3671 | //Delete the last entry since it was less than 500 milliseconds ago | ||
3672 | nUndo.Merge(lastUndo); | ||
3673 | m_undo.Pop(); | ||
3674 | } | ||
3675 | } | ||
3654 | m_undo.Push(nUndo); | 3676 | m_undo.Push(nUndo); |
3655 | } | 3677 | } |
3656 | 3678 | ||
@@ -4127,11 +4149,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4127 | if (m_undo.Count > 0) | 4149 | if (m_undo.Count > 0) |
4128 | { | 4150 | { |
4129 | UndoState nUndo = null; | 4151 | UndoState nUndo = null; |
4152 | UndoState goback = m_undo.Pop(); | ||
4130 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4153 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4131 | { | 4154 | { |
4132 | nUndo = new UndoState(this); | 4155 | nUndo = new UndoState(this, goback.Type); |
4133 | } | 4156 | } |
4134 | UndoState goback = m_undo.Pop(); | 4157 | |
4158 | |||
4135 | if (goback != null) | 4159 | if (goback != null) |
4136 | { | 4160 | { |
4137 | goback.PlaybackState(this); | 4161 | goback.PlaybackState(this); |
@@ -4146,13 +4170,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4146 | { | 4170 | { |
4147 | lock (m_redo) | 4171 | lock (m_redo) |
4148 | { | 4172 | { |
4173 | UndoState gofwd = m_redo.Pop(); | ||
4149 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4174 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4150 | { | 4175 | { |
4151 | UndoState nUndo = new UndoState(this); | 4176 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4152 | 4177 | ||
4153 | m_undo.Push(nUndo); | 4178 | m_undo.Push(nUndo); |
4154 | } | 4179 | } |
4155 | UndoState gofwd = m_redo.Pop(); | ||
4156 | if (gofwd != null) | 4180 | if (gofwd != null) |
4157 | gofwd.PlayfwdState(this); | 4181 | gofwd.PlayfwdState(this); |
4158 | } | 4182 | } |
@@ -4417,6 +4441,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4417 | Scale, | 4441 | Scale, |
4418 | RotationOffset, | 4442 | RotationOffset, |
4419 | UsePhysics); | 4443 | UsePhysics); |
4444 | PhysActor.SetMaterial(Material); | ||
4420 | 4445 | ||
4421 | pa = PhysActor; | 4446 | pa = PhysActor; |
4422 | if (pa != null) | 4447 | if (pa != null) |
@@ -4601,8 +4626,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4601 | { | 4626 | { |
4602 | m_shape.TextureEntry = textureEntry; | 4627 | m_shape.TextureEntry = textureEntry; |
4603 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4628 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4604 | 4629 | m_updateFlag = 1; | |
4605 | ParentGroup.HasGroupChanged = true; | 4630 | ParentGroup.HasGroupChanged = true; |
4631 | |||
4606 | //This is madness.. | 4632 | //This is madness.. |
4607 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4633 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4608 | //This is sparta | 4634 | //This is sparta |
@@ -4835,5 +4861,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4835 | Color color = Color; | 4861 | Color color = Color; |
4836 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4862 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4837 | } | 4863 | } |
4864 | |||
4865 | public void ResetOwnerChangeFlag() | ||
4866 | { | ||
4867 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4868 | |||
4869 | foreach (UUID itemID in inv) | ||
4870 | { | ||
4871 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4872 | item.OwnerChanged = false; | ||
4873 | Inventory.UpdateInventoryItem(item, false, false); | ||
4874 | } | ||
4875 | } | ||
4838 | } | 4876 | } |
4839 | } | 4877 | } |