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.cs314
1 files changed, 174 insertions, 140 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 307c92a..980f7a3 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;
@@ -1088,10 +1118,7 @@ namespace OpenSim.Region.Framework.Scenes
1088 { 1118 {
1089 get 1119 get
1090 { 1120 {
1091 if (IsAttachment) 1121 return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset);
1092 return GroupPosition;
1093
1094 return m_offsetPosition + m_groupPosition;
1095 } 1122 }
1096 } 1123 }
1097 1124
@@ -1251,6 +1278,13 @@ namespace OpenSim.Region.Framework.Scenes
1251 _flags = value; 1278 _flags = value;
1252 } 1279 }
1253 } 1280 }
1281
1282 [XmlIgnore]
1283 public bool IsOccupied // KF If an av is sittingon this prim
1284 {
1285 get { return m_occupied; }
1286 set { m_occupied = value; }
1287 }
1254 1288
1255 1289
1256 public UUID SitTargetAvatar 1290 public UUID SitTargetAvatar
@@ -1310,6 +1344,19 @@ namespace OpenSim.Region.Framework.Scenes
1310 set { m_collisionSoundVolume = value; } 1344 set { m_collisionSoundVolume = value; }
1311 } 1345 }
1312 1346
1347 public float Buoyancy
1348 {
1349 get { return m_buoyancy; }
1350 set
1351 {
1352 m_buoyancy = value;
1353 if (PhysActor != null)
1354 {
1355 PhysActor.Buoyancy = value;
1356 }
1357 }
1358 }
1359
1313 #endregion Public Properties with only Get 1360 #endregion Public Properties with only Get
1314 1361
1315 #region Private Methods 1362 #region Private Methods
@@ -1326,14 +1373,6 @@ namespace OpenSim.Region.Framework.Scenes
1326 } 1373 }
1327 } 1374 }
1328 1375
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) 1376 private void SendObjectPropertiesToClient(UUID AgentID)
1338 { 1377 {
1339 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1378 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
@@ -1586,17 +1625,22 @@ namespace OpenSim.Region.Framework.Scenes
1586 // or flexible 1625 // or flexible
1587 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) 1626 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
1588 { 1627 {
1589// m_log.DebugFormat("[SCENE OBJECT PART]: Creating PhysActor for {0} {1} {2}", Name, LocalId, UUID); 1628 try
1590 1629 {
1591 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 1630 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1592 LocalId, 1631 string.Format("{0}/{1}", Name, UUID),
1593 string.Format("{0}/{1}", Name, UUID), 1632 Shape,
1594 Shape, 1633 AbsolutePosition,
1595 AbsolutePosition, 1634 Scale,
1596 Scale, 1635 RotationOffset,
1597 RotationOffset, 1636 RigidBody);
1598 RigidBody); 1637 PhysActor.SetMaterial(Material);
1599 1638 }
1639 catch
1640 {
1641 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
1642 PhysActor = null;
1643 }
1600 // Basic Physics returns null.. joy joy joy. 1644 // Basic Physics returns null.. joy joy joy.
1601 if (PhysActor != null) 1645 if (PhysActor != null)
1602 { 1646 {
@@ -1623,7 +1667,7 @@ namespace OpenSim.Region.Framework.Scenes
1623 { 1667 {
1624 m_redo.Clear(); 1668 m_redo.Clear();
1625 } 1669 }
1626 StoreUndoState(); 1670 StoreUndoState(UndoType.STATE_ALL);
1627 } 1671 }
1628 1672
1629 public byte ConvertScriptUintToByte(uint indata) 1673 public byte ConvertScriptUintToByte(uint indata)
@@ -1692,6 +1736,9 @@ namespace OpenSim.Region.Framework.Scenes
1692 1736
1693 // Move afterwards ResetIDs as it clears the localID 1737 // Move afterwards ResetIDs as it clears the localID
1694 dupe.LocalId = localID; 1738 dupe.LocalId = localID;
1739 if(dupe.PhysActor != null)
1740 dupe.PhysActor.LocalID = localID;
1741
1695 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. 1742 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
1696 dupe._lastOwnerID = OwnerID; 1743 dupe._lastOwnerID = OwnerID;
1697 1744
@@ -1735,7 +1782,7 @@ namespace OpenSim.Region.Framework.Scenes
1735 PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); 1782 PrimitiveBaseShape shape = PrimitiveBaseShape.Create();
1736 part.Shape = shape; 1783 part.Shape = shape;
1737 1784
1738 part.Name = "Primitive"; 1785 part.Name = "Object";
1739 part._ownerID = UUID.Random(); 1786 part._ownerID = UUID.Random();
1740 1787
1741 return part; 1788 return part;
@@ -2088,19 +2135,17 @@ namespace OpenSim.Region.Framework.Scenes
2088 public Vector3 GetWorldPosition() 2135 public Vector3 GetWorldPosition()
2089 { 2136 {
2090 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 2137 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
2091
2092 Vector3 axPos = OffsetPosition; 2138 Vector3 axPos = OffsetPosition;
2093
2094 axPos *= parentRot; 2139 axPos *= parentRot;
2095 Vector3 translationOffsetPosition = axPos; 2140 Vector3 translationOffsetPosition = axPos;
2096 2141 if(_parentID == 0)
2097// m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name); 2142 {
2098 2143 return GroupPosition;
2099 Vector3 worldPos = GroupPosition + translationOffsetPosition; 2144 }
2100 2145 else
2101// m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name); 2146 {
2102 2147 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
2103 return worldPos; 2148 }
2104 } 2149 }
2105 2150
2106 /// <summary> 2151 /// <summary>
@@ -2757,17 +2802,18 @@ namespace OpenSim.Region.Framework.Scenes
2757 //Trys to fetch sound id from prim's inventory. 2802 //Trys to fetch sound id from prim's inventory.
2758 //Prim's inventory doesn't support non script items yet 2803 //Prim's inventory doesn't support non script items yet
2759 2804
2760 lock (TaskInventory) 2805 TaskInventory.LockItemsForRead(true);
2806
2807 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2761 { 2808 {
2762 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2809 if (item.Value.Name == sound)
2763 { 2810 {
2764 if (item.Value.Name == sound) 2811 soundID = item.Value.ItemID;
2765 { 2812 break;
2766 soundID = item.Value.ItemID;
2767 break;
2768 }
2769 } 2813 }
2770 } 2814 }
2815
2816 TaskInventory.LockItemsForRead(false);
2771 } 2817 }
2772 2818
2773 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2819 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -2827,7 +2873,7 @@ namespace OpenSim.Region.Framework.Scenes
2827 /// <param name="scale"></param> 2873 /// <param name="scale"></param>
2828 public void Resize(Vector3 scale) 2874 public void Resize(Vector3 scale)
2829 { 2875 {
2830 StoreUndoState(); 2876 StoreUndoState(UndoType.STATE_PRIM_SCALE);
2831 m_shape.Scale = scale; 2877 m_shape.Scale = scale;
2832 2878
2833 ParentGroup.HasGroupChanged = true; 2879 ParentGroup.HasGroupChanged = true;
@@ -2836,38 +2882,7 @@ namespace OpenSim.Region.Framework.Scenes
2836 2882
2837 public void RotLookAt(Quaternion target, float strength, float damping) 2883 public void RotLookAt(Quaternion target, float strength, float damping)
2838 { 2884 {
2839 rotLookAt(target, strength, damping); 2885 m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
2840 }
2841
2842 public void rotLookAt(Quaternion target, float strength, float damping)
2843 {
2844 if (IsAttachment)
2845 {
2846 /*
2847 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2848 if (avatar != null)
2849 {
2850 Rotate the Av?
2851 } */
2852 }
2853 else
2854 {
2855 APIDDamp = damping;
2856 APIDStrength = strength;
2857 APIDTarget = target;
2858 }
2859 }
2860
2861 public void startLookAt(Quaternion rot, float damp, float strength)
2862 {
2863 APIDDamp = damp;
2864 APIDStrength = strength;
2865 APIDTarget = rot;
2866 }
2867
2868 public void stopLookAt()
2869 {
2870 APIDTarget = Quaternion.Identity;
2871 } 2886 }
2872 2887
2873 /// <summary> 2888 /// <summary>
@@ -2879,7 +2894,10 @@ namespace OpenSim.Region.Framework.Scenes
2879 2894
2880 if (m_parentGroup != null) 2895 if (m_parentGroup != null)
2881 { 2896 {
2882 m_parentGroup.QueueForUpdateCheck(); 2897 if (!m_parentGroup.areUpdatesSuspended)
2898 {
2899 m_parentGroup.QueueForUpdateCheck();
2900 }
2883 } 2901 }
2884 2902
2885 int timeNow = Util.UnixTimeSinceEpoch(); 2903 int timeNow = Util.UnixTimeSinceEpoch();
@@ -3095,8 +3113,8 @@ namespace OpenSim.Region.Framework.Scenes
3095 { 3113 {
3096 const float ROTATION_TOLERANCE = 0.01f; 3114 const float ROTATION_TOLERANCE = 0.01f;
3097 const float VELOCITY_TOLERANCE = 0.001f; 3115 const float VELOCITY_TOLERANCE = 0.001f;
3098 const float POSITION_TOLERANCE = 0.05f; 3116 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
3099 const int TIME_MS_TOLERANCE = 3000; 3117 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
3100 3118
3101 if (m_updateFlag == 1) 3119 if (m_updateFlag == 1)
3102 { 3120 {
@@ -3110,7 +3128,7 @@ namespace OpenSim.Region.Framework.Scenes
3110 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 3128 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
3111 { 3129 {
3112 AddTerseUpdateToAllAvatars(); 3130 AddTerseUpdateToAllAvatars();
3113 ClearUpdateSchedule(); 3131
3114 3132
3115 // This causes the Scene to 'poll' physical objects every couple of frames 3133 // This causes the Scene to 'poll' physical objects every couple of frames
3116 // bad, so it's been replaced by an event driven method. 3134 // bad, so it's been replaced by an event driven method.
@@ -3128,16 +3146,18 @@ namespace OpenSim.Region.Framework.Scenes
3128 m_lastAngularVelocity = AngularVelocity; 3146 m_lastAngularVelocity = AngularVelocity;
3129 m_lastTerseSent = Environment.TickCount; 3147 m_lastTerseSent = Environment.TickCount;
3130 } 3148 }
3149 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
3150 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
3131 } 3151 }
3132 else 3152 else
3133 { 3153 {
3134 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 3154 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
3135 { 3155 {
3136 AddFullUpdateToAllAvatars(); 3156 AddFullUpdateToAllAvatars();
3137 ClearUpdateSchedule(); 3157 m_updateFlag = 0; //Same here
3138 } 3158 }
3139 } 3159 }
3140 ClearUpdateSchedule(); 3160 m_updateFlag = 0;
3141 } 3161 }
3142 3162
3143 /// <summary> 3163 /// <summary>
@@ -3165,17 +3185,16 @@ namespace OpenSim.Region.Framework.Scenes
3165 if (!UUID.TryParse(sound, out soundID)) 3185 if (!UUID.TryParse(sound, out soundID))
3166 { 3186 {
3167 // search sound file from inventory 3187 // search sound file from inventory
3168 lock (TaskInventory) 3188 TaskInventory.LockItemsForRead(true);
3189 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3169 { 3190 {
3170 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3191 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3171 { 3192 {
3172 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3193 soundID = item.Value.ItemID;
3173 { 3194 break;
3174 soundID = item.Value.ItemID;
3175 break;
3176 }
3177 } 3195 }
3178 } 3196 }
3197 TaskInventory.LockItemsForRead(false);
3179 } 3198 }
3180 3199
3181 if (soundID == UUID.Zero) 3200 if (soundID == UUID.Zero)
@@ -3278,14 +3297,6 @@ namespace OpenSim.Region.Framework.Scenes
3278 STATUS_ROTATE_Z = rotate; 3297 STATUS_ROTATE_Z = rotate;
3279 } 3298 }
3280 3299
3281 public void SetBuoyancy(float fvalue)
3282 {
3283 if (PhysActor != null)
3284 {
3285 PhysActor.Buoyancy = fvalue;
3286 }
3287 }
3288
3289 public void SetDieAtEdge(bool p) 3300 public void SetDieAtEdge(bool p)
3290 { 3301 {
3291 if (m_parentGroup == null) 3302 if (m_parentGroup == null)
@@ -3605,7 +3616,7 @@ namespace OpenSim.Region.Framework.Scenes
3605 3616
3606 public void StopLookAt() 3617 public void StopLookAt()
3607 { 3618 {
3608 m_parentGroup.stopLookAt(); 3619 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3609 3620
3610 m_parentGroup.ScheduleGroupForTerseUpdate(); 3621 m_parentGroup.ScheduleGroupForTerseUpdate();
3611 } 3622 }
@@ -3632,10 +3643,9 @@ namespace OpenSim.Region.Framework.Scenes
3632 m_parentGroup.ScheduleGroupForTerseUpdate(); 3643 m_parentGroup.ScheduleGroupForTerseUpdate();
3633 //m_parentGroup.ScheduleGroupForFullUpdate(); 3644 //m_parentGroup.ScheduleGroupForFullUpdate();
3634 } 3645 }
3635 3646 public void StoreUndoState(UndoType type)
3636 public void StoreUndoState()
3637 { 3647 {
3638 if (!Undoing) 3648 if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
3639 { 3649 {
3640 if (!IgnoreUndoUpdate) 3650 if (!IgnoreUndoUpdate)
3641 { 3651 {
@@ -3646,17 +3656,25 @@ namespace OpenSim.Region.Framework.Scenes
3646 if (m_undo.Count > 0) 3656 if (m_undo.Count > 0)
3647 { 3657 {
3648 UndoState last = m_undo.Peek(); 3658 UndoState last = m_undo.Peek();
3649 if (last != null) 3659
3650 {
3651 if (last.Compare(this))
3652 return;
3653 }
3654 } 3660 }
3655 3661
3656 if (m_parentGroup.GetSceneMaxUndo() > 0) 3662 if (m_parentGroup.GetSceneMaxUndo() > 0)
3657 { 3663 {
3658 UndoState nUndo = new UndoState(this); 3664 UndoState lastUndo = m_undo.Peek();
3665
3666 UndoState nUndo = new UndoState(this, type);
3659 3667
3668 if (lastUndo != null)
3669 {
3670 TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
3671 if (ts.TotalMilliseconds < 500)
3672 {
3673 //Delete the last entry since it was less than 500 milliseconds ago
3674 nUndo.Merge(lastUndo);
3675 m_undo.Pop();
3676 }
3677 }
3660 m_undo.Push(nUndo); 3678 m_undo.Push(nUndo);
3661 } 3679 }
3662 3680
@@ -4133,11 +4151,13 @@ namespace OpenSim.Region.Framework.Scenes
4133 if (m_undo.Count > 0) 4151 if (m_undo.Count > 0)
4134 { 4152 {
4135 UndoState nUndo = null; 4153 UndoState nUndo = null;
4154 UndoState goback = m_undo.Pop();
4136 if (m_parentGroup.GetSceneMaxUndo() > 0) 4155 if (m_parentGroup.GetSceneMaxUndo() > 0)
4137 { 4156 {
4138 nUndo = new UndoState(this); 4157 nUndo = new UndoState(this, goback.Type);
4139 } 4158 }
4140 UndoState goback = m_undo.Pop(); 4159
4160
4141 if (goback != null) 4161 if (goback != null)
4142 { 4162 {
4143 goback.PlaybackState(this); 4163 goback.PlaybackState(this);
@@ -4152,13 +4172,13 @@ namespace OpenSim.Region.Framework.Scenes
4152 { 4172 {
4153 lock (m_redo) 4173 lock (m_redo)
4154 { 4174 {
4175 UndoState gofwd = m_redo.Pop();
4155 if (m_parentGroup.GetSceneMaxUndo() > 0) 4176 if (m_parentGroup.GetSceneMaxUndo() > 0)
4156 { 4177 {
4157 UndoState nUndo = new UndoState(this); 4178 UndoState nUndo = new UndoState(this, gofwd.Type);
4158 4179
4159 m_undo.Push(nUndo); 4180 m_undo.Push(nUndo);
4160 } 4181 }
4161 UndoState gofwd = m_redo.Pop();
4162 if (gofwd != null) 4182 if (gofwd != null)
4163 gofwd.PlayfwdState(this); 4183 gofwd.PlayfwdState(this);
4164 } 4184 }
@@ -4423,6 +4443,7 @@ namespace OpenSim.Region.Framework.Scenes
4423 Scale, 4443 Scale,
4424 RotationOffset, 4444 RotationOffset,
4425 UsePhysics); 4445 UsePhysics);
4446 PhysActor.SetMaterial(Material);
4426 4447
4427 pa = PhysActor; 4448 pa = PhysActor;
4428 if (pa != null) 4449 if (pa != null)
@@ -4607,8 +4628,9 @@ namespace OpenSim.Region.Framework.Scenes
4607 { 4628 {
4608 m_shape.TextureEntry = textureEntry; 4629 m_shape.TextureEntry = textureEntry;
4609 TriggerScriptChangedEvent(Changed.TEXTURE); 4630 TriggerScriptChangedEvent(Changed.TEXTURE);
4610 4631 m_updateFlag = 1;
4611 ParentGroup.HasGroupChanged = true; 4632 ParentGroup.HasGroupChanged = true;
4633
4612 //This is madness.. 4634 //This is madness..
4613 //ParentGroup.ScheduleGroupForFullUpdate(); 4635 //ParentGroup.ScheduleGroupForFullUpdate();
4614 //This is sparta 4636 //This is sparta
@@ -4841,5 +4863,17 @@ namespace OpenSim.Region.Framework.Scenes
4841 Color color = Color; 4863 Color color = Color;
4842 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); 4864 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
4843 } 4865 }
4866
4867 public void ResetOwnerChangeFlag()
4868 {
4869 List<UUID> inv = Inventory.GetInventoryList();
4870
4871 foreach (UUID itemID in inv)
4872 {
4873 TaskInventoryItem item = Inventory.GetInventoryItem(itemID);
4874 item.OwnerChanged = false;
4875 Inventory.UpdateInventoryItem(item, false, false);
4876 }
4877 }
4844 } 4878 }
4845} 4879}