diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 270 |
1 files changed, 153 insertions, 117 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3dac0ad..efdc19c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -149,7 +149,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
149 | 149 | ||
150 | // TODO: This needs to be persisted in next XML version update! | 150 | // TODO: This needs to be persisted in next XML version update! |
151 | [XmlIgnore] | 151 | [XmlIgnore] |
152 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; | 152 | public int[] PayPrice = {-2,-2,-2,-2,-2}; |
153 | [XmlIgnore] | 153 | [XmlIgnore] |
154 | public PhysicsActor PhysActor; | 154 | public PhysicsActor PhysActor; |
155 | 155 | ||
@@ -184,6 +184,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
184 | [XmlIgnore] | 184 | [XmlIgnore] |
185 | public UUID FromFolderID; | 185 | public UUID FromFolderID; |
186 | 186 | ||
187 | // The following two are to hold the attachment data | ||
188 | // while an object is inworld | ||
189 | [XmlIgnore] | ||
190 | public byte AttachPoint = 0; | ||
191 | |||
192 | [XmlIgnore] | ||
193 | public Vector3 AttachOffset = Vector3.Zero; | ||
194 | |||
187 | [XmlIgnore] | 195 | [XmlIgnore] |
188 | public int STATUS_ROTATE_X; | 196 | public int STATUS_ROTATE_X; |
189 | 197 | ||
@@ -279,6 +287,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
279 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 287 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
280 | private Vector3 m_sitTargetPosition; | 288 | private Vector3 m_sitTargetPosition; |
281 | private string m_sitAnimation = "SIT"; | 289 | private string m_sitAnimation = "SIT"; |
290 | private bool m_occupied; // KF if any av is sitting on this prim | ||
282 | private string m_text = String.Empty; | 291 | private string m_text = String.Empty; |
283 | private string m_touchName = String.Empty; | 292 | private string m_touchName = String.Empty; |
284 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 293 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
@@ -367,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
367 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, | 376 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, |
368 | Quaternion rotationOffset, Vector3 offsetPosition) | 377 | Quaternion rotationOffset, Vector3 offsetPosition) |
369 | { | 378 | { |
370 | m_name = "Primitive"; | 379 | m_name = "Object"; |
371 | 380 | ||
372 | Rezzed = DateTime.UtcNow; | 381 | Rezzed = DateTime.UtcNow; |
373 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); | 382 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); |
@@ -463,12 +472,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
463 | } | 472 | } |
464 | 473 | ||
465 | /// <value> | 474 | /// <value> |
466 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 475 | /// Get the inventory list |
467 | /// </value> | 476 | /// </value> |
468 | public TaskInventoryDictionary TaskInventory | 477 | public TaskInventoryDictionary TaskInventory |
469 | { | 478 | { |
470 | get { return m_inventory.Items; } | 479 | get { |
471 | set { m_inventory.Items = value; } | 480 | return m_inventory.Items; |
481 | } | ||
482 | set { | ||
483 | m_inventory.Items = value; | ||
484 | } | ||
472 | } | 485 | } |
473 | 486 | ||
474 | public uint ObjectFlags | 487 | public uint ObjectFlags |
@@ -597,14 +610,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
597 | set { m_LoopSoundSlavePrims = value; } | 610 | set { m_LoopSoundSlavePrims = value; } |
598 | } | 611 | } |
599 | 612 | ||
600 | [XmlIgnore] | ||
601 | public Byte[] TextureAnimation | 613 | public Byte[] TextureAnimation |
602 | { | 614 | { |
603 | get { return m_TextureAnimation; } | 615 | get { return m_TextureAnimation; } |
604 | set { m_TextureAnimation = value; } | 616 | set { m_TextureAnimation = value; } |
605 | } | 617 | } |
606 | 618 | ||
607 | [XmlIgnore] | ||
608 | public Byte[] ParticleSystem | 619 | public Byte[] ParticleSystem |
609 | { | 620 | { |
610 | get { return m_particleSystem; } | 621 | get { return m_particleSystem; } |
@@ -658,7 +669,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
658 | set | 669 | set |
659 | { | 670 | { |
660 | m_groupPosition = value; | 671 | m_groupPosition = value; |
661 | |||
662 | PhysicsActor actor = PhysActor; | 672 | PhysicsActor actor = PhysActor; |
663 | if (actor != null) | 673 | if (actor != null) |
664 | { | 674 | { |
@@ -678,25 +688,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
678 | 688 | ||
679 | // Tell the physics engines that this prim changed. | 689 | // Tell the physics engines that this prim changed. |
680 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 690 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
691 | |||
681 | } | 692 | } |
682 | catch (Exception e) | 693 | catch (Exception e) |
683 | { | 694 | { |
684 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); | 695 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); |
685 | } | 696 | } |
686 | } | 697 | } |
687 | |||
688 | // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too | ||
689 | if (m_sitTargetAvatar != UUID.Zero) | ||
690 | { | ||
691 | if (m_parentGroup != null) // TODO can there be a SOP without a SOG? | ||
692 | { | ||
693 | ScenePresence avatar; | ||
694 | if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) | ||
695 | { | ||
696 | avatar.ParentPosition = GetWorldPosition(); | ||
697 | } | ||
698 | } | ||
699 | } | ||
700 | } | 698 | } |
701 | } | 699 | } |
702 | 700 | ||
@@ -705,7 +703,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
705 | get { return m_offsetPosition; } | 703 | get { return m_offsetPosition; } |
706 | set | 704 | set |
707 | { | 705 | { |
708 | StoreUndoState(); | 706 | Vector3 oldpos = m_offsetPosition; |
707 | StoreUndoState(UndoType.STATE_PRIM_POSITION); | ||
709 | m_offsetPosition = value; | 708 | m_offsetPosition = value; |
710 | 709 | ||
711 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 710 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -719,6 +718,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
719 | // Tell the physics engines that this prim changed. | 718 | // Tell the physics engines that this prim changed. |
720 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 719 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
721 | } | 720 | } |
721 | |||
722 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
723 | foreach (ScenePresence av in avs) | ||
724 | { | ||
725 | if (av.LinkedPrim == m_uuid) | ||
726 | { | ||
727 | Vector3 offset = (m_offsetPosition - oldpos); | ||
728 | av.OffsetPosition += offset; | ||
729 | av.SendFullUpdateToAllClients(); | ||
730 | } | ||
731 | } | ||
722 | } | 732 | } |
723 | } | 733 | } |
724 | } | 734 | } |
@@ -761,7 +771,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
761 | 771 | ||
762 | set | 772 | set |
763 | { | 773 | { |
764 | StoreUndoState(); | 774 | StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
765 | m_rotationOffset = value; | 775 | m_rotationOffset = value; |
766 | 776 | ||
767 | PhysicsActor actor = PhysActor; | 777 | PhysicsActor actor = PhysActor; |
@@ -845,7 +855,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
845 | /// <summary></summary> | 855 | /// <summary></summary> |
846 | public Vector3 Acceleration | 856 | public Vector3 Acceleration |
847 | { | 857 | { |
848 | get { return m_acceleration; } | 858 | get |
859 | { | ||
860 | PhysicsActor actor = PhysActor; | ||
861 | if (actor != null) | ||
862 | { | ||
863 | m_acceleration = actor.Acceleration; | ||
864 | } | ||
865 | return m_acceleration; | ||
866 | } | ||
867 | |||
849 | set { m_acceleration = value; } | 868 | set { m_acceleration = value; } |
850 | } | 869 | } |
851 | 870 | ||
@@ -950,7 +969,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
950 | get { return m_shape.Scale; } | 969 | get { return m_shape.Scale; } |
951 | set | 970 | set |
952 | { | 971 | { |
953 | StoreUndoState(); | 972 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
954 | if (m_shape != null) | 973 | if (m_shape != null) |
955 | { | 974 | { |
956 | m_shape.Scale = value; | 975 | m_shape.Scale = value; |
@@ -1016,7 +1035,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1016 | if (IsAttachment) | 1035 | if (IsAttachment) |
1017 | return GroupPosition; | 1036 | return GroupPosition; |
1018 | 1037 | ||
1019 | return m_offsetPosition + m_groupPosition; } | 1038 | // return m_offsetPosition + m_groupPosition; } |
1039 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
1020 | } | 1040 | } |
1021 | 1041 | ||
1022 | public SceneObjectGroup ParentGroup | 1042 | public SceneObjectGroup ParentGroup |
@@ -1167,6 +1187,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1167 | get { return _flags; } | 1187 | get { return _flags; } |
1168 | set { _flags = value; } | 1188 | set { _flags = value; } |
1169 | } | 1189 | } |
1190 | |||
1191 | [XmlIgnore] | ||
1192 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1193 | { | ||
1194 | get { return m_occupied; } | ||
1195 | set { m_occupied = value; } | ||
1196 | } | ||
1170 | 1197 | ||
1171 | [XmlIgnore] | 1198 | [XmlIgnore] |
1172 | public UUID SitTargetAvatar | 1199 | public UUID SitTargetAvatar |
@@ -1242,14 +1269,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1242 | } | 1269 | } |
1243 | } | 1270 | } |
1244 | 1271 | ||
1245 | /// <summary> | ||
1246 | /// Clear all pending updates of parts to clients | ||
1247 | /// </summary> | ||
1248 | private void ClearUpdateSchedule() | ||
1249 | { | ||
1250 | m_updateFlag = 0; | ||
1251 | } | ||
1252 | |||
1253 | private void SendObjectPropertiesToClient(UUID AgentID) | 1272 | private void SendObjectPropertiesToClient(UUID AgentID) |
1254 | { | 1273 | { |
1255 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1274 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1500,14 +1519,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1500 | // or flexible | 1519 | // or flexible |
1501 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1520 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1502 | { | 1521 | { |
1503 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 1522 | try |
1504 | Name, | 1523 | { |
1505 | Shape, | 1524 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
1506 | AbsolutePosition, | 1525 | Name, |
1507 | Scale, | 1526 | Shape, |
1508 | RotationOffset, | 1527 | AbsolutePosition, |
1509 | RigidBody); | 1528 | Scale, |
1510 | 1529 | RotationOffset, | |
1530 | RigidBody); | ||
1531 | } | ||
1532 | catch | ||
1533 | { | ||
1534 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
1535 | PhysActor = null; | ||
1536 | } | ||
1511 | // Basic Physics returns null.. joy joy joy. | 1537 | // Basic Physics returns null.. joy joy joy. |
1512 | if (PhysActor != null) | 1538 | if (PhysActor != null) |
1513 | { | 1539 | { |
@@ -1535,7 +1561,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1535 | { | 1561 | { |
1536 | m_redo.Clear(); | 1562 | m_redo.Clear(); |
1537 | } | 1563 | } |
1538 | StoreUndoState(); | 1564 | StoreUndoState(UndoType.STATE_ALL); |
1539 | } | 1565 | } |
1540 | 1566 | ||
1541 | public byte ConvertScriptUintToByte(uint indata) | 1567 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1647,7 +1673,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1647 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1673 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1648 | part.Shape = shape; | 1674 | part.Shape = shape; |
1649 | 1675 | ||
1650 | part.Name = "Primitive"; | 1676 | part.Name = "Object"; |
1651 | part._ownerID = UUID.Random(); | 1677 | part._ownerID = UUID.Random(); |
1652 | 1678 | ||
1653 | return part; | 1679 | return part; |
@@ -1770,7 +1796,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1770 | // which stops client-side interpolation of deactivated joint proxy objects. | 1796 | // which stops client-side interpolation of deactivated joint proxy objects. |
1771 | } | 1797 | } |
1772 | 1798 | ||
1773 | if (!UsePhysics && !isNew) | 1799 | if (!UsePhysics) |
1774 | { | 1800 | { |
1775 | // reset velocity to 0 on physics switch-off. Without that, the client thinks the | 1801 | // reset velocity to 0 on physics switch-off. Without that, the client thinks the |
1776 | // prim still has velocity and continues to interpolate its position along the old | 1802 | // prim still has velocity and continues to interpolate its position along the old |
@@ -2005,12 +2031,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2005 | public Vector3 GetWorldPosition() | 2031 | public Vector3 GetWorldPosition() |
2006 | { | 2032 | { |
2007 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 2033 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
2008 | |||
2009 | Vector3 axPos = OffsetPosition; | 2034 | Vector3 axPos = OffsetPosition; |
2010 | |||
2011 | axPos *= parentRot; | 2035 | axPos *= parentRot; |
2012 | Vector3 translationOffsetPosition = axPos; | 2036 | Vector3 translationOffsetPosition = axPos; |
2013 | return GroupPosition + translationOffsetPosition; | 2037 | if(_parentID == 0) |
2038 | { | ||
2039 | return GroupPosition; | ||
2040 | } | ||
2041 | else | ||
2042 | { | ||
2043 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
2044 | } | ||
2014 | } | 2045 | } |
2015 | 2046 | ||
2016 | /// <summary> | 2047 | /// <summary> |
@@ -2021,7 +2052,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2021 | { | 2052 | { |
2022 | Quaternion newRot; | 2053 | Quaternion newRot; |
2023 | 2054 | ||
2024 | if (this.LinkNum == 0) | 2055 | if (this.LinkNum < 2) //KF Single or root prim |
2025 | { | 2056 | { |
2026 | newRot = RotationOffset; | 2057 | newRot = RotationOffset; |
2027 | } | 2058 | } |
@@ -2667,17 +2698,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2667 | //Trys to fetch sound id from prim's inventory. | 2698 | //Trys to fetch sound id from prim's inventory. |
2668 | //Prim's inventory doesn't support non script items yet | 2699 | //Prim's inventory doesn't support non script items yet |
2669 | 2700 | ||
2670 | lock (TaskInventory) | 2701 | TaskInventory.LockItemsForRead(true); |
2702 | |||
2703 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2671 | { | 2704 | { |
2672 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2705 | if (item.Value.Name == sound) |
2673 | { | 2706 | { |
2674 | if (item.Value.Name == sound) | 2707 | soundID = item.Value.ItemID; |
2675 | { | 2708 | break; |
2676 | soundID = item.Value.ItemID; | ||
2677 | break; | ||
2678 | } | ||
2679 | } | 2709 | } |
2680 | } | 2710 | } |
2711 | |||
2712 | TaskInventory.LockItemsForRead(false); | ||
2681 | } | 2713 | } |
2682 | 2714 | ||
2683 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2715 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2737,7 +2769,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2737 | /// <param name="scale"></param> | 2769 | /// <param name="scale"></param> |
2738 | public void Resize(Vector3 scale) | 2770 | public void Resize(Vector3 scale) |
2739 | { | 2771 | { |
2740 | StoreUndoState(); | 2772 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2741 | m_shape.Scale = scale; | 2773 | m_shape.Scale = scale; |
2742 | 2774 | ||
2743 | ParentGroup.HasGroupChanged = true; | 2775 | ParentGroup.HasGroupChanged = true; |
@@ -2746,38 +2778,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2746 | 2778 | ||
2747 | public void RotLookAt(Quaternion target, float strength, float damping) | 2779 | public void RotLookAt(Quaternion target, float strength, float damping) |
2748 | { | 2780 | { |
2749 | rotLookAt(target, strength, damping); | 2781 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2750 | } | ||
2751 | |||
2752 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2753 | { | ||
2754 | if (IsAttachment) | ||
2755 | { | ||
2756 | /* | ||
2757 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2758 | if (avatar != null) | ||
2759 | { | ||
2760 | Rotate the Av? | ||
2761 | } */ | ||
2762 | } | ||
2763 | else | ||
2764 | { | ||
2765 | APIDDamp = damping; | ||
2766 | APIDStrength = strength; | ||
2767 | APIDTarget = target; | ||
2768 | } | ||
2769 | } | ||
2770 | |||
2771 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2772 | { | ||
2773 | APIDDamp = damp; | ||
2774 | APIDStrength = strength; | ||
2775 | APIDTarget = rot; | ||
2776 | } | ||
2777 | |||
2778 | public void stopLookAt() | ||
2779 | { | ||
2780 | APIDTarget = Quaternion.Identity; | ||
2781 | } | 2782 | } |
2782 | 2783 | ||
2783 | /// <summary> | 2784 | /// <summary> |
@@ -2789,7 +2790,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2789 | 2790 | ||
2790 | if (m_parentGroup != null) | 2791 | if (m_parentGroup != null) |
2791 | { | 2792 | { |
2792 | m_parentGroup.QueueForUpdateCheck(); | 2793 | if (!m_parentGroup.areUpdatesSuspended) |
2794 | { | ||
2795 | m_parentGroup.QueueForUpdateCheck(); | ||
2796 | } | ||
2793 | } | 2797 | } |
2794 | 2798 | ||
2795 | int timeNow = Util.UnixTimeSinceEpoch(); | 2799 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -3006,8 +3010,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3006 | { | 3010 | { |
3007 | const float ROTATION_TOLERANCE = 0.01f; | 3011 | const float ROTATION_TOLERANCE = 0.01f; |
3008 | const float VELOCITY_TOLERANCE = 0.001f; | 3012 | const float VELOCITY_TOLERANCE = 0.001f; |
3009 | const float POSITION_TOLERANCE = 0.05f; | 3013 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3010 | const int TIME_MS_TOLERANCE = 3000; | 3014 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3011 | 3015 | ||
3012 | if (m_updateFlag == 1) | 3016 | if (m_updateFlag == 1) |
3013 | { | 3017 | { |
@@ -3021,7 +3025,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3021 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 3025 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
3022 | { | 3026 | { |
3023 | AddTerseUpdateToAllAvatars(); | 3027 | AddTerseUpdateToAllAvatars(); |
3024 | ClearUpdateSchedule(); | 3028 | |
3025 | 3029 | ||
3026 | // This causes the Scene to 'poll' physical objects every couple of frames | 3030 | // This causes the Scene to 'poll' physical objects every couple of frames |
3027 | // bad, so it's been replaced by an event driven method. | 3031 | // bad, so it's been replaced by an event driven method. |
@@ -3039,16 +3043,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3039 | m_lastAngularVelocity = AngularVelocity; | 3043 | m_lastAngularVelocity = AngularVelocity; |
3040 | m_lastTerseSent = Environment.TickCount; | 3044 | m_lastTerseSent = Environment.TickCount; |
3041 | } | 3045 | } |
3046 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
3047 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
3042 | } | 3048 | } |
3043 | else | 3049 | else |
3044 | { | 3050 | { |
3045 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 3051 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3046 | { | 3052 | { |
3047 | AddFullUpdateToAllAvatars(); | 3053 | AddFullUpdateToAllAvatars(); |
3048 | ClearUpdateSchedule(); | 3054 | m_updateFlag = 0; //Same here |
3049 | } | 3055 | } |
3050 | } | 3056 | } |
3051 | ClearUpdateSchedule(); | 3057 | m_updateFlag = 0; |
3052 | } | 3058 | } |
3053 | 3059 | ||
3054 | /// <summary> | 3060 | /// <summary> |
@@ -3068,6 +3074,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3068 | UUID ownerID = _ownerID; | 3074 | UUID ownerID = _ownerID; |
3069 | UUID objectID = UUID; | 3075 | UUID objectID = UUID; |
3070 | UUID parentID = GetRootPartUUID(); | 3076 | UUID parentID = GetRootPartUUID(); |
3077 | |||
3078 | if (ParentGroup.IsAttachment && ParentGroup.RootPart.Shape.State > 30) | ||
3079 | { | ||
3080 | // Use the avatar as the parent for HUDs, since the prims | ||
3081 | // are not sent to other avatars | ||
3082 | objectID = _ownerID; | ||
3083 | parentID = _ownerID; | ||
3084 | } | ||
3085 | |||
3071 | UUID soundID = UUID.Zero; | 3086 | UUID soundID = UUID.Zero; |
3072 | Vector3 position = AbsolutePosition; // region local | 3087 | Vector3 position = AbsolutePosition; // region local |
3073 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; | 3088 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; |
@@ -3075,17 +3090,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3075 | if (!UUID.TryParse(sound, out soundID)) | 3090 | if (!UUID.TryParse(sound, out soundID)) |
3076 | { | 3091 | { |
3077 | // search sound file from inventory | 3092 | // search sound file from inventory |
3078 | lock (TaskInventory) | 3093 | TaskInventory.LockItemsForRead(true); |
3094 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3079 | { | 3095 | { |
3080 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3096 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3081 | { | 3097 | { |
3082 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3098 | soundID = item.Value.ItemID; |
3083 | { | 3099 | break; |
3084 | soundID = item.Value.ItemID; | ||
3085 | break; | ||
3086 | } | ||
3087 | } | 3100 | } |
3088 | } | 3101 | } |
3102 | TaskInventory.LockItemsForRead(false); | ||
3089 | } | 3103 | } |
3090 | 3104 | ||
3091 | if (soundID == UUID.Zero) | 3105 | if (soundID == UUID.Zero) |
@@ -3520,7 +3534,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3520 | 3534 | ||
3521 | public void StopLookAt() | 3535 | public void StopLookAt() |
3522 | { | 3536 | { |
3523 | m_parentGroup.stopLookAt(); | 3537 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3524 | 3538 | ||
3525 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3539 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3526 | } | 3540 | } |
@@ -3547,10 +3561,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3547 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3561 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3548 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3562 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3549 | } | 3563 | } |
3550 | 3564 | public void StoreUndoState(UndoType type) | |
3551 | public void StoreUndoState() | ||
3552 | { | 3565 | { |
3553 | if (!Undoing) | 3566 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3554 | { | 3567 | { |
3555 | if (!IgnoreUndoUpdate) | 3568 | if (!IgnoreUndoUpdate) |
3556 | { | 3569 | { |
@@ -3561,17 +3574,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3561 | if (m_undo.Count > 0) | 3574 | if (m_undo.Count > 0) |
3562 | { | 3575 | { |
3563 | UndoState last = m_undo.Peek(); | 3576 | UndoState last = m_undo.Peek(); |
3564 | if (last != null) | 3577 | |
3565 | { | ||
3566 | if (last.Compare(this)) | ||
3567 | return; | ||
3568 | } | ||
3569 | } | 3578 | } |
3570 | 3579 | ||
3571 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3580 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3572 | { | 3581 | { |
3573 | UndoState nUndo = new UndoState(this); | 3582 | UndoState lastUndo = m_undo.Peek(); |
3574 | 3583 | ||
3584 | UndoState nUndo = new UndoState(this, type); | ||
3585 | |||
3586 | if (lastUndo != null) | ||
3587 | { | ||
3588 | TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); | ||
3589 | if (ts.TotalMilliseconds < 500) | ||
3590 | { | ||
3591 | //Delete the last entry since it was less than 500 milliseconds ago | ||
3592 | nUndo.Merge(lastUndo); | ||
3593 | m_undo.Pop(); | ||
3594 | } | ||
3595 | } | ||
3575 | m_undo.Push(nUndo); | 3596 | m_undo.Push(nUndo); |
3576 | } | 3597 | } |
3577 | 3598 | ||
@@ -4048,11 +4069,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4048 | if (m_undo.Count > 0) | 4069 | if (m_undo.Count > 0) |
4049 | { | 4070 | { |
4050 | UndoState nUndo = null; | 4071 | UndoState nUndo = null; |
4072 | UndoState goback = m_undo.Pop(); | ||
4051 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4073 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4052 | { | 4074 | { |
4053 | nUndo = new UndoState(this); | 4075 | nUndo = new UndoState(this, goback.Type); |
4054 | } | 4076 | } |
4055 | UndoState goback = m_undo.Pop(); | 4077 | |
4078 | |||
4056 | if (goback != null) | 4079 | if (goback != null) |
4057 | { | 4080 | { |
4058 | goback.PlaybackState(this); | 4081 | goback.PlaybackState(this); |
@@ -4067,13 +4090,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4067 | { | 4090 | { |
4068 | lock (m_redo) | 4091 | lock (m_redo) |
4069 | { | 4092 | { |
4093 | UndoState gofwd = m_redo.Pop(); | ||
4070 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4094 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4071 | { | 4095 | { |
4072 | UndoState nUndo = new UndoState(this); | 4096 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4073 | 4097 | ||
4074 | m_undo.Push(nUndo); | 4098 | m_undo.Push(nUndo); |
4075 | } | 4099 | } |
4076 | UndoState gofwd = m_redo.Pop(); | ||
4077 | if (gofwd != null) | 4100 | if (gofwd != null) |
4078 | gofwd.PlayfwdState(this); | 4101 | gofwd.PlayfwdState(this); |
4079 | } | 4102 | } |
@@ -4521,8 +4544,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4521 | { | 4544 | { |
4522 | m_shape.TextureEntry = textureEntry; | 4545 | m_shape.TextureEntry = textureEntry; |
4523 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4546 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4524 | 4547 | m_updateFlag = 1; | |
4525 | ParentGroup.HasGroupChanged = true; | 4548 | ParentGroup.HasGroupChanged = true; |
4549 | |||
4526 | //This is madness.. | 4550 | //This is madness.. |
4527 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4551 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4528 | //This is sparta | 4552 | //This is sparta |
@@ -4767,5 +4791,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4767 | Color color = Color; | 4791 | Color color = Color; |
4768 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4792 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4769 | } | 4793 | } |
4794 | |||
4795 | public void ResetOwnerChangeFlag() | ||
4796 | { | ||
4797 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4798 | |||
4799 | foreach (UUID itemID in inv) | ||
4800 | { | ||
4801 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4802 | item.OwnerChanged = false; | ||
4803 | Inventory.UpdateInventoryItem(item); | ||
4804 | } | ||
4805 | } | ||
4770 | } | 4806 | } |
4771 | } | 4807 | } |