aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs281
1 files changed, 158 insertions, 123 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f87056e..db60ae3 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; }
@@ -735,7 +747,6 @@ namespace OpenSim.Region.Framework.Scenes
735 set 747 set
736 { 748 {
737 m_groupPosition = value; 749 m_groupPosition = value;
738
739 PhysicsActor actor = PhysActor; 750 PhysicsActor actor = PhysActor;
740 if (actor != null) 751 if (actor != null)
741 { 752 {
@@ -755,25 +766,13 @@ namespace OpenSim.Region.Framework.Scenes
755 766
756 // Tell the physics engines that this prim changed. 767 // Tell the physics engines that this prim changed.
757 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 768 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
769
758 } 770 }
759 catch (Exception e) 771 catch (Exception e)
760 { 772 {
761 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); 773 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message);
762 } 774 }
763 } 775 }
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 } 776 }
778 } 777 }
779 778
@@ -782,7 +781,8 @@ namespace OpenSim.Region.Framework.Scenes
782 get { return m_offsetPosition; } 781 get { return m_offsetPosition; }
783 set 782 set
784 { 783 {
785 StoreUndoState(); 784 Vector3 oldpos = m_offsetPosition;
785 StoreUndoState(UndoType.STATE_PRIM_POSITION);
786 m_offsetPosition = value; 786 m_offsetPosition = value;
787 787
788 if (ParentGroup != null && !ParentGroup.IsDeleted) 788 if (ParentGroup != null && !ParentGroup.IsDeleted)
@@ -796,7 +796,22 @@ namespace OpenSim.Region.Framework.Scenes
796 // Tell the physics engines that this prim changed. 796 // Tell the physics engines that this prim changed.
797 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 797 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
798 } 798 }
799
800 if (!m_parentGroup.m_dupeInProgress)
801 {
802 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars();
803 foreach (ScenePresence av in avs)
804 {
805 if (av.LinkedPrim == m_uuid)
806 {
807 Vector3 offset = (m_offsetPosition - oldpos);
808 av.OffsetPosition += offset;
809 av.SendAvatarDataToAllAgents();
810 }
811 }
812 }
799 } 813 }
814 TriggerScriptChangedEvent(Changed.POSITION);
800 } 815 }
801 } 816 }
802 817
@@ -838,7 +853,7 @@ namespace OpenSim.Region.Framework.Scenes
838 853
839 set 854 set
840 { 855 {
841 StoreUndoState(); 856 StoreUndoState(UndoType.STATE_PRIM_ROTATION);
842 m_rotationOffset = value; 857 m_rotationOffset = value;
843 858
844 PhysicsActor actor = PhysActor; 859 PhysicsActor actor = PhysActor;
@@ -922,7 +937,16 @@ namespace OpenSim.Region.Framework.Scenes
922 /// <summary></summary> 937 /// <summary></summary>
923 public Vector3 Acceleration 938 public Vector3 Acceleration
924 { 939 {
925 get { return m_acceleration; } 940 get
941 {
942 PhysicsActor actor = PhysActor;
943 if (actor != null)
944 {
945 m_acceleration = actor.Acceleration;
946 }
947 return m_acceleration;
948 }
949
926 set { m_acceleration = value; } 950 set { m_acceleration = value; }
927 } 951 }
928 952
@@ -1013,7 +1037,7 @@ namespace OpenSim.Region.Framework.Scenes
1013 get { return m_shape.Scale; } 1037 get { return m_shape.Scale; }
1014 set 1038 set
1015 { 1039 {
1016 StoreUndoState(); 1040 StoreUndoState(UndoType.STATE_PRIM_SCALE);
1017 if (m_shape != null) 1041 if (m_shape != null)
1018 { 1042 {
1019 m_shape.Scale = value; 1043 m_shape.Scale = value;
@@ -1081,9 +1105,10 @@ namespace OpenSim.Region.Framework.Scenes
1081 { 1105 {
1082 get { 1106 get {
1083 if (IsAttachment) 1107 if (IsAttachment)
1084 return GroupPosition; 1108 return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset);
1085 1109
1086 return m_offsetPosition + m_groupPosition; } 1110// return m_offsetPosition + m_groupPosition; }
1111 return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored!
1087 } 1112 }
1088 1113
1089 public SceneObjectGroup ParentGroup 1114 public SceneObjectGroup ParentGroup
@@ -1242,6 +1267,13 @@ namespace OpenSim.Region.Framework.Scenes
1242 _flags = value; 1267 _flags = value;
1243 } 1268 }
1244 } 1269 }
1270
1271 [XmlIgnore]
1272 public bool IsOccupied // KF If an av is sittingon this prim
1273 {
1274 get { return m_occupied; }
1275 set { m_occupied = value; }
1276 }
1245 1277
1246 1278
1247 public UUID SitTargetAvatar 1279 public UUID SitTargetAvatar
@@ -1317,14 +1349,6 @@ namespace OpenSim.Region.Framework.Scenes
1317 } 1349 }
1318 } 1350 }
1319 1351
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) 1352 private void SendObjectPropertiesToClient(UUID AgentID)
1329 { 1353 {
1330 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1354 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
@@ -1575,14 +1599,21 @@ namespace OpenSim.Region.Framework.Scenes
1575 // or flexible 1599 // or flexible
1576 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) 1600 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
1577 { 1601 {
1578 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 1602 try
1579 string.Format("{0}/{1}", Name, UUID), 1603 {
1580 Shape, 1604 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1581 AbsolutePosition, 1605 string.Format("{0}/{1}", Name, UUID),
1582 Scale, 1606 Shape,
1583 RotationOffset, 1607 AbsolutePosition,
1584 RigidBody); 1608 Scale,
1585 1609 RotationOffset,
1610 RigidBody);
1611 }
1612 catch
1613 {
1614 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
1615 PhysActor = null;
1616 }
1586 // Basic Physics returns null.. joy joy joy. 1617 // Basic Physics returns null.. joy joy joy.
1587 if (PhysActor != null) 1618 if (PhysActor != null)
1588 { 1619 {
@@ -1610,7 +1641,7 @@ namespace OpenSim.Region.Framework.Scenes
1610 { 1641 {
1611 m_redo.Clear(); 1642 m_redo.Clear();
1612 } 1643 }
1613 StoreUndoState(); 1644 StoreUndoState(UndoType.STATE_ALL);
1614 } 1645 }
1615 1646
1616 public byte ConvertScriptUintToByte(uint indata) 1647 public byte ConvertScriptUintToByte(uint indata)
@@ -1679,6 +1710,9 @@ namespace OpenSim.Region.Framework.Scenes
1679 1710
1680 // Move afterwards ResetIDs as it clears the localID 1711 // Move afterwards ResetIDs as it clears the localID
1681 dupe.LocalId = localID; 1712 dupe.LocalId = localID;
1713 if(dupe.PhysActor != null)
1714 dupe.PhysActor.LocalID = localID;
1715
1682 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. 1716 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
1683 dupe._lastOwnerID = OwnerID; 1717 dupe._lastOwnerID = OwnerID;
1684 1718
@@ -1722,7 +1756,7 @@ namespace OpenSim.Region.Framework.Scenes
1722 PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); 1756 PrimitiveBaseShape shape = PrimitiveBaseShape.Create();
1723 part.Shape = shape; 1757 part.Shape = shape;
1724 1758
1725 part.Name = "Primitive"; 1759 part.Name = "Object";
1726 part._ownerID = UUID.Random(); 1760 part._ownerID = UUID.Random();
1727 1761
1728 return part; 1762 return part;
@@ -2082,12 +2116,17 @@ namespace OpenSim.Region.Framework.Scenes
2082 public Vector3 GetWorldPosition() 2116 public Vector3 GetWorldPosition()
2083 { 2117 {
2084 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 2118 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
2085
2086 Vector3 axPos = OffsetPosition; 2119 Vector3 axPos = OffsetPosition;
2087
2088 axPos *= parentRot; 2120 axPos *= parentRot;
2089 Vector3 translationOffsetPosition = axPos; 2121 Vector3 translationOffsetPosition = axPos;
2090 return GroupPosition + translationOffsetPosition; 2122 if(_parentID == 0)
2123 {
2124 return GroupPosition;
2125 }
2126 else
2127 {
2128 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
2129 }
2091 } 2130 }
2092 2131
2093 /// <summary> 2132 /// <summary>
@@ -2098,7 +2137,7 @@ namespace OpenSim.Region.Framework.Scenes
2098 { 2137 {
2099 Quaternion newRot; 2138 Quaternion newRot;
2100 2139
2101 if (this.LinkNum == 0) 2140 if (this.LinkNum < 2) //KF Single or root prim
2102 { 2141 {
2103 newRot = RotationOffset; 2142 newRot = RotationOffset;
2104 } 2143 }
@@ -2744,17 +2783,18 @@ namespace OpenSim.Region.Framework.Scenes
2744 //Trys to fetch sound id from prim's inventory. 2783 //Trys to fetch sound id from prim's inventory.
2745 //Prim's inventory doesn't support non script items yet 2784 //Prim's inventory doesn't support non script items yet
2746 2785
2747 lock (TaskInventory) 2786 TaskInventory.LockItemsForRead(true);
2787
2788 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2748 { 2789 {
2749 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2790 if (item.Value.Name == sound)
2750 { 2791 {
2751 if (item.Value.Name == sound) 2792 soundID = item.Value.ItemID;
2752 { 2793 break;
2753 soundID = item.Value.ItemID;
2754 break;
2755 }
2756 } 2794 }
2757 } 2795 }
2796
2797 TaskInventory.LockItemsForRead(false);
2758 } 2798 }
2759 2799
2760 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2800 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -2814,7 +2854,7 @@ namespace OpenSim.Region.Framework.Scenes
2814 /// <param name="scale"></param> 2854 /// <param name="scale"></param>
2815 public void Resize(Vector3 scale) 2855 public void Resize(Vector3 scale)
2816 { 2856 {
2817 StoreUndoState(); 2857 StoreUndoState(UndoType.STATE_PRIM_SCALE);
2818 m_shape.Scale = scale; 2858 m_shape.Scale = scale;
2819 2859
2820 ParentGroup.HasGroupChanged = true; 2860 ParentGroup.HasGroupChanged = true;
@@ -2823,38 +2863,7 @@ namespace OpenSim.Region.Framework.Scenes
2823 2863
2824 public void RotLookAt(Quaternion target, float strength, float damping) 2864 public void RotLookAt(Quaternion target, float strength, float damping)
2825 { 2865 {
2826 rotLookAt(target, strength, damping); 2866 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 } 2867 }
2859 2868
2860 /// <summary> 2869 /// <summary>
@@ -2866,7 +2875,10 @@ namespace OpenSim.Region.Framework.Scenes
2866 2875
2867 if (m_parentGroup != null) 2876 if (m_parentGroup != null)
2868 { 2877 {
2869 m_parentGroup.QueueForUpdateCheck(); 2878 if (!m_parentGroup.areUpdatesSuspended)
2879 {
2880 m_parentGroup.QueueForUpdateCheck();
2881 }
2870 } 2882 }
2871 2883
2872 int timeNow = Util.UnixTimeSinceEpoch(); 2884 int timeNow = Util.UnixTimeSinceEpoch();
@@ -3083,8 +3095,8 @@ namespace OpenSim.Region.Framework.Scenes
3083 { 3095 {
3084 const float ROTATION_TOLERANCE = 0.01f; 3096 const float ROTATION_TOLERANCE = 0.01f;
3085 const float VELOCITY_TOLERANCE = 0.001f; 3097 const float VELOCITY_TOLERANCE = 0.001f;
3086 const float POSITION_TOLERANCE = 0.05f; 3098 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
3087 const int TIME_MS_TOLERANCE = 3000; 3099 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
3088 3100
3089 if (m_updateFlag == 1) 3101 if (m_updateFlag == 1)
3090 { 3102 {
@@ -3098,7 +3110,7 @@ namespace OpenSim.Region.Framework.Scenes
3098 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 3110 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
3099 { 3111 {
3100 AddTerseUpdateToAllAvatars(); 3112 AddTerseUpdateToAllAvatars();
3101 ClearUpdateSchedule(); 3113
3102 3114
3103 // This causes the Scene to 'poll' physical objects every couple of frames 3115 // This causes the Scene to 'poll' physical objects every couple of frames
3104 // bad, so it's been replaced by an event driven method. 3116 // bad, so it's been replaced by an event driven method.
@@ -3116,16 +3128,18 @@ namespace OpenSim.Region.Framework.Scenes
3116 m_lastAngularVelocity = AngularVelocity; 3128 m_lastAngularVelocity = AngularVelocity;
3117 m_lastTerseSent = Environment.TickCount; 3129 m_lastTerseSent = Environment.TickCount;
3118 } 3130 }
3131 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
3132 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
3119 } 3133 }
3120 else 3134 else
3121 { 3135 {
3122 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 3136 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
3123 { 3137 {
3124 AddFullUpdateToAllAvatars(); 3138 AddFullUpdateToAllAvatars();
3125 ClearUpdateSchedule(); 3139 m_updateFlag = 0; //Same here
3126 } 3140 }
3127 } 3141 }
3128 ClearUpdateSchedule(); 3142 m_updateFlag = 0;
3129 } 3143 }
3130 3144
3131 /// <summary> 3145 /// <summary>
@@ -3153,17 +3167,16 @@ namespace OpenSim.Region.Framework.Scenes
3153 if (!UUID.TryParse(sound, out soundID)) 3167 if (!UUID.TryParse(sound, out soundID))
3154 { 3168 {
3155 // search sound file from inventory 3169 // search sound file from inventory
3156 lock (TaskInventory) 3170 TaskInventory.LockItemsForRead(true);
3171 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3157 { 3172 {
3158 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3173 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3159 { 3174 {
3160 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3175 soundID = item.Value.ItemID;
3161 { 3176 break;
3162 soundID = item.Value.ItemID;
3163 break;
3164 }
3165 } 3177 }
3166 } 3178 }
3179 TaskInventory.LockItemsForRead(false);
3167 } 3180 }
3168 3181
3169 if (soundID == UUID.Zero) 3182 if (soundID == UUID.Zero)
@@ -3600,7 +3613,7 @@ namespace OpenSim.Region.Framework.Scenes
3600 3613
3601 public void StopLookAt() 3614 public void StopLookAt()
3602 { 3615 {
3603 m_parentGroup.stopLookAt(); 3616 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3604 3617
3605 m_parentGroup.ScheduleGroupForTerseUpdate(); 3618 m_parentGroup.ScheduleGroupForTerseUpdate();
3606 } 3619 }
@@ -3627,10 +3640,9 @@ namespace OpenSim.Region.Framework.Scenes
3627 m_parentGroup.ScheduleGroupForTerseUpdate(); 3640 m_parentGroup.ScheduleGroupForTerseUpdate();
3628 //m_parentGroup.ScheduleGroupForFullUpdate(); 3641 //m_parentGroup.ScheduleGroupForFullUpdate();
3629 } 3642 }
3630 3643 public void StoreUndoState(UndoType type)
3631 public void StoreUndoState()
3632 { 3644 {
3633 if (!Undoing) 3645 if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
3634 { 3646 {
3635 if (!IgnoreUndoUpdate) 3647 if (!IgnoreUndoUpdate)
3636 { 3648 {
@@ -3641,17 +3653,25 @@ namespace OpenSim.Region.Framework.Scenes
3641 if (m_undo.Count > 0) 3653 if (m_undo.Count > 0)
3642 { 3654 {
3643 UndoState last = m_undo.Peek(); 3655 UndoState last = m_undo.Peek();
3644 if (last != null) 3656
3645 {
3646 if (last.Compare(this))
3647 return;
3648 }
3649 } 3657 }
3650 3658
3651 if (m_parentGroup.GetSceneMaxUndo() > 0) 3659 if (m_parentGroup.GetSceneMaxUndo() > 0)
3652 { 3660 {
3653 UndoState nUndo = new UndoState(this); 3661 UndoState lastUndo = m_undo.Peek();
3654 3662
3663 UndoState nUndo = new UndoState(this, type);
3664
3665 if (lastUndo != null)
3666 {
3667 TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
3668 if (ts.TotalMilliseconds < 500)
3669 {
3670 //Delete the last entry since it was less than 500 milliseconds ago
3671 nUndo.Merge(lastUndo);
3672 m_undo.Pop();
3673 }
3674 }
3655 m_undo.Push(nUndo); 3675 m_undo.Push(nUndo);
3656 } 3676 }
3657 3677
@@ -4128,11 +4148,13 @@ namespace OpenSim.Region.Framework.Scenes
4128 if (m_undo.Count > 0) 4148 if (m_undo.Count > 0)
4129 { 4149 {
4130 UndoState nUndo = null; 4150 UndoState nUndo = null;
4151 UndoState goback = m_undo.Pop();
4131 if (m_parentGroup.GetSceneMaxUndo() > 0) 4152 if (m_parentGroup.GetSceneMaxUndo() > 0)
4132 { 4153 {
4133 nUndo = new UndoState(this); 4154 nUndo = new UndoState(this, goback.Type);
4134 } 4155 }
4135 UndoState goback = m_undo.Pop(); 4156
4157
4136 if (goback != null) 4158 if (goback != null)
4137 { 4159 {
4138 goback.PlaybackState(this); 4160 goback.PlaybackState(this);
@@ -4147,13 +4169,13 @@ namespace OpenSim.Region.Framework.Scenes
4147 { 4169 {
4148 lock (m_redo) 4170 lock (m_redo)
4149 { 4171 {
4172 UndoState gofwd = m_redo.Pop();
4150 if (m_parentGroup.GetSceneMaxUndo() > 0) 4173 if (m_parentGroup.GetSceneMaxUndo() > 0)
4151 { 4174 {
4152 UndoState nUndo = new UndoState(this); 4175 UndoState nUndo = new UndoState(this, gofwd.Type);
4153 4176
4154 m_undo.Push(nUndo); 4177 m_undo.Push(nUndo);
4155 } 4178 }
4156 UndoState gofwd = m_redo.Pop();
4157 if (gofwd != null) 4179 if (gofwd != null)
4158 gofwd.PlayfwdState(this); 4180 gofwd.PlayfwdState(this);
4159 } 4181 }
@@ -4602,8 +4624,9 @@ namespace OpenSim.Region.Framework.Scenes
4602 { 4624 {
4603 m_shape.TextureEntry = textureEntry; 4625 m_shape.TextureEntry = textureEntry;
4604 TriggerScriptChangedEvent(Changed.TEXTURE); 4626 TriggerScriptChangedEvent(Changed.TEXTURE);
4605 4627 m_updateFlag = 1;
4606 ParentGroup.HasGroupChanged = true; 4628 ParentGroup.HasGroupChanged = true;
4629
4607 //This is madness.. 4630 //This is madness..
4608 //ParentGroup.ScheduleGroupForFullUpdate(); 4631 //ParentGroup.ScheduleGroupForFullUpdate();
4609 //This is sparta 4632 //This is sparta
@@ -4836,5 +4859,17 @@ namespace OpenSim.Region.Framework.Scenes
4836 Color color = Color; 4859 Color color = Color;
4837 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); 4860 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
4838 } 4861 }
4862
4863 public void ResetOwnerChangeFlag()
4864 {
4865 List<UUID> inv = Inventory.GetInventoryList();
4866
4867 foreach (UUID itemID in inv)
4868 {
4869 TaskInventoryItem item = Inventory.GetInventoryItem(itemID);
4870 item.OwnerChanged = false;
4871 Inventory.UpdateInventoryItem(item, false, false);
4872 }
4873 }
4839 } 4874 }
4840} 4875}