aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs281
1 files changed, 158 insertions, 123 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f164201..b615d42 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;
@@ -470,12 +480,16 @@ namespace OpenSim.Region.Framework.Scenes
470 } 480 }
471 481
472 /// <value> 482 /// <value>
473 /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes 483 /// Get the inventory list
474 /// </value> 484 /// </value>
475 public TaskInventoryDictionary TaskInventory 485 public TaskInventoryDictionary TaskInventory
476 { 486 {
477 get { return m_inventory.Items; } 487 get {
478 set { m_inventory.Items = value; } 488 return m_inventory.Items;
489 }
490 set {
491 m_inventory.Items = value;
492 }
479 } 493 }
480 494
481 /// <summary> 495 /// <summary>
@@ -615,14 +629,12 @@ namespace OpenSim.Region.Framework.Scenes
615 set { m_LoopSoundSlavePrims = value; } 629 set { m_LoopSoundSlavePrims = value; }
616 } 630 }
617 631
618
619 public Byte[] TextureAnimation 632 public Byte[] TextureAnimation
620 { 633 {
621 get { return m_TextureAnimation; } 634 get { return m_TextureAnimation; }
622 set { m_TextureAnimation = value; } 635 set { m_TextureAnimation = value; }
623 } 636 }
624 637
625
626 public Byte[] ParticleSystem 638 public Byte[] ParticleSystem
627 { 639 {
628 get { return m_particleSystem; } 640 get { return m_particleSystem; }
@@ -676,7 +688,6 @@ namespace OpenSim.Region.Framework.Scenes
676 set 688 set
677 { 689 {
678 m_groupPosition = value; 690 m_groupPosition = value;
679
680 PhysicsActor actor = PhysActor; 691 PhysicsActor actor = PhysActor;
681 if (actor != null) 692 if (actor != null)
682 { 693 {
@@ -696,25 +707,13 @@ namespace OpenSim.Region.Framework.Scenes
696 707
697 // Tell the physics engines that this prim changed. 708 // Tell the physics engines that this prim changed.
698 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 709 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
710
699 } 711 }
700 catch (Exception e) 712 catch (Exception e)
701 { 713 {
702 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); 714 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message);
703 } 715 }
704 } 716 }
705
706 // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too
707 if (m_sitTargetAvatar != UUID.Zero)
708 {
709 if (m_parentGroup != null) // TODO can there be a SOP without a SOG?
710 {
711 ScenePresence avatar;
712 if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
713 {
714 avatar.ParentPosition = GetWorldPosition();
715 }
716 }
717 }
718 } 717 }
719 } 718 }
720 719
@@ -723,7 +722,8 @@ namespace OpenSim.Region.Framework.Scenes
723 get { return m_offsetPosition; } 722 get { return m_offsetPosition; }
724 set 723 set
725 { 724 {
726 StoreUndoState(); 725 Vector3 oldpos = m_offsetPosition;
726 StoreUndoState(UndoType.STATE_PRIM_POSITION);
727 m_offsetPosition = value; 727 m_offsetPosition = value;
728 728
729 if (ParentGroup != null && !ParentGroup.IsDeleted) 729 if (ParentGroup != null && !ParentGroup.IsDeleted)
@@ -737,7 +737,22 @@ namespace OpenSim.Region.Framework.Scenes
737 // Tell the physics engines that this prim changed. 737 // Tell the physics engines that this prim changed.
738 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 738 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
739 } 739 }
740
741 if (!m_parentGroup.m_dupeInProgress)
742 {
743 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars();
744 foreach (ScenePresence av in avs)
745 {
746 if (av.LinkedPrim == m_uuid)
747 {
748 Vector3 offset = (m_offsetPosition - oldpos);
749 av.OffsetPosition += offset;
750 av.SendFullUpdateToAllClients();
751 }
752 }
753 }
740 } 754 }
755 TriggerScriptChangedEvent(Changed.POSITION);
741 } 756 }
742 } 757 }
743 758
@@ -779,7 +794,7 @@ namespace OpenSim.Region.Framework.Scenes
779 794
780 set 795 set
781 { 796 {
782 StoreUndoState(); 797 StoreUndoState(UndoType.STATE_PRIM_ROTATION);
783 m_rotationOffset = value; 798 m_rotationOffset = value;
784 799
785 PhysicsActor actor = PhysActor; 800 PhysicsActor actor = PhysActor;
@@ -863,7 +878,16 @@ namespace OpenSim.Region.Framework.Scenes
863 /// <summary></summary> 878 /// <summary></summary>
864 public Vector3 Acceleration 879 public Vector3 Acceleration
865 { 880 {
866 get { return m_acceleration; } 881 get
882 {
883 PhysicsActor actor = PhysActor;
884 if (actor != null)
885 {
886 m_acceleration = actor.Acceleration;
887 }
888 return m_acceleration;
889 }
890
867 set { m_acceleration = value; } 891 set { m_acceleration = value; }
868 } 892 }
869 893
@@ -968,7 +992,7 @@ namespace OpenSim.Region.Framework.Scenes
968 get { return m_shape.Scale; } 992 get { return m_shape.Scale; }
969 set 993 set
970 { 994 {
971 StoreUndoState(); 995 StoreUndoState(UndoType.STATE_PRIM_SCALE);
972 if (m_shape != null) 996 if (m_shape != null)
973 { 997 {
974 m_shape.Scale = value; 998 m_shape.Scale = value;
@@ -1036,9 +1060,10 @@ namespace OpenSim.Region.Framework.Scenes
1036 { 1060 {
1037 get { 1061 get {
1038 if (IsAttachment) 1062 if (IsAttachment)
1039 return GroupPosition; 1063 return GroupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset);
1040 1064
1041 return m_offsetPosition + m_groupPosition; } 1065// return m_offsetPosition + m_groupPosition; }
1066 return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored!
1042 } 1067 }
1043 1068
1044 public SceneObjectGroup ParentGroup 1069 public SceneObjectGroup ParentGroup
@@ -1197,6 +1222,13 @@ namespace OpenSim.Region.Framework.Scenes
1197 _flags = value; 1222 _flags = value;
1198 } 1223 }
1199 } 1224 }
1225
1226 [XmlIgnore]
1227 public bool IsOccupied // KF If an av is sittingon this prim
1228 {
1229 get { return m_occupied; }
1230 set { m_occupied = value; }
1231 }
1200 1232
1201 1233
1202 public UUID SitTargetAvatar 1234 public UUID SitTargetAvatar
@@ -1272,14 +1304,6 @@ namespace OpenSim.Region.Framework.Scenes
1272 } 1304 }
1273 } 1305 }
1274 1306
1275 /// <summary>
1276 /// Clear all pending updates of parts to clients
1277 /// </summary>
1278 private void ClearUpdateSchedule()
1279 {
1280 m_updateFlag = 0;
1281 }
1282
1283 private void SendObjectPropertiesToClient(UUID AgentID) 1307 private void SendObjectPropertiesToClient(UUID AgentID)
1284 { 1308 {
1285 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1309 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
@@ -1530,14 +1554,21 @@ namespace OpenSim.Region.Framework.Scenes
1530 // or flexible 1554 // or flexible
1531 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) 1555 if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible))
1532 { 1556 {
1533 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( 1557 try
1534 string.Format("{0}/{1}", Name, UUID), 1558 {
1535 Shape, 1559 PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape(
1536 AbsolutePosition, 1560 string.Format("{0}/{1}", Name, UUID),
1537 Scale, 1561 Shape,
1538 RotationOffset, 1562 AbsolutePosition,
1539 RigidBody); 1563 Scale,
1540 1564 RotationOffset,
1565 RigidBody);
1566 }
1567 catch
1568 {
1569 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid);
1570 PhysActor = null;
1571 }
1541 // Basic Physics returns null.. joy joy joy. 1572 // Basic Physics returns null.. joy joy joy.
1542 if (PhysActor != null) 1573 if (PhysActor != null)
1543 { 1574 {
@@ -1565,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes
1565 { 1596 {
1566 m_redo.Clear(); 1597 m_redo.Clear();
1567 } 1598 }
1568 StoreUndoState(); 1599 StoreUndoState(UndoType.STATE_ALL);
1569 } 1600 }
1570 1601
1571 public byte ConvertScriptUintToByte(uint indata) 1602 public byte ConvertScriptUintToByte(uint indata)
@@ -1634,6 +1665,9 @@ namespace OpenSim.Region.Framework.Scenes
1634 1665
1635 // Move afterwards ResetIDs as it clears the localID 1666 // Move afterwards ResetIDs as it clears the localID
1636 dupe.LocalId = localID; 1667 dupe.LocalId = localID;
1668 if(dupe.PhysActor != null)
1669 dupe.PhysActor.LocalID = localID;
1670
1637 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated. 1671 // This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
1638 dupe._lastOwnerID = OwnerID; 1672 dupe._lastOwnerID = OwnerID;
1639 1673
@@ -1677,7 +1711,7 @@ namespace OpenSim.Region.Framework.Scenes
1677 PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); 1711 PrimitiveBaseShape shape = PrimitiveBaseShape.Create();
1678 part.Shape = shape; 1712 part.Shape = shape;
1679 1713
1680 part.Name = "Primitive"; 1714 part.Name = "Object";
1681 part._ownerID = UUID.Random(); 1715 part._ownerID = UUID.Random();
1682 1716
1683 return part; 1717 return part;
@@ -2037,12 +2071,17 @@ namespace OpenSim.Region.Framework.Scenes
2037 public Vector3 GetWorldPosition() 2071 public Vector3 GetWorldPosition()
2038 { 2072 {
2039 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 2073 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
2040
2041 Vector3 axPos = OffsetPosition; 2074 Vector3 axPos = OffsetPosition;
2042
2043 axPos *= parentRot; 2075 axPos *= parentRot;
2044 Vector3 translationOffsetPosition = axPos; 2076 Vector3 translationOffsetPosition = axPos;
2045 return GroupPosition + translationOffsetPosition; 2077 if(_parentID == 0)
2078 {
2079 return GroupPosition;
2080 }
2081 else
2082 {
2083 return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position
2084 }
2046 } 2085 }
2047 2086
2048 /// <summary> 2087 /// <summary>
@@ -2053,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes
2053 { 2092 {
2054 Quaternion newRot; 2093 Quaternion newRot;
2055 2094
2056 if (this.LinkNum == 0) 2095 if (this.LinkNum < 2) //KF Single or root prim
2057 { 2096 {
2058 newRot = RotationOffset; 2097 newRot = RotationOffset;
2059 } 2098 }
@@ -2699,17 +2738,18 @@ namespace OpenSim.Region.Framework.Scenes
2699 //Trys to fetch sound id from prim's inventory. 2738 //Trys to fetch sound id from prim's inventory.
2700 //Prim's inventory doesn't support non script items yet 2739 //Prim's inventory doesn't support non script items yet
2701 2740
2702 lock (TaskInventory) 2741 TaskInventory.LockItemsForRead(true);
2742
2743 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
2703 { 2744 {
2704 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 2745 if (item.Value.Name == sound)
2705 { 2746 {
2706 if (item.Value.Name == sound) 2747 soundID = item.Value.ItemID;
2707 { 2748 break;
2708 soundID = item.Value.ItemID;
2709 break;
2710 }
2711 } 2749 }
2712 } 2750 }
2751
2752 TaskInventory.LockItemsForRead(false);
2713 } 2753 }
2714 2754
2715 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2755 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
@@ -2769,7 +2809,7 @@ namespace OpenSim.Region.Framework.Scenes
2769 /// <param name="scale"></param> 2809 /// <param name="scale"></param>
2770 public void Resize(Vector3 scale) 2810 public void Resize(Vector3 scale)
2771 { 2811 {
2772 StoreUndoState(); 2812 StoreUndoState(UndoType.STATE_PRIM_SCALE);
2773 m_shape.Scale = scale; 2813 m_shape.Scale = scale;
2774 2814
2775 ParentGroup.HasGroupChanged = true; 2815 ParentGroup.HasGroupChanged = true;
@@ -2778,38 +2818,7 @@ namespace OpenSim.Region.Framework.Scenes
2778 2818
2779 public void RotLookAt(Quaternion target, float strength, float damping) 2819 public void RotLookAt(Quaternion target, float strength, float damping)
2780 { 2820 {
2781 rotLookAt(target, strength, damping); 2821 m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup.
2782 }
2783
2784 public void rotLookAt(Quaternion target, float strength, float damping)
2785 {
2786 if (IsAttachment)
2787 {
2788 /*
2789 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
2790 if (avatar != null)
2791 {
2792 Rotate the Av?
2793 } */
2794 }
2795 else
2796 {
2797 APIDDamp = damping;
2798 APIDStrength = strength;
2799 APIDTarget = target;
2800 }
2801 }
2802
2803 public void startLookAt(Quaternion rot, float damp, float strength)
2804 {
2805 APIDDamp = damp;
2806 APIDStrength = strength;
2807 APIDTarget = rot;
2808 }
2809
2810 public void stopLookAt()
2811 {
2812 APIDTarget = Quaternion.Identity;
2813 } 2822 }
2814 2823
2815 /// <summary> 2824 /// <summary>
@@ -2821,7 +2830,10 @@ namespace OpenSim.Region.Framework.Scenes
2821 2830
2822 if (m_parentGroup != null) 2831 if (m_parentGroup != null)
2823 { 2832 {
2824 m_parentGroup.QueueForUpdateCheck(); 2833 if (!m_parentGroup.areUpdatesSuspended)
2834 {
2835 m_parentGroup.QueueForUpdateCheck();
2836 }
2825 } 2837 }
2826 2838
2827 int timeNow = Util.UnixTimeSinceEpoch(); 2839 int timeNow = Util.UnixTimeSinceEpoch();
@@ -3038,8 +3050,8 @@ namespace OpenSim.Region.Framework.Scenes
3038 { 3050 {
3039 const float ROTATION_TOLERANCE = 0.01f; 3051 const float ROTATION_TOLERANCE = 0.01f;
3040 const float VELOCITY_TOLERANCE = 0.001f; 3052 const float VELOCITY_TOLERANCE = 0.001f;
3041 const float POSITION_TOLERANCE = 0.05f; 3053 const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
3042 const int TIME_MS_TOLERANCE = 3000; 3054 const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
3043 3055
3044 if (m_updateFlag == 1) 3056 if (m_updateFlag == 1)
3045 { 3057 {
@@ -3053,7 +3065,7 @@ namespace OpenSim.Region.Framework.Scenes
3053 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 3065 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
3054 { 3066 {
3055 AddTerseUpdateToAllAvatars(); 3067 AddTerseUpdateToAllAvatars();
3056 ClearUpdateSchedule(); 3068
3057 3069
3058 // This causes the Scene to 'poll' physical objects every couple of frames 3070 // This causes the Scene to 'poll' physical objects every couple of frames
3059 // bad, so it's been replaced by an event driven method. 3071 // bad, so it's been replaced by an event driven method.
@@ -3071,16 +3083,18 @@ namespace OpenSim.Region.Framework.Scenes
3071 m_lastAngularVelocity = AngularVelocity; 3083 m_lastAngularVelocity = AngularVelocity;
3072 m_lastTerseSent = Environment.TickCount; 3084 m_lastTerseSent = Environment.TickCount;
3073 } 3085 }
3086 //Moved this outside of the if clause so updates don't get blocked.. *sigh*
3087 m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
3074 } 3088 }
3075 else 3089 else
3076 { 3090 {
3077 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes 3091 if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
3078 { 3092 {
3079 AddFullUpdateToAllAvatars(); 3093 AddFullUpdateToAllAvatars();
3080 ClearUpdateSchedule(); 3094 m_updateFlag = 0; //Same here
3081 } 3095 }
3082 } 3096 }
3083 ClearUpdateSchedule(); 3097 m_updateFlag = 0;
3084 } 3098 }
3085 3099
3086 /// <summary> 3100 /// <summary>
@@ -3108,17 +3122,16 @@ namespace OpenSim.Region.Framework.Scenes
3108 if (!UUID.TryParse(sound, out soundID)) 3122 if (!UUID.TryParse(sound, out soundID))
3109 { 3123 {
3110 // search sound file from inventory 3124 // search sound file from inventory
3111 lock (TaskInventory) 3125 TaskInventory.LockItemsForRead(true);
3126 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory)
3112 { 3127 {
3113 foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) 3128 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound)
3114 { 3129 {
3115 if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) 3130 soundID = item.Value.ItemID;
3116 { 3131 break;
3117 soundID = item.Value.ItemID;
3118 break;
3119 }
3120 } 3132 }
3121 } 3133 }
3134 TaskInventory.LockItemsForRead(false);
3122 } 3135 }
3123 3136
3124 if (soundID == UUID.Zero) 3137 if (soundID == UUID.Zero)
@@ -3555,7 +3568,7 @@ namespace OpenSim.Region.Framework.Scenes
3555 3568
3556 public void StopLookAt() 3569 public void StopLookAt()
3557 { 3570 {
3558 m_parentGroup.stopLookAt(); 3571 m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup.
3559 3572
3560 m_parentGroup.ScheduleGroupForTerseUpdate(); 3573 m_parentGroup.ScheduleGroupForTerseUpdate();
3561 } 3574 }
@@ -3582,10 +3595,9 @@ namespace OpenSim.Region.Framework.Scenes
3582 m_parentGroup.ScheduleGroupForTerseUpdate(); 3595 m_parentGroup.ScheduleGroupForTerseUpdate();
3583 //m_parentGroup.ScheduleGroupForFullUpdate(); 3596 //m_parentGroup.ScheduleGroupForFullUpdate();
3584 } 3597 }
3585 3598 public void StoreUndoState(UndoType type)
3586 public void StoreUndoState()
3587 { 3599 {
3588 if (!Undoing) 3600 if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing))
3589 { 3601 {
3590 if (!IgnoreUndoUpdate) 3602 if (!IgnoreUndoUpdate)
3591 { 3603 {
@@ -3596,17 +3608,25 @@ namespace OpenSim.Region.Framework.Scenes
3596 if (m_undo.Count > 0) 3608 if (m_undo.Count > 0)
3597 { 3609 {
3598 UndoState last = m_undo.Peek(); 3610 UndoState last = m_undo.Peek();
3599 if (last != null) 3611
3600 {
3601 if (last.Compare(this))
3602 return;
3603 }
3604 } 3612 }
3605 3613
3606 if (m_parentGroup.GetSceneMaxUndo() > 0) 3614 if (m_parentGroup.GetSceneMaxUndo() > 0)
3607 { 3615 {
3608 UndoState nUndo = new UndoState(this); 3616 UndoState lastUndo = m_undo.Peek();
3609 3617
3618 UndoState nUndo = new UndoState(this, type);
3619
3620 if (lastUndo != null)
3621 {
3622 TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated);
3623 if (ts.TotalMilliseconds < 500)
3624 {
3625 //Delete the last entry since it was less than 500 milliseconds ago
3626 nUndo.Merge(lastUndo);
3627 m_undo.Pop();
3628 }
3629 }
3610 m_undo.Push(nUndo); 3630 m_undo.Push(nUndo);
3611 } 3631 }
3612 3632
@@ -4083,11 +4103,13 @@ namespace OpenSim.Region.Framework.Scenes
4083 if (m_undo.Count > 0) 4103 if (m_undo.Count > 0)
4084 { 4104 {
4085 UndoState nUndo = null; 4105 UndoState nUndo = null;
4106 UndoState goback = m_undo.Pop();
4086 if (m_parentGroup.GetSceneMaxUndo() > 0) 4107 if (m_parentGroup.GetSceneMaxUndo() > 0)
4087 { 4108 {
4088 nUndo = new UndoState(this); 4109 nUndo = new UndoState(this, goback.Type);
4089 } 4110 }
4090 UndoState goback = m_undo.Pop(); 4111
4112
4091 if (goback != null) 4113 if (goback != null)
4092 { 4114 {
4093 goback.PlaybackState(this); 4115 goback.PlaybackState(this);
@@ -4102,13 +4124,13 @@ namespace OpenSim.Region.Framework.Scenes
4102 { 4124 {
4103 lock (m_redo) 4125 lock (m_redo)
4104 { 4126 {
4127 UndoState gofwd = m_redo.Pop();
4105 if (m_parentGroup.GetSceneMaxUndo() > 0) 4128 if (m_parentGroup.GetSceneMaxUndo() > 0)
4106 { 4129 {
4107 UndoState nUndo = new UndoState(this); 4130 UndoState nUndo = new UndoState(this, gofwd.Type);
4108 4131
4109 m_undo.Push(nUndo); 4132 m_undo.Push(nUndo);
4110 } 4133 }
4111 UndoState gofwd = m_redo.Pop();
4112 if (gofwd != null) 4134 if (gofwd != null)
4113 gofwd.PlayfwdState(this); 4135 gofwd.PlayfwdState(this);
4114 } 4136 }
@@ -4556,8 +4578,9 @@ namespace OpenSim.Region.Framework.Scenes
4556 { 4578 {
4557 m_shape.TextureEntry = textureEntry; 4579 m_shape.TextureEntry = textureEntry;
4558 TriggerScriptChangedEvent(Changed.TEXTURE); 4580 TriggerScriptChangedEvent(Changed.TEXTURE);
4559 4581 m_updateFlag = 1;
4560 ParentGroup.HasGroupChanged = true; 4582 ParentGroup.HasGroupChanged = true;
4583
4561 //This is madness.. 4584 //This is madness..
4562 //ParentGroup.ScheduleGroupForFullUpdate(); 4585 //ParentGroup.ScheduleGroupForFullUpdate();
4563 //This is sparta 4586 //This is sparta
@@ -4790,5 +4813,17 @@ namespace OpenSim.Region.Framework.Scenes
4790 Color color = Color; 4813 Color color = Color;
4791 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); 4814 return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A));
4792 } 4815 }
4816
4817 public void ResetOwnerChangeFlag()
4818 {
4819 List<UUID> inv = Inventory.GetInventoryList();
4820
4821 foreach (UUID itemID in inv)
4822 {
4823 TaskInventoryItem item = Inventory.GetInventoryItem(itemID);
4824 item.OwnerChanged = false;
4825 Inventory.UpdateInventoryItem(item, false, false);
4826 }
4827 }
4793 } 4828 }
4794} 4829}