diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 277 |
1 files changed, 159 insertions, 118 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3ed74e1..eefe8bb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -60,7 +60,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
60 | TELEPORT = 512, | 60 | TELEPORT = 512, |
61 | REGION_RESTART = 1024, | 61 | REGION_RESTART = 1024, |
62 | MEDIA = 2048, | 62 | MEDIA = 2048, |
63 | ANIMATION = 16384 | 63 | ANIMATION = 16384, |
64 | POSITION = 32768 | ||
64 | } | 65 | } |
65 | 66 | ||
66 | // I don't really know where to put this except here. | 67 | // I don't really know where to put this except here. |
@@ -149,8 +150,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
149 | 150 | ||
150 | // TODO: This needs to be persisted in next XML version update! | 151 | // TODO: This needs to be persisted in next XML version update! |
151 | [XmlIgnore] | 152 | [XmlIgnore] |
152 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; | 153 | public int[] PayPrice = {-2,-2,-2,-2,-2}; |
153 | 154 | ||
154 | [XmlIgnore] | 155 | [XmlIgnore] |
155 | public PhysicsActor PhysActor | 156 | public PhysicsActor PhysActor |
156 | { | 157 | { |
@@ -193,6 +194,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
193 | [XmlIgnore] | 194 | [XmlIgnore] |
194 | public UUID FromFolderID; | 195 | public UUID FromFolderID; |
195 | 196 | ||
197 | // The following two are to hold the attachment data | ||
198 | // while an object is inworld | ||
199 | [XmlIgnore] | ||
200 | public byte AttachPoint = 0; | ||
201 | |||
202 | [XmlIgnore] | ||
203 | public Vector3 AttachOffset = Vector3.Zero; | ||
204 | |||
196 | [XmlIgnore] | 205 | [XmlIgnore] |
197 | public int STATUS_ROTATE_X; | 206 | public int STATUS_ROTATE_X; |
198 | 207 | ||
@@ -288,6 +297,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
288 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 297 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
289 | private Vector3 m_sitTargetPosition; | 298 | private Vector3 m_sitTargetPosition; |
290 | private string m_sitAnimation = "SIT"; | 299 | private string m_sitAnimation = "SIT"; |
300 | private bool m_occupied; // KF if any av is sitting on this prim | ||
291 | private string m_text = String.Empty; | 301 | private string m_text = String.Empty; |
292 | private string m_touchName = String.Empty; | 302 | private string m_touchName = String.Empty; |
293 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 303 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
@@ -377,7 +387,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, | 387 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, |
378 | Quaternion rotationOffset, Vector3 offsetPosition) | 388 | Quaternion rotationOffset, Vector3 offsetPosition) |
379 | { | 389 | { |
380 | m_name = "Primitive"; | 390 | m_name = "Object"; |
381 | 391 | ||
382 | Rezzed = DateTime.UtcNow; | 392 | Rezzed = DateTime.UtcNow; |
383 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); | 393 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); |
@@ -473,12 +483,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
473 | } | 483 | } |
474 | 484 | ||
475 | /// <value> | 485 | /// <value> |
476 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 486 | /// Get the inventory list |
477 | /// </value> | 487 | /// </value> |
478 | public TaskInventoryDictionary TaskInventory | 488 | public TaskInventoryDictionary TaskInventory |
479 | { | 489 | { |
480 | get { return m_inventory.Items; } | 490 | get { |
481 | set { m_inventory.Items = value; } | 491 | return m_inventory.Items; |
492 | } | ||
493 | set { | ||
494 | m_inventory.Items = value; | ||
495 | } | ||
482 | } | 496 | } |
483 | 497 | ||
484 | /// <summary> | 498 | /// <summary> |
@@ -611,14 +625,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
611 | set { m_LoopSoundSlavePrims = value; } | 625 | set { m_LoopSoundSlavePrims = value; } |
612 | } | 626 | } |
613 | 627 | ||
614 | [XmlIgnore] | ||
615 | public Byte[] TextureAnimation | 628 | public Byte[] TextureAnimation |
616 | { | 629 | { |
617 | get { return m_TextureAnimation; } | 630 | get { return m_TextureAnimation; } |
618 | set { m_TextureAnimation = value; } | 631 | set { m_TextureAnimation = value; } |
619 | } | 632 | } |
620 | 633 | ||
621 | [XmlIgnore] | ||
622 | public Byte[] ParticleSystem | 634 | public Byte[] ParticleSystem |
623 | { | 635 | { |
624 | get { return m_particleSystem; } | 636 | get { return m_particleSystem; } |
@@ -672,7 +684,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
672 | set | 684 | set |
673 | { | 685 | { |
674 | m_groupPosition = value; | 686 | m_groupPosition = value; |
675 | |||
676 | PhysicsActor actor = PhysActor; | 687 | PhysicsActor actor = PhysActor; |
677 | if (actor != null) | 688 | if (actor != null) |
678 | { | 689 | { |
@@ -692,25 +703,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
692 | 703 | ||
693 | // Tell the physics engines that this prim changed. | 704 | // Tell the physics engines that this prim changed. |
694 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 705 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
706 | |||
695 | } | 707 | } |
696 | catch (Exception e) | 708 | catch (Exception e) |
697 | { | 709 | { |
698 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); | 710 | m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); |
699 | } | 711 | } |
700 | } | 712 | } |
701 | |||
702 | // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too | ||
703 | if (m_sitTargetAvatar != UUID.Zero) | ||
704 | { | ||
705 | if (m_parentGroup != null) // TODO can there be a SOP without a SOG? | ||
706 | { | ||
707 | ScenePresence avatar; | ||
708 | if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar)) | ||
709 | { | ||
710 | avatar.ParentPosition = GetWorldPosition(); | ||
711 | } | ||
712 | } | ||
713 | } | ||
714 | } | 713 | } |
715 | } | 714 | } |
716 | 715 | ||
@@ -719,7 +718,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
719 | get { return m_offsetPosition; } | 718 | get { return m_offsetPosition; } |
720 | set | 719 | set |
721 | { | 720 | { |
722 | StoreUndoState(); | 721 | Vector3 oldpos = m_offsetPosition; |
722 | StoreUndoState(UndoType.STATE_PRIM_POSITION); | ||
723 | m_offsetPosition = value; | 723 | m_offsetPosition = value; |
724 | 724 | ||
725 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 725 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -733,7 +733,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
733 | // Tell the physics engines that this prim changed. | 733 | // Tell the physics engines that this prim changed. |
734 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 734 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
735 | } | 735 | } |
736 | |||
737 | if (!m_parentGroup.m_dupeInProgress) | ||
738 | { | ||
739 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
740 | foreach (ScenePresence av in avs) | ||
741 | { | ||
742 | if (av.LinkedPrim == m_uuid) | ||
743 | { | ||
744 | Vector3 offset = (m_offsetPosition - oldpos); | ||
745 | av.OffsetPosition += offset; | ||
746 | av.SendFullUpdateToAllClients(); | ||
747 | } | ||
748 | } | ||
749 | } | ||
736 | } | 750 | } |
751 | TriggerScriptChangedEvent(Changed.POSITION); | ||
737 | } | 752 | } |
738 | } | 753 | } |
739 | 754 | ||
@@ -775,7 +790,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
775 | 790 | ||
776 | set | 791 | set |
777 | { | 792 | { |
778 | StoreUndoState(); | 793 | StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
779 | m_rotationOffset = value; | 794 | m_rotationOffset = value; |
780 | 795 | ||
781 | PhysicsActor actor = PhysActor; | 796 | PhysicsActor actor = PhysActor; |
@@ -859,7 +874,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
859 | /// <summary></summary> | 874 | /// <summary></summary> |
860 | public Vector3 Acceleration | 875 | public Vector3 Acceleration |
861 | { | 876 | { |
862 | get { return m_acceleration; } | 877 | get |
878 | { | ||
879 | PhysicsActor actor = PhysActor; | ||
880 | if (actor != null) | ||
881 | { | ||
882 | m_acceleration = actor.Acceleration; | ||
883 | } | ||
884 | return m_acceleration; | ||
885 | } | ||
886 | |||
863 | set { m_acceleration = value; } | 887 | set { m_acceleration = value; } |
864 | } | 888 | } |
865 | 889 | ||
@@ -964,7 +988,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
964 | get { return m_shape.Scale; } | 988 | get { return m_shape.Scale; } |
965 | set | 989 | set |
966 | { | 990 | { |
967 | StoreUndoState(); | 991 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
968 | if (m_shape != null) | 992 | if (m_shape != null) |
969 | { | 993 | { |
970 | m_shape.Scale = value; | 994 | m_shape.Scale = value; |
@@ -1034,7 +1058,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1034 | if (IsAttachment) | 1058 | if (IsAttachment) |
1035 | return GroupPosition; | 1059 | return GroupPosition; |
1036 | 1060 | ||
1037 | return m_offsetPosition + m_groupPosition; } | 1061 | // return m_offsetPosition + m_groupPosition; } |
1062 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
1038 | } | 1063 | } |
1039 | 1064 | ||
1040 | public SceneObjectGroup ParentGroup | 1065 | public SceneObjectGroup ParentGroup |
@@ -1193,6 +1218,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1193 | _flags = value; | 1218 | _flags = value; |
1194 | } | 1219 | } |
1195 | } | 1220 | } |
1221 | |||
1222 | [XmlIgnore] | ||
1223 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1224 | { | ||
1225 | get { return m_occupied; } | ||
1226 | set { m_occupied = value; } | ||
1227 | } | ||
1196 | 1228 | ||
1197 | [XmlIgnore] | 1229 | [XmlIgnore] |
1198 | public UUID SitTargetAvatar | 1230 | public UUID SitTargetAvatar |
@@ -1268,14 +1300,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1268 | } | 1300 | } |
1269 | } | 1301 | } |
1270 | 1302 | ||
1271 | /// <summary> | ||
1272 | /// Clear all pending updates of parts to clients | ||
1273 | /// </summary> | ||
1274 | private void ClearUpdateSchedule() | ||
1275 | { | ||
1276 | m_updateFlag = 0; | ||
1277 | } | ||
1278 | |||
1279 | private void SendObjectPropertiesToClient(UUID AgentID) | 1303 | private void SendObjectPropertiesToClient(UUID AgentID) |
1280 | { | 1304 | { |
1281 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1305 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1526,14 +1550,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1526 | // or flexible | 1550 | // or flexible |
1527 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1551 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1528 | { | 1552 | { |
1529 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 1553 | try |
1530 | Name, | 1554 | { |
1531 | Shape, | 1555 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
1532 | AbsolutePosition, | 1556 | Name, |
1533 | Scale, | 1557 | Shape, |
1534 | RotationOffset, | 1558 | AbsolutePosition, |
1535 | RigidBody); | 1559 | Scale, |
1536 | 1560 | RotationOffset, | |
1561 | RigidBody); | ||
1562 | } | ||
1563 | catch | ||
1564 | { | ||
1565 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
1566 | PhysActor = null; | ||
1567 | } | ||
1537 | // Basic Physics returns null.. joy joy joy. | 1568 | // Basic Physics returns null.. joy joy joy. |
1538 | if (PhysActor != null) | 1569 | if (PhysActor != null) |
1539 | { | 1570 | { |
@@ -1561,7 +1592,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1561 | { | 1592 | { |
1562 | m_redo.Clear(); | 1593 | m_redo.Clear(); |
1563 | } | 1594 | } |
1564 | StoreUndoState(); | 1595 | StoreUndoState(UndoType.STATE_ALL); |
1565 | } | 1596 | } |
1566 | 1597 | ||
1567 | public byte ConvertScriptUintToByte(uint indata) | 1598 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1673,7 +1704,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1673 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1704 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1674 | part.Shape = shape; | 1705 | part.Shape = shape; |
1675 | 1706 | ||
1676 | part.Name = "Primitive"; | 1707 | part.Name = "Object"; |
1677 | part._ownerID = UUID.Random(); | 1708 | part._ownerID = UUID.Random(); |
1678 | 1709 | ||
1679 | return part; | 1710 | return part; |
@@ -2033,12 +2064,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2033 | public Vector3 GetWorldPosition() | 2064 | public Vector3 GetWorldPosition() |
2034 | { | 2065 | { |
2035 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 2066 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
2036 | |||
2037 | Vector3 axPos = OffsetPosition; | 2067 | Vector3 axPos = OffsetPosition; |
2038 | |||
2039 | axPos *= parentRot; | 2068 | axPos *= parentRot; |
2040 | Vector3 translationOffsetPosition = axPos; | 2069 | Vector3 translationOffsetPosition = axPos; |
2041 | return GroupPosition + translationOffsetPosition; | 2070 | if(_parentID == 0) |
2071 | { | ||
2072 | return GroupPosition; | ||
2073 | } | ||
2074 | else | ||
2075 | { | ||
2076 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
2077 | } | ||
2042 | } | 2078 | } |
2043 | 2079 | ||
2044 | /// <summary> | 2080 | /// <summary> |
@@ -2049,7 +2085,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2049 | { | 2085 | { |
2050 | Quaternion newRot; | 2086 | Quaternion newRot; |
2051 | 2087 | ||
2052 | if (this.LinkNum == 0) | 2088 | if (this.LinkNum < 2) //KF Single or root prim |
2053 | { | 2089 | { |
2054 | newRot = RotationOffset; | 2090 | newRot = RotationOffset; |
2055 | } | 2091 | } |
@@ -2695,17 +2731,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2695 | //Trys to fetch sound id from prim's inventory. | 2731 | //Trys to fetch sound id from prim's inventory. |
2696 | //Prim's inventory doesn't support non script items yet | 2732 | //Prim's inventory doesn't support non script items yet |
2697 | 2733 | ||
2698 | lock (TaskInventory) | 2734 | TaskInventory.LockItemsForRead(true); |
2735 | |||
2736 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2699 | { | 2737 | { |
2700 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2738 | if (item.Value.Name == sound) |
2701 | { | 2739 | { |
2702 | if (item.Value.Name == sound) | 2740 | soundID = item.Value.ItemID; |
2703 | { | 2741 | break; |
2704 | soundID = item.Value.ItemID; | ||
2705 | break; | ||
2706 | } | ||
2707 | } | 2742 | } |
2708 | } | 2743 | } |
2744 | |||
2745 | TaskInventory.LockItemsForRead(false); | ||
2709 | } | 2746 | } |
2710 | 2747 | ||
2711 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2748 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2765,7 +2802,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2765 | /// <param name="scale"></param> | 2802 | /// <param name="scale"></param> |
2766 | public void Resize(Vector3 scale) | 2803 | public void Resize(Vector3 scale) |
2767 | { | 2804 | { |
2768 | StoreUndoState(); | 2805 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2769 | m_shape.Scale = scale; | 2806 | m_shape.Scale = scale; |
2770 | 2807 | ||
2771 | ParentGroup.HasGroupChanged = true; | 2808 | ParentGroup.HasGroupChanged = true; |
@@ -2774,38 +2811,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2774 | 2811 | ||
2775 | public void RotLookAt(Quaternion target, float strength, float damping) | 2812 | public void RotLookAt(Quaternion target, float strength, float damping) |
2776 | { | 2813 | { |
2777 | rotLookAt(target, strength, damping); | 2814 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2778 | } | ||
2779 | |||
2780 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2781 | { | ||
2782 | if (IsAttachment) | ||
2783 | { | ||
2784 | /* | ||
2785 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2786 | if (avatar != null) | ||
2787 | { | ||
2788 | Rotate the Av? | ||
2789 | } */ | ||
2790 | } | ||
2791 | else | ||
2792 | { | ||
2793 | APIDDamp = damping; | ||
2794 | APIDStrength = strength; | ||
2795 | APIDTarget = target; | ||
2796 | } | ||
2797 | } | ||
2798 | |||
2799 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2800 | { | ||
2801 | APIDDamp = damp; | ||
2802 | APIDStrength = strength; | ||
2803 | APIDTarget = rot; | ||
2804 | } | ||
2805 | |||
2806 | public void stopLookAt() | ||
2807 | { | ||
2808 | APIDTarget = Quaternion.Identity; | ||
2809 | } | 2815 | } |
2810 | 2816 | ||
2811 | /// <summary> | 2817 | /// <summary> |
@@ -2817,7 +2823,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2817 | 2823 | ||
2818 | if (m_parentGroup != null) | 2824 | if (m_parentGroup != null) |
2819 | { | 2825 | { |
2820 | m_parentGroup.QueueForUpdateCheck(); | 2826 | if (!m_parentGroup.areUpdatesSuspended) |
2827 | { | ||
2828 | m_parentGroup.QueueForUpdateCheck(); | ||
2829 | } | ||
2821 | } | 2830 | } |
2822 | 2831 | ||
2823 | int timeNow = Util.UnixTimeSinceEpoch(); | 2832 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -3034,8 +3043,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3034 | { | 3043 | { |
3035 | const float ROTATION_TOLERANCE = 0.01f; | 3044 | const float ROTATION_TOLERANCE = 0.01f; |
3036 | const float VELOCITY_TOLERANCE = 0.001f; | 3045 | const float VELOCITY_TOLERANCE = 0.001f; |
3037 | const float POSITION_TOLERANCE = 0.05f; | 3046 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3038 | const int TIME_MS_TOLERANCE = 3000; | 3047 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3039 | 3048 | ||
3040 | if (m_updateFlag == 1) | 3049 | if (m_updateFlag == 1) |
3041 | { | 3050 | { |
@@ -3049,7 +3058,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3049 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 3058 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
3050 | { | 3059 | { |
3051 | AddTerseUpdateToAllAvatars(); | 3060 | AddTerseUpdateToAllAvatars(); |
3052 | ClearUpdateSchedule(); | 3061 | |
3053 | 3062 | ||
3054 | // This causes the Scene to 'poll' physical objects every couple of frames | 3063 | // This causes the Scene to 'poll' physical objects every couple of frames |
3055 | // bad, so it's been replaced by an event driven method. | 3064 | // bad, so it's been replaced by an event driven method. |
@@ -3067,16 +3076,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3067 | m_lastAngularVelocity = AngularVelocity; | 3076 | m_lastAngularVelocity = AngularVelocity; |
3068 | m_lastTerseSent = Environment.TickCount; | 3077 | m_lastTerseSent = Environment.TickCount; |
3069 | } | 3078 | } |
3079 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
3080 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
3070 | } | 3081 | } |
3071 | else | 3082 | else |
3072 | { | 3083 | { |
3073 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 3084 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3074 | { | 3085 | { |
3075 | AddFullUpdateToAllAvatars(); | 3086 | AddFullUpdateToAllAvatars(); |
3076 | ClearUpdateSchedule(); | 3087 | m_updateFlag = 0; //Same here |
3077 | } | 3088 | } |
3078 | } | 3089 | } |
3079 | ClearUpdateSchedule(); | 3090 | m_updateFlag = 0; |
3080 | } | 3091 | } |
3081 | 3092 | ||
3082 | /// <summary> | 3093 | /// <summary> |
@@ -3096,6 +3107,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3096 | UUID ownerID = _ownerID; | 3107 | UUID ownerID = _ownerID; |
3097 | UUID objectID = UUID; | 3108 | UUID objectID = UUID; |
3098 | UUID parentID = GetRootPartUUID(); | 3109 | UUID parentID = GetRootPartUUID(); |
3110 | |||
3111 | if (ParentGroup.IsAttachment && ParentGroup.RootPart.Shape.State > 30) | ||
3112 | { | ||
3113 | // Use the avatar as the parent for HUDs, since the prims | ||
3114 | // are not sent to other avatars | ||
3115 | objectID = _ownerID; | ||
3116 | parentID = _ownerID; | ||
3117 | } | ||
3118 | |||
3099 | UUID soundID = UUID.Zero; | 3119 | UUID soundID = UUID.Zero; |
3100 | Vector3 position = AbsolutePosition; // region local | 3120 | Vector3 position = AbsolutePosition; // region local |
3101 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; | 3121 | ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; |
@@ -3103,17 +3123,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3103 | if (!UUID.TryParse(sound, out soundID)) | 3123 | if (!UUID.TryParse(sound, out soundID)) |
3104 | { | 3124 | { |
3105 | // search sound file from inventory | 3125 | // search sound file from inventory |
3106 | lock (TaskInventory) | 3126 | TaskInventory.LockItemsForRead(true); |
3127 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3107 | { | 3128 | { |
3108 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3129 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3109 | { | 3130 | { |
3110 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3131 | soundID = item.Value.ItemID; |
3111 | { | 3132 | break; |
3112 | soundID = item.Value.ItemID; | ||
3113 | break; | ||
3114 | } | ||
3115 | } | 3133 | } |
3116 | } | 3134 | } |
3135 | TaskInventory.LockItemsForRead(false); | ||
3117 | } | 3136 | } |
3118 | 3137 | ||
3119 | if (soundID == UUID.Zero) | 3138 | if (soundID == UUID.Zero) |
@@ -3550,7 +3569,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3550 | 3569 | ||
3551 | public void StopLookAt() | 3570 | public void StopLookAt() |
3552 | { | 3571 | { |
3553 | m_parentGroup.stopLookAt(); | 3572 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3554 | 3573 | ||
3555 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3574 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3556 | } | 3575 | } |
@@ -3577,10 +3596,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3577 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3596 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3578 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3597 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3579 | } | 3598 | } |
3580 | 3599 | public void StoreUndoState(UndoType type) | |
3581 | public void StoreUndoState() | ||
3582 | { | 3600 | { |
3583 | if (!Undoing) | 3601 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3584 | { | 3602 | { |
3585 | if (!IgnoreUndoUpdate) | 3603 | if (!IgnoreUndoUpdate) |
3586 | { | 3604 | { |
@@ -3591,17 +3609,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3591 | if (m_undo.Count > 0) | 3609 | if (m_undo.Count > 0) |
3592 | { | 3610 | { |
3593 | UndoState last = m_undo.Peek(); | 3611 | UndoState last = m_undo.Peek(); |
3594 | if (last != null) | 3612 | |
3595 | { | ||
3596 | if (last.Compare(this)) | ||
3597 | return; | ||
3598 | } | ||
3599 | } | 3613 | } |
3600 | 3614 | ||
3601 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3615 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3602 | { | 3616 | { |
3603 | UndoState nUndo = new UndoState(this); | 3617 | UndoState lastUndo = m_undo.Peek(); |
3618 | |||
3619 | UndoState nUndo = new UndoState(this, type); | ||
3604 | 3620 | ||
3621 | if (lastUndo != null) | ||
3622 | { | ||
3623 | TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); | ||
3624 | if (ts.TotalMilliseconds < 500) | ||
3625 | { | ||
3626 | //Delete the last entry since it was less than 500 milliseconds ago | ||
3627 | nUndo.Merge(lastUndo); | ||
3628 | m_undo.Pop(); | ||
3629 | } | ||
3630 | } | ||
3605 | m_undo.Push(nUndo); | 3631 | m_undo.Push(nUndo); |
3606 | } | 3632 | } |
3607 | 3633 | ||
@@ -4078,11 +4104,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4078 | if (m_undo.Count > 0) | 4104 | if (m_undo.Count > 0) |
4079 | { | 4105 | { |
4080 | UndoState nUndo = null; | 4106 | UndoState nUndo = null; |
4107 | UndoState goback = m_undo.Pop(); | ||
4081 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4108 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4082 | { | 4109 | { |
4083 | nUndo = new UndoState(this); | 4110 | nUndo = new UndoState(this, goback.Type); |
4084 | } | 4111 | } |
4085 | UndoState goback = m_undo.Pop(); | 4112 | |
4113 | |||
4086 | if (goback != null) | 4114 | if (goback != null) |
4087 | { | 4115 | { |
4088 | goback.PlaybackState(this); | 4116 | goback.PlaybackState(this); |
@@ -4097,13 +4125,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4097 | { | 4125 | { |
4098 | lock (m_redo) | 4126 | lock (m_redo) |
4099 | { | 4127 | { |
4128 | UndoState gofwd = m_redo.Pop(); | ||
4100 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4129 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4101 | { | 4130 | { |
4102 | UndoState nUndo = new UndoState(this); | 4131 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4103 | 4132 | ||
4104 | m_undo.Push(nUndo); | 4133 | m_undo.Push(nUndo); |
4105 | } | 4134 | } |
4106 | UndoState gofwd = m_redo.Pop(); | ||
4107 | if (gofwd != null) | 4135 | if (gofwd != null) |
4108 | gofwd.PlayfwdState(this); | 4136 | gofwd.PlayfwdState(this); |
4109 | } | 4137 | } |
@@ -4551,8 +4579,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4551 | { | 4579 | { |
4552 | m_shape.TextureEntry = textureEntry; | 4580 | m_shape.TextureEntry = textureEntry; |
4553 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4581 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4554 | 4582 | m_updateFlag = 1; | |
4555 | ParentGroup.HasGroupChanged = true; | 4583 | ParentGroup.HasGroupChanged = true; |
4584 | |||
4556 | //This is madness.. | 4585 | //This is madness.. |
4557 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4586 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4558 | //This is sparta | 4587 | //This is sparta |
@@ -4785,5 +4814,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4785 | Color color = Color; | 4814 | Color color = Color; |
4786 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4815 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4787 | } | 4816 | } |
4817 | |||
4818 | public void ResetOwnerChangeFlag() | ||
4819 | { | ||
4820 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4821 | |||
4822 | foreach (UUID itemID in inv) | ||
4823 | { | ||
4824 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4825 | item.OwnerChanged = false; | ||
4826 | Inventory.UpdateInventoryItem(item); | ||
4827 | } | ||
4828 | } | ||
4788 | } | 4829 | } |
4789 | } | 4830 | } |