diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 242 |
1 files changed, 137 insertions, 105 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e331bb0..032fbe8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
147 | 147 | ||
148 | // TODO: This needs to be persisted in next XML version update! | 148 | // TODO: This needs to be persisted in next XML version update! |
149 | [XmlIgnore] | 149 | [XmlIgnore] |
150 | public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; | 150 | public int[] PayPrice = {-2,-2,-2,-2,-2}; |
151 | [XmlIgnore] | 151 | [XmlIgnore] |
152 | public PhysicsActor PhysActor; | 152 | public PhysicsActor PhysActor; |
153 | 153 | ||
@@ -182,6 +182,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
182 | [XmlIgnore] | 182 | [XmlIgnore] |
183 | public UUID FromFolderID; | 183 | public UUID FromFolderID; |
184 | 184 | ||
185 | // The following two are to hold the attachment data | ||
186 | // while an object is inworld | ||
187 | [XmlIgnore] | ||
188 | public byte AttachPoint = 0; | ||
189 | |||
190 | [XmlIgnore] | ||
191 | public Vector3 AttachOffset = Vector3.Zero; | ||
192 | |||
185 | [XmlIgnore] | 193 | [XmlIgnore] |
186 | public int STATUS_ROTATE_X; | 194 | public int STATUS_ROTATE_X; |
187 | 195 | ||
@@ -277,6 +285,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
277 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; | 285 | private Quaternion m_sitTargetOrientation = Quaternion.Identity; |
278 | private Vector3 m_sitTargetPosition; | 286 | private Vector3 m_sitTargetPosition; |
279 | private string m_sitAnimation = "SIT"; | 287 | private string m_sitAnimation = "SIT"; |
288 | private bool m_occupied; // KF if any av is sitting on this prim | ||
280 | private string m_text = String.Empty; | 289 | private string m_text = String.Empty; |
281 | private string m_touchName = String.Empty; | 290 | private string m_touchName = String.Empty; |
282 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); | 291 | private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); |
@@ -360,7 +369,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
360 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, | 369 | UUID ownerID, PrimitiveBaseShape shape, Vector3 groupPosition, |
361 | Quaternion rotationOffset, Vector3 offsetPosition) | 370 | Quaternion rotationOffset, Vector3 offsetPosition) |
362 | { | 371 | { |
363 | m_name = "Primitive"; | 372 | m_name = "Object"; |
364 | 373 | ||
365 | Rezzed = DateTime.UtcNow; | 374 | Rezzed = DateTime.UtcNow; |
366 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); | 375 | _creationDate = (int)Utils.DateTimeToUnixTime(Rezzed); |
@@ -456,12 +465,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
456 | } | 465 | } |
457 | 466 | ||
458 | /// <value> | 467 | /// <value> |
459 | /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes | 468 | /// Get the inventory list |
460 | /// </value> | 469 | /// </value> |
461 | public TaskInventoryDictionary TaskInventory | 470 | public TaskInventoryDictionary TaskInventory |
462 | { | 471 | { |
463 | get { return m_inventory.Items; } | 472 | get { |
464 | set { m_inventory.Items = value; } | 473 | return m_inventory.Items; |
474 | } | ||
475 | set { | ||
476 | m_inventory.Items = value; | ||
477 | } | ||
465 | } | 478 | } |
466 | 479 | ||
467 | public uint ObjectFlags | 480 | public uint ObjectFlags |
@@ -590,14 +603,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
590 | set { m_LoopSoundSlavePrims = value; } | 603 | set { m_LoopSoundSlavePrims = value; } |
591 | } | 604 | } |
592 | 605 | ||
593 | [XmlIgnore] | ||
594 | public Byte[] TextureAnimation | 606 | public Byte[] TextureAnimation |
595 | { | 607 | { |
596 | get { return m_TextureAnimation; } | 608 | get { return m_TextureAnimation; } |
597 | set { m_TextureAnimation = value; } | 609 | set { m_TextureAnimation = value; } |
598 | } | 610 | } |
599 | 611 | ||
600 | [XmlIgnore] | ||
601 | public Byte[] ParticleSystem | 612 | public Byte[] ParticleSystem |
602 | { | 613 | { |
603 | get { return m_particleSystem; } | 614 | get { return m_particleSystem; } |
@@ -651,7 +662,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
651 | set | 662 | set |
652 | { | 663 | { |
653 | m_groupPosition = value; | 664 | m_groupPosition = value; |
654 | |||
655 | PhysicsActor actor = PhysActor; | 665 | PhysicsActor actor = PhysActor; |
656 | if (actor != null) | 666 | if (actor != null) |
657 | { | 667 | { |
@@ -698,7 +708,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
698 | get { return m_offsetPosition; } | 708 | get { return m_offsetPosition; } |
699 | set | 709 | set |
700 | { | 710 | { |
701 | StoreUndoState(); | 711 | StoreUndoState(UndoType.STATE_PRIM_POSITION); |
702 | m_offsetPosition = value; | 712 | m_offsetPosition = value; |
703 | 713 | ||
704 | if (ParentGroup != null && !ParentGroup.IsDeleted) | 714 | if (ParentGroup != null && !ParentGroup.IsDeleted) |
@@ -712,6 +722,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
712 | // Tell the physics engines that this prim changed. | 722 | // Tell the physics engines that this prim changed. |
713 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); | 723 | m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); |
714 | } | 724 | } |
725 | |||
726 | List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); | ||
727 | foreach (ScenePresence av in avs) | ||
728 | { | ||
729 | av.SendFullUpdateToAllClients(); | ||
730 | } | ||
715 | } | 731 | } |
716 | } | 732 | } |
717 | } | 733 | } |
@@ -754,7 +770,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
754 | 770 | ||
755 | set | 771 | set |
756 | { | 772 | { |
757 | StoreUndoState(); | 773 | StoreUndoState(UndoType.STATE_PRIM_ROTATION); |
758 | m_rotationOffset = value; | 774 | m_rotationOffset = value; |
759 | 775 | ||
760 | PhysicsActor actor = PhysActor; | 776 | PhysicsActor actor = PhysActor; |
@@ -838,7 +854,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
838 | /// <summary></summary> | 854 | /// <summary></summary> |
839 | public Vector3 Acceleration | 855 | public Vector3 Acceleration |
840 | { | 856 | { |
841 | get { return m_acceleration; } | 857 | get |
858 | { | ||
859 | PhysicsActor actor = PhysActor; | ||
860 | if (actor != null) | ||
861 | { | ||
862 | m_acceleration = actor.Acceleration; | ||
863 | } | ||
864 | return m_acceleration; | ||
865 | } | ||
866 | |||
842 | set { m_acceleration = value; } | 867 | set { m_acceleration = value; } |
843 | } | 868 | } |
844 | 869 | ||
@@ -865,7 +890,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
865 | set | 890 | set |
866 | { | 891 | { |
867 | m_color = value; | 892 | m_color = value; |
868 | TriggerScriptChangedEvent(Changed.COLOR); | ||
869 | 893 | ||
870 | /* ScheduleFullUpdate() need not be called b/c after | 894 | /* ScheduleFullUpdate() need not be called b/c after |
871 | * setting the color, the text will be set, so then | 895 | * setting the color, the text will be set, so then |
@@ -944,7 +968,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
944 | get { return m_shape.Scale; } | 968 | get { return m_shape.Scale; } |
945 | set | 969 | set |
946 | { | 970 | { |
947 | StoreUndoState(); | 971 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
948 | if (m_shape != null) | 972 | if (m_shape != null) |
949 | { | 973 | { |
950 | m_shape.Scale = value; | 974 | m_shape.Scale = value; |
@@ -989,7 +1013,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
989 | if (IsAttachment) | 1013 | if (IsAttachment) |
990 | return GroupPosition; | 1014 | return GroupPosition; |
991 | 1015 | ||
992 | return m_offsetPosition + m_groupPosition; } | 1016 | // return m_offsetPosition + m_groupPosition; } |
1017 | return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored! | ||
993 | } | 1018 | } |
994 | 1019 | ||
995 | public SceneObjectGroup ParentGroup | 1020 | public SceneObjectGroup ParentGroup |
@@ -1140,6 +1165,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1140 | get { return _flags; } | 1165 | get { return _flags; } |
1141 | set { _flags = value; } | 1166 | set { _flags = value; } |
1142 | } | 1167 | } |
1168 | |||
1169 | [XmlIgnore] | ||
1170 | public bool IsOccupied // KF If an av is sittingon this prim | ||
1171 | { | ||
1172 | get { return m_occupied; } | ||
1173 | set { m_occupied = value; } | ||
1174 | } | ||
1143 | 1175 | ||
1144 | [XmlIgnore] | 1176 | [XmlIgnore] |
1145 | public UUID SitTargetAvatar | 1177 | public UUID SitTargetAvatar |
@@ -1215,14 +1247,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1215 | } | 1247 | } |
1216 | } | 1248 | } |
1217 | 1249 | ||
1218 | /// <summary> | ||
1219 | /// Clear all pending updates of parts to clients | ||
1220 | /// </summary> | ||
1221 | private void ClearUpdateSchedule() | ||
1222 | { | ||
1223 | m_updateFlag = 0; | ||
1224 | } | ||
1225 | |||
1226 | private void SendObjectPropertiesToClient(UUID AgentID) | 1250 | private void SendObjectPropertiesToClient(UUID AgentID) |
1227 | { | 1251 | { |
1228 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) | 1252 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) |
@@ -1473,14 +1497,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1473 | // or flexible | 1497 | // or flexible |
1474 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) | 1498 | if (!isPhantom && !IsAttachment && !(Shape.PathCurve == (byte) Extrusion.Flexible)) |
1475 | { | 1499 | { |
1476 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( | 1500 | try |
1477 | Name, | 1501 | { |
1478 | Shape, | 1502 | PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( |
1479 | AbsolutePosition, | 1503 | Name, |
1480 | Scale, | 1504 | Shape, |
1481 | RotationOffset, | 1505 | AbsolutePosition, |
1482 | RigidBody); | 1506 | Scale, |
1483 | 1507 | RotationOffset, | |
1508 | RigidBody); | ||
1509 | } | ||
1510 | catch | ||
1511 | { | ||
1512 | m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); | ||
1513 | PhysActor = null; | ||
1514 | } | ||
1484 | // Basic Physics returns null.. joy joy joy. | 1515 | // Basic Physics returns null.. joy joy joy. |
1485 | if (PhysActor != null) | 1516 | if (PhysActor != null) |
1486 | { | 1517 | { |
@@ -1508,7 +1539,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1508 | { | 1539 | { |
1509 | m_redo.Clear(); | 1540 | m_redo.Clear(); |
1510 | } | 1541 | } |
1511 | StoreUndoState(); | 1542 | StoreUndoState(UndoType.STATE_ALL); |
1512 | } | 1543 | } |
1513 | 1544 | ||
1514 | public byte ConvertScriptUintToByte(uint indata) | 1545 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1611,7 +1642,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1611 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1642 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1612 | part.Shape = shape; | 1643 | part.Shape = shape; |
1613 | 1644 | ||
1614 | part.Name = "Primitive"; | 1645 | part.Name = "Object"; |
1615 | part._ownerID = UUID.Random(); | 1646 | part._ownerID = UUID.Random(); |
1616 | 1647 | ||
1617 | return part; | 1648 | return part; |
@@ -1734,7 +1765,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1734 | // which stops client-side interpolation of deactivated joint proxy objects. | 1765 | // which stops client-side interpolation of deactivated joint proxy objects. |
1735 | } | 1766 | } |
1736 | 1767 | ||
1737 | if (!UsePhysics && !isNew) | 1768 | if (!UsePhysics) |
1738 | { | 1769 | { |
1739 | // reset velocity to 0 on physics switch-off. Without that, the client thinks the | 1770 | // reset velocity to 0 on physics switch-off. Without that, the client thinks the |
1740 | // prim still has velocity and continues to interpolate its position along the old | 1771 | // prim still has velocity and continues to interpolate its position along the old |
@@ -1969,12 +2000,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1969 | public Vector3 GetWorldPosition() | 2000 | public Vector3 GetWorldPosition() |
1970 | { | 2001 | { |
1971 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 2002 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
1972 | |||
1973 | Vector3 axPos = OffsetPosition; | 2003 | Vector3 axPos = OffsetPosition; |
1974 | |||
1975 | axPos *= parentRot; | 2004 | axPos *= parentRot; |
1976 | Vector3 translationOffsetPosition = axPos; | 2005 | Vector3 translationOffsetPosition = axPos; |
1977 | return GroupPosition + translationOffsetPosition; | 2006 | if(_parentID == 0) |
2007 | { | ||
2008 | return GroupPosition; | ||
2009 | } | ||
2010 | else | ||
2011 | { | ||
2012 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
2013 | } | ||
1978 | } | 2014 | } |
1979 | 2015 | ||
1980 | /// <summary> | 2016 | /// <summary> |
@@ -1985,7 +2021,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1985 | { | 2021 | { |
1986 | Quaternion newRot; | 2022 | Quaternion newRot; |
1987 | 2023 | ||
1988 | if (this.LinkNum == 0) | 2024 | if (this.LinkNum < 2) //KF Single or root prim |
1989 | { | 2025 | { |
1990 | newRot = RotationOffset; | 2026 | newRot = RotationOffset; |
1991 | } | 2027 | } |
@@ -2631,17 +2667,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2631 | //Trys to fetch sound id from prim's inventory. | 2667 | //Trys to fetch sound id from prim's inventory. |
2632 | //Prim's inventory doesn't support non script items yet | 2668 | //Prim's inventory doesn't support non script items yet |
2633 | 2669 | ||
2634 | lock (TaskInventory) | 2670 | TaskInventory.LockItemsForRead(true); |
2671 | |||
2672 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2635 | { | 2673 | { |
2636 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2674 | if (item.Value.Name == sound) |
2637 | { | 2675 | { |
2638 | if (item.Value.Name == sound) | 2676 | soundID = item.Value.ItemID; |
2639 | { | 2677 | break; |
2640 | soundID = item.Value.ItemID; | ||
2641 | break; | ||
2642 | } | ||
2643 | } | 2678 | } |
2644 | } | 2679 | } |
2680 | |||
2681 | TaskInventory.LockItemsForRead(false); | ||
2645 | } | 2682 | } |
2646 | 2683 | ||
2647 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2684 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2701,7 +2738,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2701 | /// <param name="scale"></param> | 2738 | /// <param name="scale"></param> |
2702 | public void Resize(Vector3 scale) | 2739 | public void Resize(Vector3 scale) |
2703 | { | 2740 | { |
2704 | StoreUndoState(); | 2741 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2705 | m_shape.Scale = scale; | 2742 | m_shape.Scale = scale; |
2706 | 2743 | ||
2707 | ParentGroup.HasGroupChanged = true; | 2744 | ParentGroup.HasGroupChanged = true; |
@@ -2710,38 +2747,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2710 | 2747 | ||
2711 | public void RotLookAt(Quaternion target, float strength, float damping) | 2748 | public void RotLookAt(Quaternion target, float strength, float damping) |
2712 | { | 2749 | { |
2713 | rotLookAt(target, strength, damping); | 2750 | m_parentGroup.rotLookAt(target, strength, damping); // This calls method in SceneObjectGroup. |
2714 | } | ||
2715 | |||
2716 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
2717 | { | ||
2718 | if (IsAttachment) | ||
2719 | { | ||
2720 | /* | ||
2721 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
2722 | if (avatar != null) | ||
2723 | { | ||
2724 | Rotate the Av? | ||
2725 | } */ | ||
2726 | } | ||
2727 | else | ||
2728 | { | ||
2729 | APIDDamp = damping; | ||
2730 | APIDStrength = strength; | ||
2731 | APIDTarget = target; | ||
2732 | } | ||
2733 | } | ||
2734 | |||
2735 | public void startLookAt(Quaternion rot, float damp, float strength) | ||
2736 | { | ||
2737 | APIDDamp = damp; | ||
2738 | APIDStrength = strength; | ||
2739 | APIDTarget = rot; | ||
2740 | } | ||
2741 | |||
2742 | public void stopLookAt() | ||
2743 | { | ||
2744 | APIDTarget = Quaternion.Identity; | ||
2745 | } | 2751 | } |
2746 | 2752 | ||
2747 | /// <summary> | 2753 | /// <summary> |
@@ -2753,7 +2759,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2753 | 2759 | ||
2754 | if (m_parentGroup != null) | 2760 | if (m_parentGroup != null) |
2755 | { | 2761 | { |
2756 | m_parentGroup.QueueForUpdateCheck(); | 2762 | if (!m_parentGroup.areUpdatesSuspended) |
2763 | { | ||
2764 | m_parentGroup.QueueForUpdateCheck(); | ||
2765 | } | ||
2757 | } | 2766 | } |
2758 | 2767 | ||
2759 | int timeNow = Util.UnixTimeSinceEpoch(); | 2768 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -2970,8 +2979,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2970 | { | 2979 | { |
2971 | const float ROTATION_TOLERANCE = 0.01f; | 2980 | const float ROTATION_TOLERANCE = 0.01f; |
2972 | const float VELOCITY_TOLERANCE = 0.001f; | 2981 | const float VELOCITY_TOLERANCE = 0.001f; |
2973 | const float POSITION_TOLERANCE = 0.05f; | 2982 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2974 | const int TIME_MS_TOLERANCE = 3000; | 2983 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2975 | 2984 | ||
2976 | if (m_updateFlag == 1) | 2985 | if (m_updateFlag == 1) |
2977 | { | 2986 | { |
@@ -2985,7 +2994,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2985 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2994 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2986 | { | 2995 | { |
2987 | AddTerseUpdateToAllAvatars(); | 2996 | AddTerseUpdateToAllAvatars(); |
2988 | ClearUpdateSchedule(); | 2997 | |
2989 | 2998 | ||
2990 | // This causes the Scene to 'poll' physical objects every couple of frames | 2999 | // This causes the Scene to 'poll' physical objects every couple of frames |
2991 | // bad, so it's been replaced by an event driven method. | 3000 | // bad, so it's been replaced by an event driven method. |
@@ -3003,16 +3012,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3003 | m_lastAngularVelocity = AngularVelocity; | 3012 | m_lastAngularVelocity = AngularVelocity; |
3004 | m_lastTerseSent = Environment.TickCount; | 3013 | m_lastTerseSent = Environment.TickCount; |
3005 | } | 3014 | } |
3015 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
3016 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
3006 | } | 3017 | } |
3007 | else | 3018 | else |
3008 | { | 3019 | { |
3009 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 3020 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3010 | { | 3021 | { |
3011 | AddFullUpdateToAllAvatars(); | 3022 | AddFullUpdateToAllAvatars(); |
3012 | ClearUpdateSchedule(); | 3023 | m_updateFlag = 0; //Same here |
3013 | } | 3024 | } |
3014 | } | 3025 | } |
3015 | ClearUpdateSchedule(); | 3026 | m_updateFlag = 0; |
3016 | } | 3027 | } |
3017 | 3028 | ||
3018 | /// <summary> | 3029 | /// <summary> |
@@ -3039,17 +3050,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3039 | if (!UUID.TryParse(sound, out soundID)) | 3050 | if (!UUID.TryParse(sound, out soundID)) |
3040 | { | 3051 | { |
3041 | // search sound file from inventory | 3052 | // search sound file from inventory |
3042 | lock (TaskInventory) | 3053 | TaskInventory.LockItemsForRead(true); |
3054 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3043 | { | 3055 | { |
3044 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3056 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3045 | { | 3057 | { |
3046 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3058 | soundID = item.Value.ItemID; |
3047 | { | 3059 | break; |
3048 | soundID = item.Value.ItemID; | ||
3049 | break; | ||
3050 | } | ||
3051 | } | 3060 | } |
3052 | } | 3061 | } |
3062 | TaskInventory.LockItemsForRead(false); | ||
3053 | } | 3063 | } |
3054 | 3064 | ||
3055 | if (soundID == UUID.Zero) | 3065 | if (soundID == UUID.Zero) |
@@ -3484,7 +3494,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3484 | 3494 | ||
3485 | public void StopLookAt() | 3495 | public void StopLookAt() |
3486 | { | 3496 | { |
3487 | m_parentGroup.stopLookAt(); | 3497 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3488 | 3498 | ||
3489 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3499 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3490 | } | 3500 | } |
@@ -3511,10 +3521,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3511 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3521 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3512 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3522 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3513 | } | 3523 | } |
3514 | 3524 | public void StoreUndoState(UndoType type) | |
3515 | public void StoreUndoState() | ||
3516 | { | 3525 | { |
3517 | if (!Undoing) | 3526 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3518 | { | 3527 | { |
3519 | if (!IgnoreUndoUpdate) | 3528 | if (!IgnoreUndoUpdate) |
3520 | { | 3529 | { |
@@ -3525,17 +3534,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3525 | if (m_undo.Count > 0) | 3534 | if (m_undo.Count > 0) |
3526 | { | 3535 | { |
3527 | UndoState last = m_undo.Peek(); | 3536 | UndoState last = m_undo.Peek(); |
3528 | if (last != null) | 3537 | |
3529 | { | ||
3530 | if (last.Compare(this)) | ||
3531 | return; | ||
3532 | } | ||
3533 | } | 3538 | } |
3534 | 3539 | ||
3535 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3540 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3536 | { | 3541 | { |
3537 | UndoState nUndo = new UndoState(this); | 3542 | UndoState lastUndo = m_undo.Peek(); |
3543 | |||
3544 | UndoState nUndo = new UndoState(this, type); | ||
3538 | 3545 | ||
3546 | if (lastUndo != null) | ||
3547 | { | ||
3548 | TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); | ||
3549 | if (ts.TotalMilliseconds < 500) | ||
3550 | { | ||
3551 | //Delete the last entry since it was less than 500 milliseconds ago | ||
3552 | nUndo.Merge(lastUndo); | ||
3553 | m_undo.Pop(); | ||
3554 | } | ||
3555 | } | ||
3539 | m_undo.Push(nUndo); | 3556 | m_undo.Push(nUndo); |
3540 | } | 3557 | } |
3541 | 3558 | ||
@@ -4012,11 +4029,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4012 | if (m_undo.Count > 0) | 4029 | if (m_undo.Count > 0) |
4013 | { | 4030 | { |
4014 | UndoState nUndo = null; | 4031 | UndoState nUndo = null; |
4032 | UndoState goback = m_undo.Pop(); | ||
4015 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4033 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4016 | { | 4034 | { |
4017 | nUndo = new UndoState(this); | 4035 | nUndo = new UndoState(this, goback.Type); |
4018 | } | 4036 | } |
4019 | UndoState goback = m_undo.Pop(); | 4037 | |
4038 | |||
4020 | if (goback != null) | 4039 | if (goback != null) |
4021 | { | 4040 | { |
4022 | goback.PlaybackState(this); | 4041 | goback.PlaybackState(this); |
@@ -4031,13 +4050,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4031 | { | 4050 | { |
4032 | lock (m_redo) | 4051 | lock (m_redo) |
4033 | { | 4052 | { |
4053 | UndoState gofwd = m_redo.Pop(); | ||
4034 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4054 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4035 | { | 4055 | { |
4036 | UndoState nUndo = new UndoState(this); | 4056 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4037 | 4057 | ||
4038 | m_undo.Push(nUndo); | 4058 | m_undo.Push(nUndo); |
4039 | } | 4059 | } |
4040 | UndoState gofwd = m_redo.Pop(); | ||
4041 | if (gofwd != null) | 4060 | if (gofwd != null) |
4042 | gofwd.PlayfwdState(this); | 4061 | gofwd.PlayfwdState(this); |
4043 | } | 4062 | } |
@@ -4485,8 +4504,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4485 | { | 4504 | { |
4486 | m_shape.TextureEntry = textureEntry; | 4505 | m_shape.TextureEntry = textureEntry; |
4487 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4506 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4488 | 4507 | m_updateFlag = 1; | |
4489 | ParentGroup.HasGroupChanged = true; | 4508 | ParentGroup.HasGroupChanged = true; |
4509 | |||
4490 | //This is madness.. | 4510 | //This is madness.. |
4491 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4511 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4492 | //This is sparta | 4512 | //This is sparta |
@@ -4731,5 +4751,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4731 | Color color = Color; | 4751 | Color color = Color; |
4732 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4752 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4733 | } | 4753 | } |
4754 | |||
4755 | public void ResetOwnerChangeFlag() | ||
4756 | { | ||
4757 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4758 | |||
4759 | foreach (UUID itemID in inv) | ||
4760 | { | ||
4761 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4762 | item.OwnerChanged = false; | ||
4763 | Inventory.UpdateInventoryItem(item); | ||
4764 | } | ||
4765 | } | ||
4734 | } | 4766 | } |
4735 | } | 4767 | } |