diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 219 |
1 files changed, 122 insertions, 97 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e331bb0..b19c443 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) |
@@ -1508,7 +1532,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1508 | { | 1532 | { |
1509 | m_redo.Clear(); | 1533 | m_redo.Clear(); |
1510 | } | 1534 | } |
1511 | StoreUndoState(); | 1535 | StoreUndoState(UndoType.STATE_ALL); |
1512 | } | 1536 | } |
1513 | 1537 | ||
1514 | public byte ConvertScriptUintToByte(uint indata) | 1538 | public byte ConvertScriptUintToByte(uint indata) |
@@ -1611,7 +1635,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1611 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); | 1635 | PrimitiveBaseShape shape = PrimitiveBaseShape.Create(); |
1612 | part.Shape = shape; | 1636 | part.Shape = shape; |
1613 | 1637 | ||
1614 | part.Name = "Primitive"; | 1638 | part.Name = "Object"; |
1615 | part._ownerID = UUID.Random(); | 1639 | part._ownerID = UUID.Random(); |
1616 | 1640 | ||
1617 | return part; | 1641 | return part; |
@@ -1734,7 +1758,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1734 | // which stops client-side interpolation of deactivated joint proxy objects. | 1758 | // which stops client-side interpolation of deactivated joint proxy objects. |
1735 | } | 1759 | } |
1736 | 1760 | ||
1737 | if (!UsePhysics && !isNew) | 1761 | if (!UsePhysics) |
1738 | { | 1762 | { |
1739 | // reset velocity to 0 on physics switch-off. Without that, the client thinks the | 1763 | // 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 | 1764 | // prim still has velocity and continues to interpolate its position along the old |
@@ -1969,12 +1993,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1969 | public Vector3 GetWorldPosition() | 1993 | public Vector3 GetWorldPosition() |
1970 | { | 1994 | { |
1971 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; | 1995 | Quaternion parentRot = ParentGroup.RootPart.RotationOffset; |
1972 | |||
1973 | Vector3 axPos = OffsetPosition; | 1996 | Vector3 axPos = OffsetPosition; |
1974 | |||
1975 | axPos *= parentRot; | 1997 | axPos *= parentRot; |
1976 | Vector3 translationOffsetPosition = axPos; | 1998 | Vector3 translationOffsetPosition = axPos; |
1977 | return GroupPosition + translationOffsetPosition; | 1999 | if(_parentID == 0) |
2000 | { | ||
2001 | return GroupPosition; | ||
2002 | } | ||
2003 | else | ||
2004 | { | ||
2005 | return ParentGroup.AbsolutePosition + translationOffsetPosition; //KF: Fix child prim position | ||
2006 | } | ||
1978 | } | 2007 | } |
1979 | 2008 | ||
1980 | /// <summary> | 2009 | /// <summary> |
@@ -1985,7 +2014,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1985 | { | 2014 | { |
1986 | Quaternion newRot; | 2015 | Quaternion newRot; |
1987 | 2016 | ||
1988 | if (this.LinkNum == 0) | 2017 | if (this.LinkNum < 2) //KF Single or root prim |
1989 | { | 2018 | { |
1990 | newRot = RotationOffset; | 2019 | newRot = RotationOffset; |
1991 | } | 2020 | } |
@@ -2631,17 +2660,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2631 | //Trys to fetch sound id from prim's inventory. | 2660 | //Trys to fetch sound id from prim's inventory. |
2632 | //Prim's inventory doesn't support non script items yet | 2661 | //Prim's inventory doesn't support non script items yet |
2633 | 2662 | ||
2634 | lock (TaskInventory) | 2663 | TaskInventory.LockItemsForRead(true); |
2664 | |||
2665 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
2635 | { | 2666 | { |
2636 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 2667 | if (item.Value.Name == sound) |
2637 | { | 2668 | { |
2638 | if (item.Value.Name == sound) | 2669 | soundID = item.Value.ItemID; |
2639 | { | 2670 | break; |
2640 | soundID = item.Value.ItemID; | ||
2641 | break; | ||
2642 | } | ||
2643 | } | 2671 | } |
2644 | } | 2672 | } |
2673 | |||
2674 | TaskInventory.LockItemsForRead(false); | ||
2645 | } | 2675 | } |
2646 | 2676 | ||
2647 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 2677 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
@@ -2701,7 +2731,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2701 | /// <param name="scale"></param> | 2731 | /// <param name="scale"></param> |
2702 | public void Resize(Vector3 scale) | 2732 | public void Resize(Vector3 scale) |
2703 | { | 2733 | { |
2704 | StoreUndoState(); | 2734 | StoreUndoState(UndoType.STATE_PRIM_SCALE); |
2705 | m_shape.Scale = scale; | 2735 | m_shape.Scale = scale; |
2706 | 2736 | ||
2707 | ParentGroup.HasGroupChanged = true; | 2737 | ParentGroup.HasGroupChanged = true; |
@@ -2710,38 +2740,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2710 | 2740 | ||
2711 | public void RotLookAt(Quaternion target, float strength, float damping) | 2741 | public void RotLookAt(Quaternion target, float strength, float damping) |
2712 | { | 2742 | { |
2713 | rotLookAt(target, strength, damping); | 2743 | 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 | } | 2744 | } |
2746 | 2745 | ||
2747 | /// <summary> | 2746 | /// <summary> |
@@ -2753,7 +2752,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2753 | 2752 | ||
2754 | if (m_parentGroup != null) | 2753 | if (m_parentGroup != null) |
2755 | { | 2754 | { |
2756 | m_parentGroup.QueueForUpdateCheck(); | 2755 | if (!m_parentGroup.areUpdatesSuspended) |
2756 | { | ||
2757 | m_parentGroup.QueueForUpdateCheck(); | ||
2758 | } | ||
2757 | } | 2759 | } |
2758 | 2760 | ||
2759 | int timeNow = Util.UnixTimeSinceEpoch(); | 2761 | int timeNow = Util.UnixTimeSinceEpoch(); |
@@ -2970,8 +2972,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2970 | { | 2972 | { |
2971 | const float ROTATION_TOLERANCE = 0.01f; | 2973 | const float ROTATION_TOLERANCE = 0.01f; |
2972 | const float VELOCITY_TOLERANCE = 0.001f; | 2974 | const float VELOCITY_TOLERANCE = 0.001f; |
2973 | const float POSITION_TOLERANCE = 0.05f; | 2975 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2974 | const int TIME_MS_TOLERANCE = 3000; | 2976 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2975 | 2977 | ||
2976 | if (m_updateFlag == 1) | 2978 | if (m_updateFlag == 1) |
2977 | { | 2979 | { |
@@ -2985,7 +2987,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2985 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2987 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2986 | { | 2988 | { |
2987 | AddTerseUpdateToAllAvatars(); | 2989 | AddTerseUpdateToAllAvatars(); |
2988 | ClearUpdateSchedule(); | 2990 | |
2989 | 2991 | ||
2990 | // This causes the Scene to 'poll' physical objects every couple of frames | 2992 | // This causes the Scene to 'poll' physical objects every couple of frames |
2991 | // bad, so it's been replaced by an event driven method. | 2993 | // bad, so it's been replaced by an event driven method. |
@@ -3003,16 +3005,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3003 | m_lastAngularVelocity = AngularVelocity; | 3005 | m_lastAngularVelocity = AngularVelocity; |
3004 | m_lastTerseSent = Environment.TickCount; | 3006 | m_lastTerseSent = Environment.TickCount; |
3005 | } | 3007 | } |
3008 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
3009 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
3006 | } | 3010 | } |
3007 | else | 3011 | else |
3008 | { | 3012 | { |
3009 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 3013 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
3010 | { | 3014 | { |
3011 | AddFullUpdateToAllAvatars(); | 3015 | AddFullUpdateToAllAvatars(); |
3012 | ClearUpdateSchedule(); | 3016 | m_updateFlag = 0; //Same here |
3013 | } | 3017 | } |
3014 | } | 3018 | } |
3015 | ClearUpdateSchedule(); | 3019 | m_updateFlag = 0; |
3016 | } | 3020 | } |
3017 | 3021 | ||
3018 | /// <summary> | 3022 | /// <summary> |
@@ -3039,17 +3043,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3039 | if (!UUID.TryParse(sound, out soundID)) | 3043 | if (!UUID.TryParse(sound, out soundID)) |
3040 | { | 3044 | { |
3041 | // search sound file from inventory | 3045 | // search sound file from inventory |
3042 | lock (TaskInventory) | 3046 | TaskInventory.LockItemsForRead(true); |
3047 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | ||
3043 | { | 3048 | { |
3044 | foreach (KeyValuePair<UUID, TaskInventoryItem> item in TaskInventory) | 3049 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) |
3045 | { | 3050 | { |
3046 | if (item.Value.Name == sound && item.Value.Type == (int)AssetType.Sound) | 3051 | soundID = item.Value.ItemID; |
3047 | { | 3052 | break; |
3048 | soundID = item.Value.ItemID; | ||
3049 | break; | ||
3050 | } | ||
3051 | } | 3053 | } |
3052 | } | 3054 | } |
3055 | TaskInventory.LockItemsForRead(false); | ||
3053 | } | 3056 | } |
3054 | 3057 | ||
3055 | if (soundID == UUID.Zero) | 3058 | if (soundID == UUID.Zero) |
@@ -3484,7 +3487,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3484 | 3487 | ||
3485 | public void StopLookAt() | 3488 | public void StopLookAt() |
3486 | { | 3489 | { |
3487 | m_parentGroup.stopLookAt(); | 3490 | m_parentGroup.stopLookAt(); // This calls method in SceneObjectGroup. |
3488 | 3491 | ||
3489 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3492 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3490 | } | 3493 | } |
@@ -3511,10 +3514,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3511 | m_parentGroup.ScheduleGroupForTerseUpdate(); | 3514 | m_parentGroup.ScheduleGroupForTerseUpdate(); |
3512 | //m_parentGroup.ScheduleGroupForFullUpdate(); | 3515 | //m_parentGroup.ScheduleGroupForFullUpdate(); |
3513 | } | 3516 | } |
3514 | 3517 | public void StoreUndoState(UndoType type) | |
3515 | public void StoreUndoState() | ||
3516 | { | 3518 | { |
3517 | if (!Undoing) | 3519 | if (!Undoing && (m_parentGroup == null || m_parentGroup.RootPart == null || !m_parentGroup.RootPart.Undoing)) |
3518 | { | 3520 | { |
3519 | if (!IgnoreUndoUpdate) | 3521 | if (!IgnoreUndoUpdate) |
3520 | { | 3522 | { |
@@ -3525,17 +3527,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3525 | if (m_undo.Count > 0) | 3527 | if (m_undo.Count > 0) |
3526 | { | 3528 | { |
3527 | UndoState last = m_undo.Peek(); | 3529 | UndoState last = m_undo.Peek(); |
3528 | if (last != null) | 3530 | |
3529 | { | ||
3530 | if (last.Compare(this)) | ||
3531 | return; | ||
3532 | } | ||
3533 | } | 3531 | } |
3534 | 3532 | ||
3535 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 3533 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
3536 | { | 3534 | { |
3537 | UndoState nUndo = new UndoState(this); | 3535 | UndoState lastUndo = m_undo.Peek(); |
3536 | |||
3537 | UndoState nUndo = new UndoState(this, type); | ||
3538 | 3538 | ||
3539 | if (lastUndo != null) | ||
3540 | { | ||
3541 | TimeSpan ts = DateTime.Now.Subtract(lastUndo.LastUpdated); | ||
3542 | if (ts.TotalMilliseconds < 500) | ||
3543 | { | ||
3544 | //Delete the last entry since it was less than 500 milliseconds ago | ||
3545 | nUndo.Merge(lastUndo); | ||
3546 | m_undo.Pop(); | ||
3547 | } | ||
3548 | } | ||
3539 | m_undo.Push(nUndo); | 3549 | m_undo.Push(nUndo); |
3540 | } | 3550 | } |
3541 | 3551 | ||
@@ -4012,11 +4022,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4012 | if (m_undo.Count > 0) | 4022 | if (m_undo.Count > 0) |
4013 | { | 4023 | { |
4014 | UndoState nUndo = null; | 4024 | UndoState nUndo = null; |
4025 | UndoState goback = m_undo.Pop(); | ||
4015 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4026 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4016 | { | 4027 | { |
4017 | nUndo = new UndoState(this); | 4028 | nUndo = new UndoState(this, goback.Type); |
4018 | } | 4029 | } |
4019 | UndoState goback = m_undo.Pop(); | 4030 | |
4031 | |||
4020 | if (goback != null) | 4032 | if (goback != null) |
4021 | { | 4033 | { |
4022 | goback.PlaybackState(this); | 4034 | goback.PlaybackState(this); |
@@ -4031,13 +4043,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4031 | { | 4043 | { |
4032 | lock (m_redo) | 4044 | lock (m_redo) |
4033 | { | 4045 | { |
4046 | UndoState gofwd = m_redo.Pop(); | ||
4034 | if (m_parentGroup.GetSceneMaxUndo() > 0) | 4047 | if (m_parentGroup.GetSceneMaxUndo() > 0) |
4035 | { | 4048 | { |
4036 | UndoState nUndo = new UndoState(this); | 4049 | UndoState nUndo = new UndoState(this, gofwd.Type); |
4037 | 4050 | ||
4038 | m_undo.Push(nUndo); | 4051 | m_undo.Push(nUndo); |
4039 | } | 4052 | } |
4040 | UndoState gofwd = m_redo.Pop(); | ||
4041 | if (gofwd != null) | 4053 | if (gofwd != null) |
4042 | gofwd.PlayfwdState(this); | 4054 | gofwd.PlayfwdState(this); |
4043 | } | 4055 | } |
@@ -4485,8 +4497,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4485 | { | 4497 | { |
4486 | m_shape.TextureEntry = textureEntry; | 4498 | m_shape.TextureEntry = textureEntry; |
4487 | TriggerScriptChangedEvent(Changed.TEXTURE); | 4499 | TriggerScriptChangedEvent(Changed.TEXTURE); |
4488 | 4500 | m_updateFlag = 1; | |
4489 | ParentGroup.HasGroupChanged = true; | 4501 | ParentGroup.HasGroupChanged = true; |
4502 | |||
4490 | //This is madness.. | 4503 | //This is madness.. |
4491 | //ParentGroup.ScheduleGroupForFullUpdate(); | 4504 | //ParentGroup.ScheduleGroupForFullUpdate(); |
4492 | //This is sparta | 4505 | //This is sparta |
@@ -4731,5 +4744,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
4731 | Color color = Color; | 4744 | Color color = Color; |
4732 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); | 4745 | return new Color4(color.R, color.G, color.B, (byte)(0xFF - color.A)); |
4733 | } | 4746 | } |
4747 | |||
4748 | public void ResetOwnerChangeFlag() | ||
4749 | { | ||
4750 | List<UUID> inv = Inventory.GetInventoryList(); | ||
4751 | |||
4752 | foreach (UUID itemID in inv) | ||
4753 | { | ||
4754 | TaskInventoryItem item = Inventory.GetInventoryItem(itemID); | ||
4755 | item.OwnerChanged = false; | ||
4756 | Inventory.UpdateInventoryItem(item); | ||
4757 | } | ||
4758 | } | ||
4734 | } | 4759 | } |
4735 | } | 4760 | } |