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.cs309
1 files changed, 174 insertions, 135 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f3879f0..ff1d520 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.
@@ -189,7 +190,15 @@ namespace OpenSim.Region.Framework.Scenes
189 190
190 public UUID FromFolderID; 191 public UUID FromFolderID;
191 192
192 193 // The following two are to hold the attachment data
194 // while an object is inworld
195 [XmlIgnore]
196 public byte AttachPoint = 0;
197
198 [XmlIgnore]
199 public Vector3 AttachOffset = Vector3.Zero;
200
201 [XmlIgnore]
193 public int STATUS_ROTATE_X; 202 public int STATUS_ROTATE_X;
194 203
195 204
@@ -284,6 +293,7 @@ namespace OpenSim.Region.Framework.Scenes
284 private Quaternion m_sitTargetOrientation = Quaternion.Identity; 293 private Quaternion m_sitTargetOrientation = Quaternion.Identity;
285 private Vector3 m_sitTargetPosition; 294 private Vector3 m_sitTargetPosition;
286 private string m_sitAnimation = "SIT"; 295 private string m_sitAnimation = "SIT";
296 private bool m_occupied; // KF if any av is sitting on this prim
287 private string m_text = String.Empty; 297 private string m_text = String.Empty;
288 private string m_touchName = String.Empty; 298 private string m_touchName = String.Empty;
289 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); 299 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
@@ -328,6 +338,7 @@ namespace OpenSim.Region.Framework.Scenes
328 protected Vector3 m_lastAcceleration; 338 protected Vector3 m_lastAcceleration;
329 protected Vector3 m_lastAngularVelocity; 339 protected Vector3 m_lastAngularVelocity;
330 protected int m_lastTerseSent; 340 protected int m_lastTerseSent;
341 protected float m_buoyancy = 0.0f;
331 342
332 /// <summary> 343 /// <summary>
333 /// Stores media texture data 344 /// Stores media texture data
@@ -380,7 +391,7 @@ namespace OpenSim.Region.Framework.Scenes
380 UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, 391 UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition,
381 Quaternion rotationOffset, Vector3 offsetPosition) 392 Quaternion rotationOffset, Vector3 offsetPosition)
382 { 393 {
383 m_name = "Primitive"; 394 m_name = "Object";
384 395
385 Rezzed = DateTime.UtcNow; 396 Rezzed = DateTime.UtcNow;
386 _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); 397 _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed);
@@ -436,7 +447,7 @@ namespace OpenSim.Region.Framework.Scenes
436 private uint _ownerMask = (uint)PermissionMask.All; 447 private uint _ownerMask = (uint)PermissionMask.All;
437 private uint _groupMask = (uint)PermissionMask.None; 448 private uint _groupMask = (uint)PermissionMask.None;
438 private uint _everyoneMask = (uint)PermissionMask.None; 449 private uint _everyoneMask = (uint)PermissionMask.None;
439 private uint _nextOwnerMask = (uint)PermissionMask.All; 450 private uint _nextOwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify | PermissionMask.Transfer);
440 private PrimFlags _flags = PrimFlags.None; 451 private PrimFlags _flags = PrimFlags.None;
441 private DateTime m_expires; 452 private DateTime m_expires;
442 private DateTime m_rezzed; 453 private DateTime m_rezzed;
@@ -535,12 +546,16 @@ namespace OpenSim.Region.Framework.Scenes
535 } 546 }
536 547
537 /// <value> 548 /// <value>
538 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes 549 /// Get the inventory list
539 /// </value> 550 /// </value>
540 public TaskInventoryDictionary TaskInventory 551 public TaskInventoryDictionary TaskInventory
541 { 552 {
542 get { return m_inventory.Items; } 553 get {
543 set { m_inventory.Items = value; } 554 return m_inventory.Items;
555 }
556 set {
557 m_inventory.Items = value;
558 }
544 } 559 }
545 560
546 /// <summary> 561 /// <summary>
@@ -680,14 +695,12 @@ namespace OpenSim.Region.Framework.Scenes
680 set { m_LoopSoundSlavePrims = value; } 695 set { m_LoopSoundSlavePrims = value; }
681 } 696 }
682 697
683
684 public Byte[] TextureAnimation 698 public Byte[] TextureAnimation
685 { 699 {
686 get { return m_TextureAnimation; } 700 get { return m_TextureAnimation; }
687 set { m_TextureAnimation = value; } 701 set { m_TextureAnimation = value; }
688 } 702 }
689 703
690
691 public Byte[] ParticleSystem 704 public Byte[] ParticleSystem
692 { 705 {
693 get { return m_particleSystem; } 706 get { return m_particleSystem; }
@@ -724,9 +737,11 @@ namespace OpenSim.Region.Framework.Scenes
724 { 737 {
725 // If this is a linkset, we don't want the physics engine mucking up our group position here. 738 // If this is a linkset, we don't want the physics engine mucking up our group position here.
726 PhysicsActor actor = PhysActor; 739 PhysicsActor actor = PhysActor;
727 if (actor != null && _parentID == 0) 740 if (_parentID == 0)
728 { 741 {
729 m_groupPosition = actor.Position; 742 if (actor != null)
743 m_groupPosition = actor.Position;
744 return m_groupPosition;
730 } 745 }
731 746
732 if (IsAttachment) 747 if (IsAttachment)
@@ -736,12 +751,14 @@ namespace OpenSim.Region.Framework.Scenes
736 return sp.AbsolutePosition; 751 return sp.AbsolutePosition;
737 } 752 }
738 753
754 // use root prim's group position. Physics may have updated it
755 if (ParentGroup.RootPart != this)
756 m_groupPosition = ParentGroup.RootPart.GroupPosition;
739 return m_groupPosition; 757 return m_groupPosition;
740 } 758 }
741 set 759 set
742 { 760 {
743 m_groupPosition = value; 761 m_groupPosition = value;
744
745 PhysicsActor actor = PhysActor; 762 PhysicsActor actor = PhysActor;
746 if (actor != null) 763 if (actor != null)
747 { 764 {
@@ -761,25 +778,13 @@ namespace OpenSim.Region.Framework.Scenes
761 778
762 // Tell the physics engines that this prim changed. 779 // Tell the physics engines that this prim changed.
763 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 780 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
781
764 } 782 }
765 catch (Exception e) 783 catch (Exception e)
766 { 784 {
767 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); 785 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message);
768 } 786 }
769 } 787 }
770
771 // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too
772 if (m_sitTargetAvatar != UUID.Zero)
773 {
774 if (m_parentGroup != null) // TODO can there be a SOP without a SOG?
775 {
776 ScenePresence avatar;
777 if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
778 {
779 avatar.ParentPosition = GetWorldPosition();
780 }
781 }
782 }
783 } 788 }
784 } 789 }
785 790
@@ -788,7 +793,8 @@ namespace OpenSim.Region.Framework.Scenes
788 get { return m_offsetPosition; } 793 get { return m_offsetPosition; }
789 set 794 set
790 { 795 {
791 StoreUndoState(); 796 Vector3 oldpos = m_offsetPosition;
797 StoreUndoState(UndoType.STATE_PRIM_POSITION);
792 m_offsetPosition = value; 798 m_offsetPosition = value;
793 799
794 if (ParentGroup != null && !ParentGroup.IsDeleted) 800 if (ParentGroup != null && !ParentGroup.IsDeleted)
@@ -803,7 +809,22 @@ namespace OpenSim.Region.Framework.Scenes
803 if (m_parentGroup.Scene != null) 809 if (m_parentGroup.Scene != null)
804 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 810 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
805 } 811 }
812
813 if (!m_parentGroup.m_dupeInProgress)
814 {
815 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars();
816 foreach (ScenePresence av in avs)
817 {
818 if (av.LinkedPrim == m_uuid)
819 {
820 Vector3 offset = (m_offsetPosition - oldpos);
821 av.OffsetPosition += offset;
822 av.SendAvatarDataToAllAgents();
823 }
824 }
825 }
806 } 826 }
827 TriggerScriptChangedEvent(Changed.POSITION);
807 } 828 }
808 } 829 }
809 830
@@ -845,7 +866,7 @@ namespace OpenSim.Region.Framework.Scenes
845 866
846 set 867 set
847 { 868 {
848 StoreUndoState(); 869 StoreUndoState(UndoType.STATE_PRIM_ROTATION);
849 m_rotationOffset = value; 870 m_rotationOffset = value;
850 871
851 PhysicsActor actor = PhysActor; 872 PhysicsActor actor = PhysActor;
@@ -929,7 +950,16 @@ namespace OpenSim.Region.Framework.Scenes
929 /// <summary></summary> 950 /// <summary></summary>
930 public Vector3 Acceleration 951 public Vector3 Acceleration
931 { 952 {
932 get { return m_acceleration; } 953 get
954 {
955 PhysicsActor actor = PhysActor;
956 if (actor != null)
957 {
958 m_acceleration = actor.Acceleration;
959 }
960 return m_acceleration;
961 }
962
933 set { m_acceleration = value; } 963 set { m_acceleration = value; }
934 } 964 }
935 965
@@ -1020,7 +1050,7 @@ namespace OpenSim.Region.Framework.Scenes
1020 get { return m_shape.Scale; } 1050 get { return m_shape.Scale; }
1021 set 1051 set
1022 { 1052 {
1023 StoreUndoState(); 1053 StoreUndoState(UndoType.STATE_PRIM_SCALE);
1024 if (m_shape != null) 1054 if (m_shape != null)
1025 { 1055 {
1026 m_shape.Scale = value; 1056 m_shape.Scale = value;
@@ -1091,7 +1121,7 @@ namespace OpenSim.Region.Framework.Scenes
1091 if (IsAttachment) 1121 if (IsAttachment)
1092 return GroupPosition; 1122 return GroupPosition;
1093 1123
1094 return m_offsetPosition + m_groupPosition; 1124 return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset);
1095 } 1125 }
1096 } 1126 }
1097 1127
@@ -1251,6 +1281,13 @@ namespace OpenSim.Region.Framework.Scenes
1251 _flags = value; 1281 _flags = value;
1252 } 1282 }
1253 } 1283 }
1284
1285 [XmlIgnore]
1286 public bool IsOccupied // KF If an av is sittingon this prim
1287 {
1288 get { return m_occupied; }
1289 set { m_occupied = value; }
1290 }
1254 1291
1255 1292
1256 public UUID SitTargetAvatar 1293 public UUID SitTargetAvatar
@@ -1310,6 +1347,19 @@ namespace OpenSim.Region.Framework.Scenes
1310 set { m_collisionSoundVolume = value; } 1347 set { m_collisionSoundVolume = value; }
1311 } 1348 }
1312 1349
1350 public float Buoyancy
1351 {
1352 get { return m_buoyancy; }
1353 set
1354 {
1355 m_buoyancy = value;
1356 if (PhysActor != null)
1357 {
1358 PhysActor.Buoyancy = value;
1359 }
1360 }
1361 }
1362
1313 #endregion Public Properties with only Get 1363 #endregion Public Properties with only Get
1314 1364
1315 #region Private Methods 1365 #region Private Methods
@@ -1326,14 +1376,6 @@ namespace OpenSim.Region.Framework.Scenes
1326 } 1376 }
1327 } 1377 }
1328 1378
1329 /// <summary>
1330 /// Clear all pending updates of parts to clients
1331 /// </summary>
1332 private void ClearUpdateSchedule()
1333 {
1334 m_updateFlag = 0;
1335 }
1336
1337 private void SendObjectPropertiesToClient(UUID AgentID) 1379 private void SendObjectPropertiesToClient(UUID AgentID)
1338 { 1380 {
1339 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1381 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
@@ -1584,15 +1626,22 @@ namespace OpenSim.Region.Framework.Scenes
1584 // or flexible 1626 // or flexible
1585 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) 1627 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
1586 { 1628 {
1587 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 1629 try
1588 LocalId, 1630 {
1589 string.Format("{0}/{1}", Name, UUID), 1631 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1590 Shape, 1632 string.Format("{0}/{1}", Name, UUID),
1591 AbsolutePosition, 1633 Shape,
1592 Scale, 1634 AbsolutePosition,
1593 RotationOffset, 1635 Scale,
1594 RigidBody); 1636 RotationOffset,
1595 1637 RigidBody);
1638 PhysActor.SetMaterial(Material);
1639 }
1640 catch
1641 {
1642 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
1643 PhysActor = null;
1644 }
1596 // Basic Physics returns null.. joy joy joy. 1645 // Basic Physics returns null.. joy joy joy.
1597 if (PhysActor != null) 1646 if (PhysActor != null)
1598 { 1647 {
@@ -1619,7 +1668,7 @@ namespace OpenSim.Region.Framework.Scenes
1619 { 1668 {
1620 m_redo.Clear(); 1669 m_redo.Clear();
1621 } 1670 }
1622 StoreUndoState(); 1671 StoreUndoState(UndoType.STATE_ALL);
1623 } 1672 }
1624 1673
1625 public byte ConvertScriptUintToByte(uint indata) 1674 public byte ConvertScriptUintToByte(uint indata)
@@ -1688,6 +1737,9 @@ namespace OpenSim.Region.Framework.Scenes
1688 1737
1689 // Move afterwards ResetIDs as it clears the localID 1738 // Move afterwards ResetIDs as it clears the localID
1690 dupe.LocalId = localID; 1739 dupe.LocalId = localID;
1740 if(dupe.PhysActor != null)
1741 dupe.PhysActor.LocalID = localID;
1742
1691 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. 1743 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
1692 dupe._lastOwnerID = OwnerID; 1744 dupe._lastOwnerID = OwnerID;
1693 1745
@@ -1731,7 +1783,7 @@ namespace OpenSim.Region.Framework.Scenes
1731 PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); 1783 PrimitiveBaseShape shape = PrimitiveBaseShape.Create();
1732 part.Shape = shape; 1784 part.Shape = shape;
1733 1785
1734 part.Name = "Primitive"; 1786 part.Name = "Object";
1735 part._ownerID = UUID.Random(); 1787 part._ownerID = UUID.Random();
1736 1788
1737 return part; 1789 return part;
@@ -2084,19 +2136,17 @@ namespace OpenSim.Region.Framework.Scenes
2084 public Vector3 GetWorldPosition() 2136 public Vector3 GetWorldPosition()
2085 { 2137 {
2086 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 2138 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
2087
2088 Vector3 axPos = OffsetPosition; 2139 Vector3 axPos = OffsetPosition;
2089
2090 axPos *= parentRot; 2140 axPos *= parentRot;
2091 Vector3 translationOffsetPosition = axPos; 2141 Vector3 translationOffsetPosition = axPos;
2092 2142 if(_parentID == 0)
2093// m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name); 2143 {
2094 2144 return GroupPosition;
2095 Vector3 worldPos = GroupPosition + translationOffsetPosition; 2145 }
2096 2146 else
2097// m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name); 2147 {
2098 2148 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
2099 return worldPos; 2149 }
2100 } 2150 }
2101 2151
2102 /// <summary> 2152 /// <summary>
@@ -2753,17 +2803,18 @@ namespace OpenSim.Region.Framework.Scenes
2753 //Trys to fetch sound id from prim's inventory. 2803 //Trys to fetch sound id from prim's inventory.
2754 //Prim's inventory doesn't support non script items yet 2804 //Prim's inventory doesn't support non script items yet
2755 2805
2756 lock (TaskInventory) 2806 TaskInventory.LockItemsForRead(true);
2807
2808 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2757 { 2809 {
2758 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2810 if (item.Value.Name == sound)
2759 { 2811 {
2760 if (item.Value.Name == sound) 2812 soundID = item.Value.ItemID;
2761 { 2813 break;
2762 soundID = item.Value.ItemID;
2763 break;
2764 }
2765 } 2814 }
2766 } 2815 }
2816
2817 TaskInventory.LockItemsForRead(false);
2767 } 2818 }
2768 2819
2769 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2820 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -2823,7 +2874,7 @@ namespace OpenSim.Region.Framework.Scenes
2823 /// <param name="scale"></param> 2874 /// <param name="scale"></param>
2824 public void Resize(Vector3 scale) 2875 public void Resize(Vector3 scale)
2825 { 2876 {
2826 StoreUndoState(); 2877 StoreUndoState(UndoType.STATE_PRIM_SCALE);
2827 m_shape.Scale = scale; 2878 m_shape.Scale = scale;
2828 2879
2829 ParentGroup.HasGroupChanged = true; 2880 ParentGroup.HasGroupChanged = true;
@@ -2832,38 +2883,7 @@ namespace OpenSim.Region.Framework.Scenes
2832 2883
2833 public void RotLookAt(Quaternion target, float strength, float damping) 2884 public void RotLookAt(Quaternion target, float strength, float damping)
2834 { 2885 {
2835 rotLookAt(target, strength, damping); 2886 m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
2836 }
2837
2838 public void rotLookAt(Quaternion target, float strength, float damping)
2839 {
2840 if (IsAttachment)
2841 {
2842 /*
2843 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2844 if (avatar != null)
2845 {
2846 Rotate the Av?
2847 } */
2848 }
2849 else
2850 {
2851 APIDDamp = damping;
2852 APIDStrength = strength;
2853 APIDTarget = target;
2854 }
2855 }
2856
2857 public void startLookAt(Quaternion rot, float damp, float strength)
2858 {
2859 APIDDamp = damp;
2860 APIDStrength = strength;
2861 APIDTarget = rot;
2862 }
2863
2864 public void stopLookAt()
2865 {
2866 APIDTarget = Quaternion.Identity;
2867 } 2887 }
2868 2888
2869 /// <summary> 2889 /// <summary>
@@ -2875,7 +2895,10 @@ namespace OpenSim.Region.Framework.Scenes
2875 2895
2876 if (m_parentGroup != null) 2896 if (m_parentGroup != null)
2877 { 2897 {
2878 m_parentGroup.QueueForUpdateCheck(); 2898 if (!m_parentGroup.areUpdatesSuspended)
2899 {
2900 m_parentGroup.QueueForUpdateCheck();
2901 }
2879 } 2902 }
2880 2903
2881 int timeNow = Util.UnixTimeSinceEpoch(); 2904 int timeNow = Util.UnixTimeSinceEpoch();
@@ -3092,8 +3115,8 @@ namespace OpenSim.Region.Framework.Scenes
3092 { 3115 {
3093 const float ROTATION_TOLERANCE = 0.01f; 3116 const float ROTATION_TOLERANCE = 0.01f;
3094 const float VELOCITY_TOLERANCE = 0.001f; 3117 const float VELOCITY_TOLERANCE = 0.001f;
3095 const float POSITION_TOLERANCE = 0.05f; 3118 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
3096 const int TIME_MS_TOLERANCE = 3000; 3119 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
3097 3120
3098 if (m_updateFlag == 1) 3121 if (m_updateFlag == 1)
3099 { 3122 {
@@ -3107,7 +3130,7 @@ namespace OpenSim.Region.Framework.Scenes
3107 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 3130 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
3108 { 3131 {
3109 AddTerseUpdateToAllAvatars(); 3132 AddTerseUpdateToAllAvatars();
3110 ClearUpdateSchedule(); 3133
3111 3134
3112 // This causes the Scene to 'poll' physical objects every couple of frames 3135 // This causes the Scene to 'poll' physical objects every couple of frames
3113 // bad, so it's been replaced by an event driven method. 3136 // bad, so it's been replaced by an event driven method.
@@ -3125,16 +3148,18 @@ namespace OpenSim.Region.Framework.Scenes
3125 m_lastAngularVelocity = AngularVelocity; 3148 m_lastAngularVelocity = AngularVelocity;
3126 m_lastTerseSent = Environment.TickCount; 3149 m_lastTerseSent = Environment.TickCount;
3127 } 3150 }
3151 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
3152 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
3128 } 3153 }
3129 else 3154 else
3130 { 3155 {
3131 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 3156 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
3132 { 3157 {
3133 AddFullUpdateToAllAvatars(); 3158 AddFullUpdateToAllAvatars();
3134 ClearUpdateSchedule(); 3159 m_updateFlag = 0; //Same here
3135 } 3160 }
3136 } 3161 }
3137 ClearUpdateSchedule(); 3162 m_updateFlag = 0;
3138 } 3163 }
3139 3164
3140 /// <summary> 3165 /// <summary>
@@ -3162,17 +3187,16 @@ namespace OpenSim.Region.Framework.Scenes
3162 if (!UUID.TryParse(sound, out soundID)) 3187 if (!UUID.TryParse(sound, out soundID))
3163 { 3188 {
3164 // search sound file from inventory 3189 // search sound file from inventory
3165 lock (TaskInventory) 3190 TaskInventory.LockItemsForRead(true);
3191 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3166 { 3192 {
3167 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3193 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3168 { 3194 {
3169 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3195 soundID = item.Value.ItemID;
3170 { 3196 break;
3171 soundID = item.Value.ItemID;
3172 break;
3173 }
3174 } 3197 }
3175 } 3198 }
3199 TaskInventory.LockItemsForRead(false);
3176 } 3200 }
3177 3201
3178 if (soundID == UUID.Zero) 3202 if (soundID == UUID.Zero)
@@ -3275,14 +3299,6 @@ namespace OpenSim.Region.Framework.Scenes
3275 STATUS_ROTATE_Z = rotate; 3299 STATUS_ROTATE_Z = rotate;
3276 } 3300 }
3277 3301
3278 public void SetBuoyancy(float fvalue)
3279 {
3280 if (PhysActor != null)
3281 {
3282 PhysActor.Buoyancy = fvalue;
3283 }
3284 }
3285
3286 public void SetDieAtEdge(bool p) 3302 public void SetDieAtEdge(bool p)
3287 { 3303 {
3288 if (m_parentGroup == null) 3304 if (m_parentGroup == null)
@@ -3602,7 +3618,7 @@ namespace OpenSim.Region.Framework.Scenes
3602 3618
3603 public void StopLookAt() 3619 public void StopLookAt()
3604 { 3620 {
3605 m_parentGroup.stopLookAt(); 3621 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3606 3622
3607 m_parentGroup.ScheduleGroupForTerseUpdate(); 3623 m_parentGroup.ScheduleGroupForTerseUpdate();
3608 } 3624 }
@@ -3629,10 +3645,9 @@ namespace OpenSim.Region.Framework.Scenes
3629 m_parentGroup.ScheduleGroupForTerseUpdate(); 3645 m_parentGroup.ScheduleGroupForTerseUpdate();
3630 //m_parentGroup.ScheduleGroupForFullUpdate(); 3646 //m_parentGroup.ScheduleGroupForFullUpdate();
3631 } 3647 }
3632 3648 public void StoreUndoState(UndoType type)
3633 public void StoreUndoState()
3634 { 3649 {
3635 if (!Undoing) 3650 if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
3636 { 3651 {
3637 if (!IgnoreUndoUpdate) 3652 if (!IgnoreUndoUpdate)
3638 { 3653 {
@@ -3643,17 +3658,25 @@ namespace OpenSim.Region.Framework.Scenes
3643 if (m_undo.Count > 0) 3658 if (m_undo.Count > 0)
3644 { 3659 {
3645 UndoState last = m_undo.Peek(); 3660 UndoState last = m_undo.Peek();
3646 if (last != null) 3661
3647 {
3648 if (last.Compare(this))
3649 return;
3650 }
3651 } 3662 }
3652 3663
3653 if (m_parentGroup.GetSceneMaxUndo() > 0) 3664 if (m_parentGroup.GetSceneMaxUndo() > 0)
3654 { 3665 {
3655 UndoState nUndo = new UndoState(this); 3666 UndoState lastUndo = m_undo.Peek();
3656 3667
3668 UndoState nUndo = new UndoState(this, type);
3669
3670 if (lastUndo != null)
3671 {
3672 TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
3673 if (ts.TotalMilliseconds < 500)
3674 {
3675 //Delete the last entry since it was less than 500 milliseconds ago
3676 nUndo.Merge(lastUndo);
3677 m_undo.Pop();
3678 }
3679 }
3657 m_undo.Push(nUndo); 3680 m_undo.Push(nUndo);
3658 } 3681 }
3659 3682
@@ -4130,11 +4153,13 @@ namespace OpenSim.Region.Framework.Scenes
4130 if (m_undo.Count > 0) 4153 if (m_undo.Count > 0)
4131 { 4154 {
4132 UndoState nUndo = null; 4155 UndoState nUndo = null;
4156 UndoState goback = m_undo.Pop();
4133 if (m_parentGroup.GetSceneMaxUndo() > 0) 4157 if (m_parentGroup.GetSceneMaxUndo() > 0)
4134 { 4158 {
4135 nUndo = new UndoState(this); 4159 nUndo = new UndoState(this, goback.Type);
4136 } 4160 }
4137 UndoState goback = m_undo.Pop(); 4161
4162
4138 if (goback != null) 4163 if (goback != null)
4139 { 4164 {
4140 goback.PlaybackState(this); 4165 goback.PlaybackState(this);
@@ -4149,13 +4174,13 @@ namespace OpenSim.Region.Framework.Scenes
4149 { 4174 {
4150 lock (m_redo) 4175 lock (m_redo)
4151 { 4176 {
4177 UndoState gofwd = m_redo.Pop();
4152 if (m_parentGroup.GetSceneMaxUndo() > 0) 4178 if (m_parentGroup.GetSceneMaxUndo() > 0)
4153 { 4179 {
4154 UndoState nUndo = new UndoState(this); 4180 UndoState nUndo = new UndoState(this, gofwd.Type);
4155 4181
4156 m_undo.Push(nUndo); 4182 m_undo.Push(nUndo);
4157 } 4183 }
4158 UndoState gofwd = m_redo.Pop();
4159 if (gofwd != null) 4184 if (gofwd != null)
4160 gofwd.PlayfwdState(this); 4185 gofwd.PlayfwdState(this);
4161 } 4186 }
@@ -4420,6 +4445,7 @@ namespace OpenSim.Region.Framework.Scenes
4420 Scale, 4445 Scale,
4421 RotationOffset, 4446 RotationOffset,
4422 UsePhysics); 4447 UsePhysics);
4448 PhysActor.SetMaterial(Material);
4423 4449
4424 pa = PhysActor; 4450 pa = PhysActor;
4425 if (pa != null) 4451 if (pa != null)
@@ -4604,8 +4630,9 @@ namespace OpenSim.Region.Framework.Scenes
4604 { 4630 {
4605 m_shape.TextureEntry = textureEntry; 4631 m_shape.TextureEntry = textureEntry;
4606 TriggerScriptChangedEvent(Changed.TEXTURE); 4632 TriggerScriptChangedEvent(Changed.TEXTURE);
4607 4633 m_updateFlag = 1;
4608 ParentGroup.HasGroupChanged = true; 4634 ParentGroup.HasGroupChanged = true;
4635
4609 //This is madness.. 4636 //This is madness..
4610 //ParentGroup.ScheduleGroupForFullUpdate(); 4637 //ParentGroup.ScheduleGroupForFullUpdate();
4611 //This is sparta 4638 //This is sparta
@@ -4838,5 +4865,17 @@ namespace OpenSim.Region.Framework.Scenes
4838 Color color = Color; 4865 Color color = Color;
4839 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); 4866 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
4840 } 4867 }
4868
4869 public void ResetOwnerChangeFlag()
4870 {
4871 List<UUID> inv = Inventory.GetInventoryList();
4872
4873 foreach (UUID itemID in inv)
4874 {
4875 TaskInventoryItem item = Inventory.GetInventoryItem(itemID);
4876 item.OwnerChanged = false;
4877 Inventory.UpdateInventoryItem(item, false, false);
4878 }
4879 }
4841 } 4880 }
4842} 4881}