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.cs296
1 files changed, 168 insertions, 128 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6a92378..d4f3dfe 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -61,7 +61,8 @@ namespace OpenSim.Region.Framework.Scenes
61 TELEPORT = 512, 61 TELEPORT = 512,
62 REGION_RESTART = 1024, 62 REGION_RESTART = 1024,
63 MEDIA = 2048, 63 MEDIA = 2048,
64 ANIMATION = 16384 64 ANIMATION = 16384,
65 POSITION = 32768
65 } 66 }
66 67
67 // I don't really know where to put this except here. 68 // I don't really know where to put this except here.
@@ -145,10 +146,10 @@ namespace OpenSim.Region.Framework.Scenes
145 public Vector3 StatusSandboxPos; 146 public Vector3 StatusSandboxPos;
146 147
147 // TODO: This needs to be persisted in next XML version update! 148 // TODO: This needs to be persisted in next XML version update!
148 149 [XmlIgnore]
149 public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; 150 public int[] PayPrice = {-2,-2,-2,-2,-2};
150 151
151 152 [XmlIgnore]
152 public PhysicsActor PhysActor 153 public PhysicsActor PhysActor
153 { 154 {
154 get { return m_physActor; } 155 get { return m_physActor; }
@@ -190,7 +191,15 @@ namespace OpenSim.Region.Framework.Scenes
190 191
191 public UUID FromFolderID; 192 public UUID FromFolderID;
192 193
193 194 // The following two are to hold the attachment data
195 // while an object is inworld
196 [XmlIgnore]
197 public byte AttachPoint = 0;
198
199 [XmlIgnore]
200 public Vector3 AttachOffset = Vector3.Zero;
201
202 [XmlIgnore]
194 public int STATUS_ROTATE_X; 203 public int STATUS_ROTATE_X;
195 204
196 205
@@ -285,6 +294,7 @@ namespace OpenSim.Region.Framework.Scenes
285 private Quaternion m_sitTargetOrientation = Quaternion.Identity; 294 private Quaternion m_sitTargetOrientation = Quaternion.Identity;
286 private Vector3 m_sitTargetPosition; 295 private Vector3 m_sitTargetPosition;
287 private string m_sitAnimation = "SIT"; 296 private string m_sitAnimation = "SIT";
297 private bool m_occupied; // KF if any av is sitting on this prim
288 private string m_text = String.Empty; 298 private string m_text = String.Empty;
289 private string m_touchName = String.Empty; 299 private string m_touchName = String.Empty;
290 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); 300 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
@@ -374,7 +384,7 @@ namespace OpenSim.Region.Framework.Scenes
374 UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, 384 UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
375 Quaternion rotationOffset, Vector3 offsetPosition) 385 Quaternion rotationOffset, Vector3 offsetPosition)
376 { 386 {
377 m_name = "Primitive"; 387 m_name = "Object";
378 388
379 Rezzed = DateTime.UtcNow; 389 Rezzed = DateTime.UtcNow;
380 _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); 390 _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
@@ -430,7 +440,7 @@ namespace OpenSim.Region.Framework.Scenes
430 private uint _ownerMask = (uint)PermissionMask.All; 440 private uint _ownerMask = (uint)PermissionMask.All;
431 private uint _groupMask = (uint)PermissionMask.None; 441 private uint _groupMask = (uint)PermissionMask.None;
432 private uint _everyoneMask = (uint)PermissionMask.None; 442 private uint _everyoneMask = (uint)PermissionMask.None;
433 private uint _nextOwnerMask = (uint)PermissionMask.All; 443 private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
434 private PrimFlags _flags = PrimFlags.None; 444 private PrimFlags _flags = PrimFlags.None;
435 private DateTime m_expires; 445 private DateTime m_expires;
436 private DateTime m_rezzed; 446 private DateTime m_rezzed;
@@ -529,12 +539,16 @@ namespace OpenSim.Region.Framework.Scenes
529 } 539 }
530 540
531 /// <value> 541 /// <value>
532 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes 542 /// Get the inventory list
533 /// </value> 543 /// </value>
534 public TaskInventoryDictionary TaskInventory 544 public TaskInventoryDictionary TaskInventory
535 { 545 {
536 get { return m_inventory.Items; } 546 get {
537 set { m_inventory.Items = value; } 547 return m_inventory.Items;
548 }
549 set {
550 m_inventory.Items = value;
551 }
538 } 552 }
539 553
540 /// <summary> 554 /// <summary>
@@ -674,14 +688,12 @@ namespace OpenSim.Region.Framework.Scenes
674 set { m_LoopSoundSlavePrims = value; } 688 set { m_LoopSoundSlavePrims = value; }
675 } 689 }
676 690
677
678 public Byte[] TextureAnimation 691 public Byte[] TextureAnimation
679 { 692 {
680 get { return m_TextureAnimation; } 693 get { return m_TextureAnimation; }
681 set { m_TextureAnimation = value; } 694 set { m_TextureAnimation = value; }
682 } 695 }
683 696
684
685 public Byte[] ParticleSystem 697 public Byte[] ParticleSystem
686 { 698 {
687 get { return m_particleSystem; } 699 get { return m_particleSystem; }
@@ -718,9 +730,11 @@ namespace OpenSim.Region.Framework.Scenes
718 { 730 {
719 // If this is a linkset, we don't want the physics engine mucking up our group position here. 731 // If this is a linkset, we don't want the physics engine mucking up our group position here.
720 PhysicsActor actor = PhysActor; 732 PhysicsActor actor = PhysActor;
721 if (actor != null && _parentID == 0) 733 if (_parentID == 0)
722 { 734 {
723 m_groupPosition = actor.Position; 735 if (actor != null)
736 m_groupPosition = actor.Position;
737 return m_groupPosition;
724 } 738 }
725 739
726 if (IsAttachment) 740 if (IsAttachment)
@@ -730,12 +744,14 @@ namespace OpenSim.Region.Framework.Scenes
730 return sp.AbsolutePosition; 744 return sp.AbsolutePosition;
731 } 745 }
732 746
747 // use root prim's group position. Physics may have updated it
748 if (ParentGroup.RootPart != this)
749 m_groupPosition = ParentGroup.RootPart.GroupPosition;
733 return m_groupPosition; 750 return m_groupPosition;
734 } 751 }
735 set 752 set
736 { 753 {
737 m_groupPosition = value; 754 m_groupPosition = value;
738
739 PhysicsActor actor = PhysActor; 755 PhysicsActor actor = PhysActor;
740 if (actor != null) 756 if (actor != null)
741 { 757 {
@@ -755,25 +771,13 @@ namespace OpenSim.Region.Framework.Scenes
755 771
756 // Tell the physics engines that this prim changed. 772 // Tell the physics engines that this prim changed.
757 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 773 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
774
758 } 775 }
759 catch (Exception e) 776 catch (Exception e)
760 { 777 {
761 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); 778 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message);
762 } 779 }
763 } 780 }
764
765 // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too
766 if (m_sitTargetAvatar != UUID.Zero)
767 {
768 if (m_parentGroup != null) // TODO can there be a SOP without a SOG?
769 {
770 ScenePresence avatar;
771 if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
772 {
773 avatar.ParentPosition = GetWorldPosition();
774 }
775 }
776 }
777 } 781 }
778 } 782 }
779 783
@@ -782,7 +786,8 @@ namespace OpenSim.Region.Framework.Scenes
782 get { return m_offsetPosition; } 786 get { return m_offsetPosition; }
783 set 787 set
784 { 788 {
785 StoreUndoState(); 789 Vector3 oldpos = m_offsetPosition;
790 StoreUndoState(UndoType.STATE_PRIM_POSITION);
786 m_offsetPosition = value; 791 m_offsetPosition = value;
787 792
788 if (ParentGroup != null && !ParentGroup.IsDeleted) 793 if (ParentGroup != null && !ParentGroup.IsDeleted)
@@ -796,7 +801,22 @@ namespace OpenSim.Region.Framework.Scenes
796 // Tell the physics engines that this prim changed. 801 // Tell the physics engines that this prim changed.
797 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 802 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
798 } 803 }
804
805 if (!m_parentGroup.m_dupeInProgress)
806 {
807 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars();
808 foreach (ScenePresence av in avs)
809 {
810 if (av.LinkedPrim == m_uuid)
811 {
812 Vector3 offset = (m_offsetPosition - oldpos);
813 av.OffsetPosition += offset;
814 av.SendAvatarDataToAllAgents();
815 }
816 }
817 }
799 } 818 }
819 TriggerScriptChangedEvent(Changed.POSITION);
800 } 820 }
801 } 821 }
802 822
@@ -838,7 +858,7 @@ namespace OpenSim.Region.Framework.Scenes
838 858
839 set 859 set
840 { 860 {
841 StoreUndoState(); 861 StoreUndoState(UndoType.STATE_PRIM_ROTATION);
842 m_rotationOffset = value; 862 m_rotationOffset = value;
843 863
844 PhysicsActor actor = PhysActor; 864 PhysicsActor actor = PhysActor;
@@ -922,7 +942,16 @@ namespace OpenSim.Region.Framework.Scenes
922 /// <summary></summary> 942 /// <summary></summary>
923 public Vector3 Acceleration 943 public Vector3 Acceleration
924 { 944 {
925 get { return m_acceleration; } 945 get
946 {
947 PhysicsActor actor = PhysActor;
948 if (actor != null)
949 {
950 m_acceleration = actor.Acceleration;
951 }
952 return m_acceleration;
953 }
954
926 set { m_acceleration = value; } 955 set { m_acceleration = value; }
927 } 956 }
928 957
@@ -1013,7 +1042,7 @@ namespace OpenSim.Region.Framework.Scenes
1013 get { return m_shape.Scale; } 1042 get { return m_shape.Scale; }
1014 set 1043 set
1015 { 1044 {
1016 StoreUndoState(); 1045 StoreUndoState(UndoType.STATE_PRIM_SCALE);
1017 if (m_shape != null) 1046 if (m_shape != null)
1018 { 1047 {
1019 m_shape.Scale = value; 1048 m_shape.Scale = value;
@@ -1079,11 +1108,10 @@ namespace OpenSim.Region.Framework.Scenes
1079 1108
1080 public Vector3 AbsolutePosition 1109 public Vector3 AbsolutePosition
1081 { 1110 {
1082 get { 1111 get
1083 if (IsAttachment) 1112 {
1084 return GroupPosition; 1113 return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset);
1085 1114 }
1086 return m_offsetPosition + m_groupPosition; }
1087 } 1115 }
1088 1116
1089 public SceneObjectGroup ParentGroup 1117 public SceneObjectGroup ParentGroup
@@ -1242,6 +1270,13 @@ namespace OpenSim.Region.Framework.Scenes
1242 _flags = value; 1270 _flags = value;
1243 } 1271 }
1244 } 1272 }
1273
1274 [XmlIgnore]
1275 public bool IsOccupied // KF If an av is sittingon this prim
1276 {
1277 get { return m_occupied; }
1278 set { m_occupied = value; }
1279 }
1245 1280
1246 1281
1247 public UUID SitTargetAvatar 1282 public UUID SitTargetAvatar
@@ -1317,14 +1352,6 @@ namespace OpenSim.Region.Framework.Scenes
1317 } 1352 }
1318 } 1353 }
1319 1354
1320 /// <summary>
1321 /// Clear all pending updates of parts to clients
1322 /// </summary>
1323 private void ClearUpdateSchedule()
1324 {
1325 m_updateFlag = 0;
1326 }
1327
1328 private void SendObjectPropertiesToClient(UUID AgentID) 1355 private void SendObjectPropertiesToClient(UUID AgentID)
1329 { 1356 {
1330 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1357 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
@@ -1575,14 +1602,22 @@ namespace OpenSim.Region.Framework.Scenes
1575 // or flexible 1602 // or flexible
1576 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) 1603 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
1577 { 1604 {
1578 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 1605 try
1579 string.Format("{0}/{1}", Name, UUID), 1606 {
1580 Shape, 1607 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1581 AbsolutePosition, 1608 string.Format("{0}/{1}", Name, UUID),
1582 Scale, 1609 Shape,
1583 RotationOffset, 1610 AbsolutePosition,
1584 RigidBody); 1611 Scale,
1585 1612 RotationOffset,
1613 RigidBody);
1614 PhysActor.SetMaterial(Material);
1615 }
1616 catch
1617 {
1618 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
1619 PhysActor = null;
1620 }
1586 // Basic Physics returns null.. joy joy joy. 1621 // Basic Physics returns null.. joy joy joy.
1587 if (PhysActor != null) 1622 if (PhysActor != null)
1588 { 1623 {
@@ -1610,7 +1645,7 @@ namespace OpenSim.Region.Framework.Scenes
1610 { 1645 {
1611 m_redo.Clear(); 1646 m_redo.Clear();
1612 } 1647 }
1613 StoreUndoState(); 1648 StoreUndoState(UndoType.STATE_ALL);
1614 } 1649 }
1615 1650
1616 public byte ConvertScriptUintToByte(uint indata) 1651 public byte ConvertScriptUintToByte(uint indata)
@@ -1679,6 +1714,9 @@ namespace OpenSim.Region.Framework.Scenes
1679 1714
1680 // Move afterwards ResetIDs as it clears the localID 1715 // Move afterwards ResetIDs as it clears the localID
1681 dupe.LocalId = localID; 1716 dupe.LocalId = localID;
1717 if(dupe.PhysActor != null)
1718 dupe.PhysActor.LocalID = localID;
1719
1682 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. 1720 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
1683 dupe._lastOwnerID = OwnerID; 1721 dupe._lastOwnerID = OwnerID;
1684 1722
@@ -1722,7 +1760,7 @@ namespace OpenSim.Region.Framework.Scenes
1722 PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); 1760 PrimitiveBaseShape shape = PrimitiveBaseShape.Create();
1723 part.Shape = shape; 1761 part.Shape = shape;
1724 1762
1725 part.Name = "Primitive"; 1763 part.Name = "Object";
1726 part._ownerID = UUID.Random(); 1764 part._ownerID = UUID.Random();
1727 1765
1728 return part; 1766 return part;
@@ -2083,12 +2121,17 @@ namespace OpenSim.Region.Framework.Scenes
2083 public Vector3 GetWorldPosition() 2121 public Vector3 GetWorldPosition()
2084 { 2122 {
2085 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 2123 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
2086
2087 Vector3 axPos = OffsetPosition; 2124 Vector3 axPos = OffsetPosition;
2088
2089 axPos *= parentRot; 2125 axPos *= parentRot;
2090 Vector3 translationOffsetPosition = axPos; 2126 Vector3 translationOffsetPosition = axPos;
2091 return GroupPosition + translationOffsetPosition; 2127 if(_parentID == 0)
2128 {
2129 return GroupPosition;
2130 }
2131 else
2132 {
2133 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
2134 }
2092 } 2135 }
2093 2136
2094 /// <summary> 2137 /// <summary>
@@ -2099,7 +2142,7 @@ namespace OpenSim.Region.Framework.Scenes
2099 { 2142 {
2100 Quaternion newRot; 2143 Quaternion newRot;
2101 2144
2102 if (this.LinkNum == 0) 2145 if (this.LinkNum < 2) //KF Single or root prim
2103 { 2146 {
2104 newRot = RotationOffset; 2147 newRot = RotationOffset;
2105 } 2148 }
@@ -2745,17 +2788,18 @@ namespace OpenSim.Region.Framework.Scenes
2745 //Trys to fetch sound id from prim's inventory. 2788 //Trys to fetch sound id from prim's inventory.
2746 //Prim's inventory doesn't support non script items yet 2789 //Prim's inventory doesn't support non script items yet
2747 2790
2748 lock (TaskInventory) 2791 TaskInventory.LockItemsForRead(true);
2792
2793 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2749 { 2794 {
2750 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2795 if (item.Value.Name == sound)
2751 { 2796 {
2752 if (item.Value.Name == sound) 2797 soundID = item.Value.ItemID;
2753 { 2798 break;
2754 soundID = item.Value.ItemID;
2755 break;
2756 }
2757 } 2799 }
2758 } 2800 }
2801
2802 TaskInventory.LockItemsForRead(false);
2759 } 2803 }
2760 2804
2761 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2805 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -2815,7 +2859,7 @@ namespace OpenSim.Region.Framework.Scenes
2815 /// <param name="scale"></param> 2859 /// <param name="scale"></param>
2816 public void Resize(Vector3 scale) 2860 public void Resize(Vector3 scale)
2817 { 2861 {
2818 StoreUndoState(); 2862 StoreUndoState(UndoType.STATE_PRIM_SCALE);
2819 m_shape.Scale = scale; 2863 m_shape.Scale = scale;
2820 2864
2821 ParentGroup.HasGroupChanged = true; 2865 ParentGroup.HasGroupChanged = true;
@@ -2824,38 +2868,7 @@ namespace OpenSim.Region.Framework.Scenes
2824 2868
2825 public void RotLookAt(Quaternion target, float strength, float damping) 2869 public void RotLookAt(Quaternion target, float strength, float damping)
2826 { 2870 {
2827 rotLookAt(target, strength, damping); 2871 m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
2828 }
2829
2830 public void rotLookAt(Quaternion target, float strength, float damping)
2831 {
2832 if (IsAttachment)
2833 {
2834 /*
2835 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2836 if (avatar != null)
2837 {
2838 Rotate the Av?
2839 } */
2840 }
2841 else
2842 {
2843 APIDDamp = damping;
2844 APIDStrength = strength;
2845 APIDTarget = target;
2846 }
2847 }
2848
2849 public void startLookAt(Quaternion rot, float damp, float strength)
2850 {
2851 APIDDamp = damp;
2852 APIDStrength = strength;
2853 APIDTarget = rot;
2854 }
2855
2856 public void stopLookAt()
2857 {
2858 APIDTarget = Quaternion.Identity;
2859 } 2872 }
2860 2873
2861 /// <summary> 2874 /// <summary>
@@ -2867,7 +2880,10 @@ namespace OpenSim.Region.Framework.Scenes
2867 2880
2868 if (m_parentGroup != null) 2881 if (m_parentGroup != null)
2869 { 2882 {
2870 m_parentGroup.QueueForUpdateCheck(); 2883 if (!m_parentGroup.areUpdatesSuspended)
2884 {
2885 m_parentGroup.QueueForUpdateCheck();
2886 }
2871 } 2887 }
2872 2888
2873 int timeNow = Util.UnixTimeSinceEpoch(); 2889 int timeNow = Util.UnixTimeSinceEpoch();
@@ -3084,8 +3100,8 @@ namespace OpenSim.Region.Framework.Scenes
3084 { 3100 {
3085 const float ROTATION_TOLERANCE = 0.01f; 3101 const float ROTATION_TOLERANCE = 0.01f;
3086 const float VELOCITY_TOLERANCE = 0.001f; 3102 const float VELOCITY_TOLERANCE = 0.001f;
3087 const float POSITION_TOLERANCE = 0.05f; 3103 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
3088 const int TIME_MS_TOLERANCE = 3000; 3104 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
3089 3105
3090 if (m_updateFlag == 1) 3106 if (m_updateFlag == 1)
3091 { 3107 {
@@ -3099,7 +3115,7 @@ namespace OpenSim.Region.Framework.Scenes
3099 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 3115 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
3100 { 3116 {
3101 AddTerseUpdateToAllAvatars(); 3117 AddTerseUpdateToAllAvatars();
3102 ClearUpdateSchedule(); 3118
3103 3119
3104 // This causes the Scene to 'poll' physical objects every couple of frames 3120 // This causes the Scene to 'poll' physical objects every couple of frames
3105 // bad, so it's been replaced by an event driven method. 3121 // bad, so it's been replaced by an event driven method.
@@ -3117,16 +3133,18 @@ namespace OpenSim.Region.Framework.Scenes
3117 m_lastAngularVelocity = AngularVelocity; 3133 m_lastAngularVelocity = AngularVelocity;
3118 m_lastTerseSent = Environment.TickCount; 3134 m_lastTerseSent = Environment.TickCount;
3119 } 3135 }
3136 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
3137 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
3120 } 3138 }
3121 else 3139 else
3122 { 3140 {
3123 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 3141 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
3124 { 3142 {
3125 AddFullUpdateToAllAvatars(); 3143 AddFullUpdateToAllAvatars();
3126 ClearUpdateSchedule(); 3144 m_updateFlag = 0; //Same here
3127 } 3145 }
3128 } 3146 }
3129 ClearUpdateSchedule(); 3147 m_updateFlag = 0;
3130 } 3148 }
3131 3149
3132 /// <summary> 3150 /// <summary>
@@ -3154,17 +3172,16 @@ namespace OpenSim.Region.Framework.Scenes
3154 if (!UUID.TryParse(sound, out soundID)) 3172 if (!UUID.TryParse(sound, out soundID))
3155 { 3173 {
3156 // search sound file from inventory 3174 // search sound file from inventory
3157 lock (TaskInventory) 3175 TaskInventory.LockItemsForRead(true);
3176 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3158 { 3177 {
3159 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3178 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3160 { 3179 {
3161 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3180 soundID = item.Value.ItemID;
3162 { 3181 break;
3163 soundID = item.Value.ItemID;
3164 break;
3165 }
3166 } 3182 }
3167 } 3183 }
3184 TaskInventory.LockItemsForRead(false);
3168 } 3185 }
3169 3186
3170 if (soundID == UUID.Zero) 3187 if (soundID == UUID.Zero)
@@ -3594,7 +3611,7 @@ namespace OpenSim.Region.Framework.Scenes
3594 3611
3595 public void StopLookAt() 3612 public void StopLookAt()
3596 { 3613 {
3597 m_parentGroup.stopLookAt(); 3614 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3598 3615
3599 m_parentGroup.ScheduleGroupForTerseUpdate(); 3616 m_parentGroup.ScheduleGroupForTerseUpdate();
3600 } 3617 }
@@ -3621,10 +3638,9 @@ namespace OpenSim.Region.Framework.Scenes
3621 m_parentGroup.ScheduleGroupForTerseUpdate(); 3638 m_parentGroup.ScheduleGroupForTerseUpdate();
3622 //m_parentGroup.ScheduleGroupForFullUpdate(); 3639 //m_parentGroup.ScheduleGroupForFullUpdate();
3623 } 3640 }
3624 3641 public void StoreUndoState(UndoType type)
3625 public void StoreUndoState()
3626 { 3642 {
3627 if (!Undoing) 3643 if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
3628 { 3644 {
3629 if (!IgnoreUndoUpdate) 3645 if (!IgnoreUndoUpdate)
3630 { 3646 {
@@ -3635,17 +3651,25 @@ namespace OpenSim.Region.Framework.Scenes
3635 if (m_undo.Count > 0) 3651 if (m_undo.Count > 0)
3636 { 3652 {
3637 UndoState last = m_undo.Peek(); 3653 UndoState last = m_undo.Peek();
3638 if (last != null) 3654
3639 {
3640 if (last.Compare(this))
3641 return;
3642 }
3643 } 3655 }
3644 3656
3645 if (m_parentGroup.GetSceneMaxUndo() > 0) 3657 if (m_parentGroup.GetSceneMaxUndo() > 0)
3646 { 3658 {
3647 UndoState nUndo = new UndoState(this); 3659 UndoState lastUndo = m_undo.Peek();
3648 3660
3661 UndoState nUndo = new UndoState(this, type);
3662
3663 if (lastUndo != null)
3664 {
3665 TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
3666 if (ts.TotalMilliseconds < 500)
3667 {
3668 //Delete the last entry since it was less than 500 milliseconds ago
3669 nUndo.Merge(lastUndo);
3670 m_undo.Pop();
3671 }
3672 }
3649 m_undo.Push(nUndo); 3673 m_undo.Push(nUndo);
3650 } 3674 }
3651 3675
@@ -4122,11 +4146,13 @@ namespace OpenSim.Region.Framework.Scenes
4122 if (m_undo.Count > 0) 4146 if (m_undo.Count > 0)
4123 { 4147 {
4124 UndoState nUndo = null; 4148 UndoState nUndo = null;
4149 UndoState goback = m_undo.Pop();
4125 if (m_parentGroup.GetSceneMaxUndo() > 0) 4150 if (m_parentGroup.GetSceneMaxUndo() > 0)
4126 { 4151 {
4127 nUndo = new UndoState(this); 4152 nUndo = new UndoState(this, goback.Type);
4128 } 4153 }
4129 UndoState goback = m_undo.Pop(); 4154
4155
4130 if (goback != null) 4156 if (goback != null)
4131 { 4157 {
4132 goback.PlaybackState(this); 4158 goback.PlaybackState(this);
@@ -4141,13 +4167,13 @@ namespace OpenSim.Region.Framework.Scenes
4141 { 4167 {
4142 lock (m_redo) 4168 lock (m_redo)
4143 { 4169 {
4170 UndoState gofwd = m_redo.Pop();
4144 if (m_parentGroup.GetSceneMaxUndo() > 0) 4171 if (m_parentGroup.GetSceneMaxUndo() > 0)
4145 { 4172 {
4146 UndoState nUndo = new UndoState(this); 4173 UndoState nUndo = new UndoState(this, gofwd.Type);
4147 4174
4148 m_undo.Push(nUndo); 4175 m_undo.Push(nUndo);
4149 } 4176 }
4150 UndoState gofwd = m_redo.Pop();
4151 if (gofwd != null) 4177 if (gofwd != null)
4152 gofwd.PlayfwdState(this); 4178 gofwd.PlayfwdState(this);
4153 } 4179 }
@@ -4411,6 +4437,7 @@ namespace OpenSim.Region.Framework.Scenes
4411 Scale, 4437 Scale,
4412 RotationOffset, 4438 RotationOffset,
4413 UsePhysics); 4439 UsePhysics);
4440 PhysActor.SetMaterial(Material);
4414 4441
4415 pa = PhysActor; 4442 pa = PhysActor;
4416 if (pa != null) 4443 if (pa != null)
@@ -4596,8 +4623,9 @@ namespace OpenSim.Region.Framework.Scenes
4596 { 4623 {
4597 m_shape.TextureEntry = textureEntry; 4624 m_shape.TextureEntry = textureEntry;
4598 TriggerScriptChangedEvent(Changed.TEXTURE); 4625 TriggerScriptChangedEvent(Changed.TEXTURE);
4599 4626 m_updateFlag = 1;
4600 ParentGroup.HasGroupChanged = true; 4627 ParentGroup.HasGroupChanged = true;
4628
4601 //This is madness.. 4629 //This is madness..
4602 //ParentGroup.ScheduleGroupForFullUpdate(); 4630 //ParentGroup.ScheduleGroupForFullUpdate();
4603 //This is sparta 4631 //This is sparta
@@ -4830,5 +4858,17 @@ namespace OpenSim.Region.Framework.Scenes
4830 Color color = Color; 4858 Color color = Color;
4831 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); 4859 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
4832 } 4860 }
4861
4862 public void ResetOwnerChangeFlag()
4863 {
4864 List<UUID> inv = Inventory.GetInventoryList();
4865
4866 foreach (UUID itemID in inv)
4867 {
4868 TaskInventoryItem item = Inventory.GetInventoryItem(itemID);
4869 item.OwnerChanged = false;
4870 Inventory.UpdateInventoryItem(item, false, false);
4871 }
4872 }
4833 } 4873 }
4834} 4874}