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 4fcd8f5..6496a25 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;
@@ -2082,12 +2120,17 @@ namespace OpenSim.Region.Framework.Scenes
2082 public Vector3 GetWorldPosition() 2120 public Vector3 GetWorldPosition()
2083 { 2121 {
2084 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 2122 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
2085
2086 Vector3 axPos = OffsetPosition; 2123 Vector3 axPos = OffsetPosition;
2087
2088 axPos *= parentRot; 2124 axPos *= parentRot;
2089 Vector3 translationOffsetPosition = axPos; 2125 Vector3 translationOffsetPosition = axPos;
2090 return GroupPosition + translationOffsetPosition; 2126 if(_parentID == 0)
2127 {
2128 return GroupPosition;
2129 }
2130 else
2131 {
2132 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
2133 }
2091 } 2134 }
2092 2135
2093 /// <summary> 2136 /// <summary>
@@ -2098,7 +2141,7 @@ namespace OpenSim.Region.Framework.Scenes
2098 { 2141 {
2099 Quaternion newRot; 2142 Quaternion newRot;
2100 2143
2101 if (this.LinkNum == 0) 2144 if (this.LinkNum < 2) //KF Single or root prim
2102 { 2145 {
2103 newRot = RotationOffset; 2146 newRot = RotationOffset;
2104 } 2147 }
@@ -2744,17 +2787,18 @@ namespace OpenSim.Region.Framework.Scenes
2744 //Trys to fetch sound id from prim's inventory. 2787 //Trys to fetch sound id from prim's inventory.
2745 //Prim's inventory doesn't support non script items yet 2788 //Prim's inventory doesn't support non script items yet
2746 2789
2747 lock (TaskInventory) 2790 TaskInventory.LockItemsForRead(true);
2791
2792 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2748 { 2793 {
2749 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2794 if (item.Value.Name == sound)
2750 { 2795 {
2751 if (item.Value.Name == sound) 2796 soundID = item.Value.ItemID;
2752 { 2797 break;
2753 soundID = item.Value.ItemID;
2754 break;
2755 }
2756 } 2798 }
2757 } 2799 }
2800
2801 TaskInventory.LockItemsForRead(false);
2758 } 2802 }
2759 2803
2760 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2804 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -2814,7 +2858,7 @@ namespace OpenSim.Region.Framework.Scenes
2814 /// <param name="scale"></param> 2858 /// <param name="scale"></param>
2815 public void Resize(Vector3 scale) 2859 public void Resize(Vector3 scale)
2816 { 2860 {
2817 StoreUndoState(); 2861 StoreUndoState(UndoType.STATE_PRIM_SCALE);
2818 m_shape.Scale = scale; 2862 m_shape.Scale = scale;
2819 2863
2820 ParentGroup.HasGroupChanged = true; 2864 ParentGroup.HasGroupChanged = true;
@@ -2823,38 +2867,7 @@ namespace OpenSim.Region.Framework.Scenes
2823 2867
2824 public void RotLookAt(Quaternion target, float strength, float damping) 2868 public void RotLookAt(Quaternion target, float strength, float damping)
2825 { 2869 {
2826 rotLookAt(target, strength, damping); 2870 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 } 2871 }
2859 2872
2860 /// <summary> 2873 /// <summary>
@@ -2866,7 +2879,10 @@ namespace OpenSim.Region.Framework.Scenes
2866 2879
2867 if (m_parentGroup != null) 2880 if (m_parentGroup != null)
2868 { 2881 {
2869 m_parentGroup.QueueForUpdateCheck(); 2882 if (!m_parentGroup.areUpdatesSuspended)
2883 {
2884 m_parentGroup.QueueForUpdateCheck();
2885 }
2870 } 2886 }
2871 2887
2872 int timeNow = Util.UnixTimeSinceEpoch(); 2888 int timeNow = Util.UnixTimeSinceEpoch();
@@ -3083,8 +3099,8 @@ namespace OpenSim.Region.Framework.Scenes
3083 { 3099 {
3084 const float ROTATION_TOLERANCE = 0.01f; 3100 const float ROTATION_TOLERANCE = 0.01f;
3085 const float VELOCITY_TOLERANCE = 0.001f; 3101 const float VELOCITY_TOLERANCE = 0.001f;
3086 const float POSITION_TOLERANCE = 0.05f; 3102 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
3087 const int TIME_MS_TOLERANCE = 3000; 3103 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
3088 3104
3089 if (m_updateFlag == 1) 3105 if (m_updateFlag == 1)
3090 { 3106 {
@@ -3098,7 +3114,7 @@ namespace OpenSim.Region.Framework.Scenes
3098 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 3114 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
3099 { 3115 {
3100 AddTerseUpdateToAllAvatars(); 3116 AddTerseUpdateToAllAvatars();
3101 ClearUpdateSchedule(); 3117
3102 3118
3103 // This causes the Scene to 'poll' physical objects every couple of frames 3119 // This causes the Scene to 'poll' physical objects every couple of frames
3104 // bad, so it's been replaced by an event driven method. 3120 // bad, so it's been replaced by an event driven method.
@@ -3116,16 +3132,18 @@ namespace OpenSim.Region.Framework.Scenes
3116 m_lastAngularVelocity = AngularVelocity; 3132 m_lastAngularVelocity = AngularVelocity;
3117 m_lastTerseSent = Environment.TickCount; 3133 m_lastTerseSent = Environment.TickCount;
3118 } 3134 }
3135 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
3136 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
3119 } 3137 }
3120 else 3138 else
3121 { 3139 {
3122 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 3140 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
3123 { 3141 {
3124 AddFullUpdateToAllAvatars(); 3142 AddFullUpdateToAllAvatars();
3125 ClearUpdateSchedule(); 3143 m_updateFlag = 0; //Same here
3126 } 3144 }
3127 } 3145 }
3128 ClearUpdateSchedule(); 3146 m_updateFlag = 0;
3129 } 3147 }
3130 3148
3131 /// <summary> 3149 /// <summary>
@@ -3153,17 +3171,16 @@ namespace OpenSim.Region.Framework.Scenes
3153 if (!UUID.TryParse(sound, out soundID)) 3171 if (!UUID.TryParse(sound, out soundID))
3154 { 3172 {
3155 // search sound file from inventory 3173 // search sound file from inventory
3156 lock (TaskInventory) 3174 TaskInventory.LockItemsForRead(true);
3175 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3157 { 3176 {
3158 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3177 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3159 { 3178 {
3160 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3179 soundID = item.Value.ItemID;
3161 { 3180 break;
3162 soundID = item.Value.ItemID;
3163 break;
3164 }
3165 } 3181 }
3166 } 3182 }
3183 TaskInventory.LockItemsForRead(false);
3167 } 3184 }
3168 3185
3169 if (soundID == UUID.Zero) 3186 if (soundID == UUID.Zero)
@@ -3593,7 +3610,7 @@ namespace OpenSim.Region.Framework.Scenes
3593 3610
3594 public void StopLookAt() 3611 public void StopLookAt()
3595 { 3612 {
3596 m_parentGroup.stopLookAt(); 3613 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3597 3614
3598 m_parentGroup.ScheduleGroupForTerseUpdate(); 3615 m_parentGroup.ScheduleGroupForTerseUpdate();
3599 } 3616 }
@@ -3620,10 +3637,9 @@ namespace OpenSim.Region.Framework.Scenes
3620 m_parentGroup.ScheduleGroupForTerseUpdate(); 3637 m_parentGroup.ScheduleGroupForTerseUpdate();
3621 //m_parentGroup.ScheduleGroupForFullUpdate(); 3638 //m_parentGroup.ScheduleGroupForFullUpdate();
3622 } 3639 }
3623 3640 public void StoreUndoState(UndoType type)
3624 public void StoreUndoState()
3625 { 3641 {
3626 if (!Undoing) 3642 if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
3627 { 3643 {
3628 if (!IgnoreUndoUpdate) 3644 if (!IgnoreUndoUpdate)
3629 { 3645 {
@@ -3634,17 +3650,25 @@ namespace OpenSim.Region.Framework.Scenes
3634 if (m_undo.Count > 0) 3650 if (m_undo.Count > 0)
3635 { 3651 {
3636 UndoState last = m_undo.Peek(); 3652 UndoState last = m_undo.Peek();
3637 if (last != null) 3653
3638 {
3639 if (last.Compare(this))
3640 return;
3641 }
3642 } 3654 }
3643 3655
3644 if (m_parentGroup.GetSceneMaxUndo() > 0) 3656 if (m_parentGroup.GetSceneMaxUndo() > 0)
3645 { 3657 {
3646 UndoState nUndo = new UndoState(this); 3658 UndoState lastUndo = m_undo.Peek();
3647 3659
3660 UndoState nUndo = new UndoState(this, type);
3661
3662 if (lastUndo != null)
3663 {
3664 TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
3665 if (ts.TotalMilliseconds < 500)
3666 {
3667 //Delete the last entry since it was less than 500 milliseconds ago
3668 nUndo.Merge(lastUndo);
3669 m_undo.Pop();
3670 }
3671 }
3648 m_undo.Push(nUndo); 3672 m_undo.Push(nUndo);
3649 } 3673 }
3650 3674
@@ -4121,11 +4145,13 @@ namespace OpenSim.Region.Framework.Scenes
4121 if (m_undo.Count > 0) 4145 if (m_undo.Count > 0)
4122 { 4146 {
4123 UndoState nUndo = null; 4147 UndoState nUndo = null;
4148 UndoState goback = m_undo.Pop();
4124 if (m_parentGroup.GetSceneMaxUndo() > 0) 4149 if (m_parentGroup.GetSceneMaxUndo() > 0)
4125 { 4150 {
4126 nUndo = new UndoState(this); 4151 nUndo = new UndoState(this, goback.Type);
4127 } 4152 }
4128 UndoState goback = m_undo.Pop(); 4153
4154
4129 if (goback != null) 4155 if (goback != null)
4130 { 4156 {
4131 goback.PlaybackState(this); 4157 goback.PlaybackState(this);
@@ -4140,13 +4166,13 @@ namespace OpenSim.Region.Framework.Scenes
4140 { 4166 {
4141 lock (m_redo) 4167 lock (m_redo)
4142 { 4168 {
4169 UndoState gofwd = m_redo.Pop();
4143 if (m_parentGroup.GetSceneMaxUndo() > 0) 4170 if (m_parentGroup.GetSceneMaxUndo() > 0)
4144 { 4171 {
4145 UndoState nUndo = new UndoState(this); 4172 UndoState nUndo = new UndoState(this, gofwd.Type);
4146 4173
4147 m_undo.Push(nUndo); 4174 m_undo.Push(nUndo);
4148 } 4175 }
4149 UndoState gofwd = m_redo.Pop();
4150 if (gofwd != null) 4176 if (gofwd != null)
4151 gofwd.PlayfwdState(this); 4177 gofwd.PlayfwdState(this);
4152 } 4178 }
@@ -4410,6 +4436,7 @@ namespace OpenSim.Region.Framework.Scenes
4410 Scale, 4436 Scale,
4411 RotationOffset, 4437 RotationOffset,
4412 UsePhysics); 4438 UsePhysics);
4439 PhysActor.SetMaterial(Material);
4413 4440
4414 pa = PhysActor; 4441 pa = PhysActor;
4415 if (pa != null) 4442 if (pa != null)
@@ -4595,8 +4622,9 @@ namespace OpenSim.Region.Framework.Scenes
4595 { 4622 {
4596 m_shape.TextureEntry = textureEntry; 4623 m_shape.TextureEntry = textureEntry;
4597 TriggerScriptChangedEvent(Changed.TEXTURE); 4624 TriggerScriptChangedEvent(Changed.TEXTURE);
4598 4625 m_updateFlag = 1;
4599 ParentGroup.HasGroupChanged = true; 4626 ParentGroup.HasGroupChanged = true;
4627
4600 //This is madness.. 4628 //This is madness..
4601 //ParentGroup.ScheduleGroupForFullUpdate(); 4629 //ParentGroup.ScheduleGroupForFullUpdate();
4602 //This is sparta 4630 //This is sparta
@@ -4829,5 +4857,17 @@ namespace OpenSim.Region.Framework.Scenes
4829 Color color = Color; 4857 Color color = Color;
4830 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); 4858 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
4831 } 4859 }
4860
4861 public void ResetOwnerChangeFlag()
4862 {
4863 List<UUID> inv = Inventory.GetInventoryList();
4864
4865 foreach (UUID itemID in inv)
4866 {
4867 TaskInventoryItem item = Inventory.GetInventoryItem(itemID);
4868 item.OwnerChanged = false;
4869 Inventory.UpdateInventoryItem(item, false, false);
4870 }
4871 }
4832 } 4872 }
4833} 4873}