diff options
author | Jonathan Freedman | 2010-11-21 20:01:48 -0800 |
---|---|---|
committer | Jonathan Freedman | 2010-11-21 20:01:48 -0800 |
commit | b7f5e8284360f92e0e102b9546076573c57d9397 (patch) | |
tree | 132663da8c1882e524241b55a739ef2758ef8958 /OpenSim/Region/Framework/Scenes | |
parent | Merge https://github.com/opensim/opensim into mantis5110 (diff) | |
parent | Merge branch 'master' of /var/git/opensim/ (diff) | |
download | opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.zip opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.tar.gz opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.tar.bz2 opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.tar.xz |
Merge branch 'master-core' into mantis5110
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
9 files changed, 182 insertions, 85 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4cc797b..a29b7f1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -426,6 +426,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
426 | InventoryItemBase itemCopy = new InventoryItemBase(); | 426 | InventoryItemBase itemCopy = new InventoryItemBase(); |
427 | itemCopy.Owner = recipient; | 427 | itemCopy.Owner = recipient; |
428 | itemCopy.CreatorId = item.CreatorId; | 428 | itemCopy.CreatorId = item.CreatorId; |
429 | itemCopy.CreatorData = item.CreatorData; | ||
429 | itemCopy.ID = UUID.Random(); | 430 | itemCopy.ID = UUID.Random(); |
430 | itemCopy.AssetID = item.AssetID; | 431 | itemCopy.AssetID = item.AssetID; |
431 | itemCopy.Description = item.Description; | 432 | itemCopy.Description = item.Description; |
@@ -699,13 +700,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
699 | if (remoteClient.AgentId == oldAgentID) | 700 | if (remoteClient.AgentId == oldAgentID) |
700 | { | 701 | { |
701 | CreateNewInventoryItem( | 702 | CreateNewInventoryItem( |
702 | remoteClient, item.CreatorId, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, | 703 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, |
703 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | 704 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); |
704 | } | 705 | } |
705 | else | 706 | else |
706 | { | 707 | { |
707 | CreateNewInventoryItem( | 708 | CreateNewInventoryItem( |
708 | remoteClient, item.CreatorId, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, | 709 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, |
709 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | 710 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); |
710 | } | 711 | } |
711 | } | 712 | } |
@@ -755,11 +756,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
755 | /// <param name="asset"></param> | 756 | /// <param name="asset"></param> |
756 | /// <param name="invType"></param> | 757 | /// <param name="invType"></param> |
757 | /// <param name="nextOwnerMask"></param> | 758 | /// <param name="nextOwnerMask"></param> |
758 | private void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID, | 759 | private void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, |
759 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | 760 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) |
760 | { | 761 | { |
761 | CreateNewInventoryItem( | 762 | CreateNewInventoryItem( |
762 | remoteClient, creatorID, folderID, name, flags, callbackID, asset, invType, | 763 | remoteClient, creatorID, creatorData, folderID, name, flags, callbackID, asset, invType, |
763 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); | 764 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); |
764 | } | 765 | } |
765 | 766 | ||
@@ -774,12 +775,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
774 | /// <param name="nextOwnerMask"></param> | 775 | /// <param name="nextOwnerMask"></param> |
775 | /// <param name="creationDate"></param> | 776 | /// <param name="creationDate"></param> |
776 | private void CreateNewInventoryItem( | 777 | private void CreateNewInventoryItem( |
777 | IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 778 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, |
778 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 779 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) |
779 | { | 780 | { |
780 | InventoryItemBase item = new InventoryItemBase(); | 781 | InventoryItemBase item = new InventoryItemBase(); |
781 | item.Owner = remoteClient.AgentId; | 782 | item.Owner = remoteClient.AgentId; |
782 | item.CreatorId = creatorID; | 783 | item.CreatorId = creatorID; |
784 | item.CreatorData = creatorData; | ||
783 | item.ID = UUID.Random(); | 785 | item.ID = UUID.Random(); |
784 | item.AssetID = asset.FullID; | 786 | item.AssetID = asset.FullID; |
785 | item.Description = asset.Description; | 787 | item.Description = asset.Description; |
@@ -859,7 +861,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
859 | AssetBase asset = CreateAsset(name, description, assetType, data, remoteClient.AgentId); | 861 | AssetBase asset = CreateAsset(name, description, assetType, data, remoteClient.AgentId); |
860 | AssetService.Store(asset); | 862 | AssetService.Store(asset); |
861 | 863 | ||
862 | CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); | 864 | CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); |
863 | } | 865 | } |
864 | else | 866 | else |
865 | { | 867 | { |
@@ -901,7 +903,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
901 | asset.Description = description; | 903 | asset.Description = description; |
902 | 904 | ||
903 | CreateNewInventoryItem( | 905 | CreateNewInventoryItem( |
904 | remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType, | 906 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType, |
905 | (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, | 907 | (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, |
906 | (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); | 908 | (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); |
907 | } | 909 | } |
@@ -1025,6 +1027,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1025 | 1027 | ||
1026 | agentItem.ID = UUID.Random(); | 1028 | agentItem.ID = UUID.Random(); |
1027 | agentItem.CreatorId = taskItem.CreatorID.ToString(); | 1029 | agentItem.CreatorId = taskItem.CreatorID.ToString(); |
1030 | agentItem.CreatorData = taskItem.CreatorData; | ||
1028 | agentItem.Owner = destAgent; | 1031 | agentItem.Owner = destAgent; |
1029 | agentItem.AssetID = taskItem.AssetID; | 1032 | agentItem.AssetID = taskItem.AssetID; |
1030 | agentItem.Description = taskItem.Description; | 1033 | agentItem.Description = taskItem.Description; |
@@ -1226,6 +1229,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1226 | 1229 | ||
1227 | destTaskItem.ItemID = UUID.Random(); | 1230 | destTaskItem.ItemID = UUID.Random(); |
1228 | destTaskItem.CreatorID = srcTaskItem.CreatorID; | 1231 | destTaskItem.CreatorID = srcTaskItem.CreatorID; |
1232 | destTaskItem.CreatorData = srcTaskItem.CreatorData; | ||
1229 | destTaskItem.AssetID = srcTaskItem.AssetID; | 1233 | destTaskItem.AssetID = srcTaskItem.AssetID; |
1230 | destTaskItem.GroupID = destPart.GroupID; | 1234 | destTaskItem.GroupID = destPart.GroupID; |
1231 | destTaskItem.OwnerID = destPart.OwnerID; | 1235 | destTaskItem.OwnerID = destPart.OwnerID; |
@@ -1638,6 +1642,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1638 | 1642 | ||
1639 | destTaskItem.ItemID = UUID.Random(); | 1643 | destTaskItem.ItemID = UUID.Random(); |
1640 | destTaskItem.CreatorID = srcTaskItem.CreatorID; | 1644 | destTaskItem.CreatorID = srcTaskItem.CreatorID; |
1645 | destTaskItem.CreatorData = srcTaskItem.CreatorData; | ||
1641 | destTaskItem.AssetID = srcTaskItem.AssetID; | 1646 | destTaskItem.AssetID = srcTaskItem.AssetID; |
1642 | destTaskItem.GroupID = destPart.GroupID; | 1647 | destTaskItem.GroupID = destPart.GroupID; |
1643 | destTaskItem.OwnerID = destPart.OwnerID; | 1648 | destTaskItem.OwnerID = destPart.OwnerID; |
@@ -1844,6 +1849,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1844 | 1849 | ||
1845 | InventoryItemBase item = new InventoryItemBase(); | 1850 | InventoryItemBase item = new InventoryItemBase(); |
1846 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | 1851 | item.CreatorId = grp.RootPart.CreatorID.ToString(); |
1852 | item.CreatorData = grp.RootPart.CreatorData; | ||
1847 | item.Owner = remoteClient.AgentId; | 1853 | item.Owner = remoteClient.AgentId; |
1848 | item.ID = UUID.Random(); | 1854 | item.ID = UUID.Random(); |
1849 | item.AssetID = asset.FullID; | 1855 | item.AssetID = asset.FullID; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 21c36d3..ab567fb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -462,22 +462,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
462 | ); | 462 | ); |
463 | } | 463 | } |
464 | 464 | ||
465 | public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) | ||
466 | { | ||
467 | if (LibraryService != null && (LibraryService.LibraryRootFolder.Owner == uuid)) | ||
468 | { | ||
469 | remote_client.SendNameReply(uuid, "Mr", "OpenSim"); | ||
470 | } | ||
471 | else | ||
472 | { | ||
473 | string[] names = GetUserNames(uuid); | ||
474 | if (names.Length == 2) | ||
475 | { | ||
476 | remote_client.SendNameReply(uuid, names[0], names[1]); | ||
477 | } | ||
478 | |||
479 | } | ||
480 | } | ||
481 | 465 | ||
482 | /// <summary> | 466 | /// <summary> |
483 | /// Handle a fetch inventory request from the client | 467 | /// Handle a fetch inventory request from the client |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3eb4f3e..55fca9b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -185,6 +185,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
185 | private Timer m_mapGenerationTimer = new Timer(); | 185 | private Timer m_mapGenerationTimer = new Timer(); |
186 | private bool m_generateMaptiles; | 186 | private bool m_generateMaptiles; |
187 | 187 | ||
188 | private Dictionary<UUID, string[]> m_UserNamesCache = new Dictionary<UUID, string[]>(); | ||
189 | |||
188 | #endregion Fields | 190 | #endregion Fields |
189 | 191 | ||
190 | #region Properties | 192 | #region Properties |
@@ -792,36 +794,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
792 | return m_simulatorVersion; | 794 | return m_simulatorVersion; |
793 | } | 795 | } |
794 | 796 | ||
795 | public string[] GetUserNames(UUID uuid) | ||
796 | { | ||
797 | string[] returnstring = new string[0]; | ||
798 | |||
799 | UserAccount account = UserAccountService.GetUserAccount(RegionInfo.ScopeID, uuid); | ||
800 | |||
801 | if (account != null) | ||
802 | { | ||
803 | returnstring = new string[2]; | ||
804 | returnstring[0] = account.FirstName; | ||
805 | returnstring[1] = account.LastName; | ||
806 | } | ||
807 | |||
808 | return returnstring; | ||
809 | } | ||
810 | |||
811 | public string GetUserName(UUID uuid) | ||
812 | { | ||
813 | string[] names = GetUserNames(uuid); | ||
814 | if (names.Length == 2) | ||
815 | { | ||
816 | string firstname = names[0]; | ||
817 | string lastname = names[1]; | ||
818 | |||
819 | return firstname + " " + lastname; | ||
820 | |||
821 | } | ||
822 | return "(hippos)"; | ||
823 | } | ||
824 | |||
825 | /// <summary> | 797 | /// <summary> |
826 | /// Another region is up. | 798 | /// Another region is up. |
827 | /// | 799 | /// |
@@ -2808,7 +2780,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2808 | 2780 | ||
2809 | public virtual void SubscribeToClientGridEvents(IClientAPI client) | 2781 | public virtual void SubscribeToClientGridEvents(IClientAPI client) |
2810 | { | 2782 | { |
2811 | client.OnNameFromUUIDRequest += HandleUUIDNameRequest; | 2783 | //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; |
2812 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 2784 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
2813 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; | 2785 | client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; |
2814 | client.OnSetStartLocationRequest += SetHomeRezPoint; | 2786 | client.OnSetStartLocationRequest += SetHomeRezPoint; |
@@ -2935,7 +2907,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2935 | 2907 | ||
2936 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) | 2908 | public virtual void UnSubscribeToClientGridEvents(IClientAPI client) |
2937 | { | 2909 | { |
2938 | client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; | 2910 | //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; |
2939 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; | 2911 | client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; |
2940 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; | 2912 | client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; |
2941 | client.OnSetStartLocationRequest -= SetHomeRezPoint; | 2913 | client.OnSetStartLocationRequest -= SetHomeRezPoint; |
@@ -3152,7 +3124,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3152 | List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles); | 3124 | List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles); |
3153 | regions.Remove(RegionInfo.RegionHandle); | 3125 | regions.Remove(RegionInfo.RegionHandle); |
3154 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3126 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3155 | |||
3156 | } | 3127 | } |
3157 | m_eventManager.TriggerClientClosed(agentID, this); | 3128 | m_eventManager.TriggerClientClosed(agentID, this); |
3158 | } | 3129 | } |
@@ -3164,6 +3135,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3164 | 3135 | ||
3165 | m_eventManager.TriggerOnRemovePresence(agentID); | 3136 | m_eventManager.TriggerOnRemovePresence(agentID); |
3166 | 3137 | ||
3138 | if (avatar != null && (!avatar.IsChildAgent)) | ||
3139 | avatar.SaveChangedAttachments(); | ||
3140 | |||
3167 | ForEachClient( | 3141 | ForEachClient( |
3168 | delegate(IClientAPI client) | 3142 | delegate(IClientAPI client) |
3169 | { | 3143 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 24d7334..032c859 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
259 | protected internal bool AddRestoredSceneObject( | 259 | protected internal bool AddRestoredSceneObject( |
260 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 260 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
261 | { | 261 | { |
262 | if (!alreadyPersisted) | 262 | if (attachToBackup && (!alreadyPersisted)) |
263 | { | 263 | { |
264 | sceneObject.ForceInventoryPersistence(); | 264 | sceneObject.ForceInventoryPersistence(); |
265 | sceneObject.HasGroupChanged = true; | 265 | sceneObject.HasGroupChanged = true; |
@@ -282,8 +282,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
282 | /// </returns> | 282 | /// </returns> |
283 | protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 283 | protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
284 | { | 284 | { |
285 | // Ensure that we persist this new scene object | 285 | // Ensure that we persist this new scene object if it's not an |
286 | sceneObject.HasGroupChanged = true; | 286 | // attachment |
287 | if (attachToBackup) | ||
288 | sceneObject.HasGroupChanged = true; | ||
287 | 289 | ||
288 | return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); | 290 | return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); |
289 | } | 291 | } |
@@ -1279,8 +1281,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1279 | { | 1281 | { |
1280 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) | 1282 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) |
1281 | { | 1283 | { |
1282 | if (m_parentScene.AttachmentsModule != null) | 1284 | // Set the new attachment point data in the object |
1283 | m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos); | 1285 | byte attachmentPoint = group.GetAttachmentPoint(); |
1286 | group.UpdateGroupPosition(pos); | ||
1287 | group.RootPart.IsAttachment = false; | ||
1288 | group.AbsolutePosition = group.RootPart.AttachedPos; | ||
1289 | group.SetAttachmentPoint(attachmentPoint); | ||
1290 | group.HasGroupChanged = true; | ||
1284 | } | 1291 | } |
1285 | else | 1292 | else |
1286 | { | 1293 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5f00f84..c2810b2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -491,13 +491,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
491 | XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); | 491 | XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); |
492 | if (nodes.Count > 0) | 492 | if (nodes.Count > 0) |
493 | { | 493 | { |
494 | m_savedScriptState = new Dictionary<UUID, string>(); | 494 | if (m_savedScriptState == null) |
495 | m_savedScriptState = new Dictionary<UUID, string>(); | ||
495 | foreach (XmlNode node in nodes) | 496 | foreach (XmlNode node in nodes) |
496 | { | 497 | { |
497 | if (node.Attributes["UUID"] != null) | 498 | if (node.Attributes["UUID"] != null) |
498 | { | 499 | { |
499 | UUID itemid = new UUID(node.Attributes["UUID"].Value); | 500 | UUID itemid = new UUID(node.Attributes["UUID"].Value); |
500 | m_savedScriptState.Add(itemid, node.InnerXml); | 501 | if (itemid != UUID.Zero) |
502 | m_savedScriptState[itemid] = node.InnerXml; | ||
501 | } | 503 | } |
502 | } | 504 | } |
503 | } | 505 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f164201..2155e26 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -435,6 +435,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
435 | private DateTime m_expires; | 435 | private DateTime m_expires; |
436 | private DateTime m_rezzed; | 436 | private DateTime m_rezzed; |
437 | private bool m_createSelected = false; | 437 | private bool m_createSelected = false; |
438 | private string m_creatorData = string.Empty; | ||
438 | 439 | ||
439 | public UUID CreatorID | 440 | public UUID CreatorID |
440 | { | 441 | { |
@@ -448,6 +449,61 @@ namespace OpenSim.Region.Framework.Scenes | |||
448 | } | 449 | } |
449 | } | 450 | } |
450 | 451 | ||
452 | public string CreatorData // = <profile url>;<name> | ||
453 | { | ||
454 | get { return m_creatorData; } | ||
455 | set { m_creatorData = value; } | ||
456 | } | ||
457 | |||
458 | /// <summary> | ||
459 | /// Used by the DB layer to retrieve / store the entire user identification. | ||
460 | /// The identification can either be a simple UUID or a string of the form | ||
461 | /// uuid[;profile_url[;name]] | ||
462 | /// </summary> | ||
463 | public string CreatorIdentification | ||
464 | { | ||
465 | get | ||
466 | { | ||
467 | if (m_creatorData != null && m_creatorData != string.Empty) | ||
468 | return _creatorID.ToString() + ';' + m_creatorData; | ||
469 | else | ||
470 | return _creatorID.ToString(); | ||
471 | } | ||
472 | set | ||
473 | { | ||
474 | if ((value == null) || (value != null && value == string.Empty)) | ||
475 | { | ||
476 | m_creatorData = string.Empty; | ||
477 | return; | ||
478 | } | ||
479 | |||
480 | if (!value.Contains(";")) // plain UUID | ||
481 | { | ||
482 | UUID uuid = UUID.Zero; | ||
483 | UUID.TryParse(value, out uuid); | ||
484 | _creatorID = uuid; | ||
485 | } | ||
486 | else // <uuid>[;<endpoint>[;name]] | ||
487 | { | ||
488 | string name = "Unknown User"; | ||
489 | string[] parts = value.Split(';'); | ||
490 | if (parts.Length >= 1) | ||
491 | { | ||
492 | UUID uuid = UUID.Zero; | ||
493 | UUID.TryParse(parts[0], out uuid); | ||
494 | _creatorID = uuid; | ||
495 | } | ||
496 | if (parts.Length >= 2) | ||
497 | m_creatorData = parts[1]; | ||
498 | if (parts.Length >= 3) | ||
499 | name = parts[2]; | ||
500 | |||
501 | m_creatorData += ';' + name; | ||
502 | |||
503 | } | ||
504 | } | ||
505 | } | ||
506 | |||
451 | /// <summary> | 507 | /// <summary> |
452 | /// A relic from when we we thought that prims contained folder objects. In | 508 | /// A relic from when we we thought that prims contained folder objects. In |
453 | /// reality, prim == folder | 509 | /// reality, prim == folder |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 0c5e62d..6a204c3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -127,8 +127,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
127 | if (0 == m_items.Count) | 127 | if (0 == m_items.Count) |
128 | return; | 128 | return; |
129 | 129 | ||
130 | HasInventoryChanged = true; | ||
131 | m_part.ParentGroup.HasGroupChanged = true; | ||
132 | IList<TaskInventoryItem> items = GetInventoryItems(); | 130 | IList<TaskInventoryItem> items = GetInventoryItems(); |
133 | m_items.Clear(); | 131 | m_items.Clear(); |
134 | 132 | ||
@@ -144,17 +142,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
144 | { | 142 | { |
145 | lock (Items) | 143 | lock (Items) |
146 | { | 144 | { |
147 | if (Items.Count == 0) | ||
148 | { | ||
149 | return; | ||
150 | } | ||
151 | |||
152 | HasInventoryChanged = true; | ||
153 | if (m_part.ParentGroup != null) | ||
154 | { | ||
155 | m_part.ParentGroup.HasGroupChanged = true; | ||
156 | } | ||
157 | |||
158 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 145 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); |
159 | Items.Clear(); | 146 | Items.Clear(); |
160 | 147 | ||
@@ -208,8 +195,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
208 | } | 195 | } |
209 | } | 196 | } |
210 | 197 | ||
211 | HasInventoryChanged = true; | 198 | // Don't let this set the HasGroupChanged flag for attachments |
212 | m_part.ParentGroup.HasGroupChanged = true; | 199 | // as this happens during rez and we don't want a new asset |
200 | // for each attachment each time | ||
201 | if (!m_part.ParentGroup.RootPart.IsAttachment) | ||
202 | { | ||
203 | HasInventoryChanged = true; | ||
204 | m_part.ParentGroup.HasGroupChanged = true; | ||
205 | } | ||
206 | |||
213 | List<TaskInventoryItem> items = GetInventoryItems(); | 207 | List<TaskInventoryItem> items = GetInventoryItems(); |
214 | foreach (TaskInventoryItem item in items) | 208 | foreach (TaskInventoryItem item in items) |
215 | { | 209 | { |
@@ -674,13 +668,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
674 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 668 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
675 | public bool UpdateInventoryItem(TaskInventoryItem item) | 669 | public bool UpdateInventoryItem(TaskInventoryItem item) |
676 | { | 670 | { |
677 | return UpdateInventoryItem(item, true); | 671 | return UpdateInventoryItem(item, true, true); |
678 | } | 672 | } |
679 | 673 | ||
680 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) | 674 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) |
681 | { | 675 | { |
676 | return UpdateInventoryItem(item, fireScriptEvents, true); | ||
677 | } | ||
678 | |||
679 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged) | ||
680 | { | ||
682 | TaskInventoryItem it = GetInventoryItem(item.ItemID); | 681 | TaskInventoryItem it = GetInventoryItem(item.ItemID); |
683 | if (it != null) | 682 | if (it != null) |
683 | |||
684 | { | 684 | { |
685 | item.ParentID = m_part.UUID; | 685 | item.ParentID = m_part.UUID; |
686 | item.ParentPartID = m_part.UUID; | 686 | item.ParentPartID = m_part.UUID; |
@@ -702,9 +702,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
702 | 702 | ||
703 | if (fireScriptEvents) | 703 | if (fireScriptEvents) |
704 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 704 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
705 | 705 | if (considerChanged) | |
706 | HasInventoryChanged = true; | 706 | { |
707 | m_part.ParentGroup.HasGroupChanged = true; | 707 | HasInventoryChanged = true; |
708 | m_part.ParentGroup.HasGroupChanged = true; | ||
709 | } | ||
708 | return true; | 710 | return true; |
709 | } | 711 | } |
710 | else | 712 | else |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2e58a46..4526a59 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3746,5 +3746,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
3746 | m_reprioritization_called = false; | 3746 | m_reprioritization_called = false; |
3747 | } | 3747 | } |
3748 | } | 3748 | } |
3749 | |||
3750 | public void SaveChangedAttachments() | ||
3751 | { | ||
3752 | // Need to copy this list because DetachToInventoryPrep mods it | ||
3753 | List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(Attachments.ToArray()); | ||
3754 | |||
3755 | IAttachmentsModule attachmentsModule = m_scene.AttachmentsModule; | ||
3756 | if (attachmentsModule != null) | ||
3757 | { | ||
3758 | foreach (SceneObjectGroup grp in attachments) | ||
3759 | { | ||
3760 | if (grp.HasGroupChanged) // Resizer scripts? | ||
3761 | { | ||
3762 | grp.RootPart.IsAttachment = false; | ||
3763 | grp.AbsolutePosition = grp.RootPart.AttachedPos; | ||
3764 | // grp.DetachToInventoryPrep(); | ||
3765 | attachmentsModule.UpdateKnownItem(ControllingClient, | ||
3766 | grp, grp.GetFromItemID(), grp.OwnerID); | ||
3767 | grp.RootPart.IsAttachment = true; | ||
3768 | } | ||
3769 | } | ||
3770 | } | ||
3771 | } | ||
3749 | } | 3772 | } |
3750 | } | 3773 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 7f37878..9cf5a39 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -34,6 +34,7 @@ using System.Xml; | |||
34 | using log4net; | 34 | using log4net; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
38 | 39 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Serialization | 40 | namespace OpenSim.Region.Framework.Scenes.Serialization |
@@ -46,6 +47,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
46 | public class SceneObjectSerializer | 47 | public class SceneObjectSerializer |
47 | { | 48 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | |||
51 | private static IUserManagement m_UserManagement; | ||
49 | 52 | ||
50 | /// <summary> | 53 | /// <summary> |
51 | /// Deserialize a scene object from the original xml format | 54 | /// Deserialize a scene object from the original xml format |
@@ -270,6 +273,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
270 | #region SOPXmlProcessors initialization | 273 | #region SOPXmlProcessors initialization |
271 | m_SOPXmlProcessors.Add("AllowedDrop", ProcessAllowedDrop); | 274 | m_SOPXmlProcessors.Add("AllowedDrop", ProcessAllowedDrop); |
272 | m_SOPXmlProcessors.Add("CreatorID", ProcessCreatorID); | 275 | m_SOPXmlProcessors.Add("CreatorID", ProcessCreatorID); |
276 | m_SOPXmlProcessors.Add("CreatorData", ProcessCreatorData); | ||
273 | m_SOPXmlProcessors.Add("FolderID", ProcessFolderID); | 277 | m_SOPXmlProcessors.Add("FolderID", ProcessFolderID); |
274 | m_SOPXmlProcessors.Add("InventorySerial", ProcessInventorySerial); | 278 | m_SOPXmlProcessors.Add("InventorySerial", ProcessInventorySerial); |
275 | m_SOPXmlProcessors.Add("TaskInventory", ProcessTaskInventory); | 279 | m_SOPXmlProcessors.Add("TaskInventory", ProcessTaskInventory); |
@@ -327,6 +331,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
327 | m_TaskInventoryXmlProcessors.Add("BasePermissions", ProcessTIBasePermissions); | 331 | m_TaskInventoryXmlProcessors.Add("BasePermissions", ProcessTIBasePermissions); |
328 | m_TaskInventoryXmlProcessors.Add("CreationDate", ProcessTICreationDate); | 332 | m_TaskInventoryXmlProcessors.Add("CreationDate", ProcessTICreationDate); |
329 | m_TaskInventoryXmlProcessors.Add("CreatorID", ProcessTICreatorID); | 333 | m_TaskInventoryXmlProcessors.Add("CreatorID", ProcessTICreatorID); |
334 | m_TaskInventoryXmlProcessors.Add("CreatorData", ProcessTICreatorData); | ||
330 | m_TaskInventoryXmlProcessors.Add("Description", ProcessTIDescription); | 335 | m_TaskInventoryXmlProcessors.Add("Description", ProcessTIDescription); |
331 | m_TaskInventoryXmlProcessors.Add("EveryonePermissions", ProcessTIEveryonePermissions); | 336 | m_TaskInventoryXmlProcessors.Add("EveryonePermissions", ProcessTIEveryonePermissions); |
332 | m_TaskInventoryXmlProcessors.Add("Flags", ProcessTIFlags); | 337 | m_TaskInventoryXmlProcessors.Add("Flags", ProcessTIFlags); |
@@ -412,6 +417,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
412 | obj.CreatorID = ReadUUID(reader, "CreatorID"); | 417 | obj.CreatorID = ReadUUID(reader, "CreatorID"); |
413 | } | 418 | } |
414 | 419 | ||
420 | private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader) | ||
421 | { | ||
422 | obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); | ||
423 | } | ||
424 | |||
415 | private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) | 425 | private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) |
416 | { | 426 | { |
417 | obj.FolderID = ReadUUID(reader, "FolderID"); | 427 | obj.FolderID = ReadUUID(reader, "FolderID"); |
@@ -698,6 +708,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
698 | item.CreatorID = ReadUUID(reader, "CreatorID"); | 708 | item.CreatorID = ReadUUID(reader, "CreatorID"); |
699 | } | 709 | } |
700 | 710 | ||
711 | private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) | ||
712 | { | ||
713 | item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); | ||
714 | } | ||
715 | |||
701 | private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader) | 716 | private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader) |
702 | { | 717 | { |
703 | item.Description = reader.ReadElementContentAsString("Description", String.Empty); | 718 | item.Description = reader.ReadElementContentAsString("Description", String.Empty); |
@@ -735,7 +750,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
735 | 750 | ||
736 | private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) | 751 | private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) |
737 | { | 752 | { |
738 | item.OldItemID = ReadUUID(reader, "OldItemID"); | 753 | ReadUUID(reader, "OldItemID"); |
754 | // On deserialization, the old item id MUST BE UUID.Zero!!!!! | ||
755 | // Setting this to the saved value will BREAK script persistence! | ||
756 | // item.OldItemID = ReadUUID(reader, "OldItemID"); | ||
739 | } | 757 | } |
740 | 758 | ||
741 | private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) | 759 | private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) |
@@ -1074,11 +1092,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1074 | writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); | 1092 | writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); |
1075 | 1093 | ||
1076 | writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower()); | 1094 | writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower()); |
1095 | |||
1077 | WriteUUID(writer, "CreatorID", sop.CreatorID, options); | 1096 | WriteUUID(writer, "CreatorID", sop.CreatorID, options); |
1097 | |||
1098 | if (sop.CreatorData != null && sop.CreatorData != string.Empty) | ||
1099 | writer.WriteElementString("CreatorData", sop.CreatorData); | ||
1100 | else if (options.ContainsKey("profile")) | ||
1101 | { | ||
1102 | if (m_UserManagement == null) | ||
1103 | m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); | ||
1104 | string name = m_UserManagement.GetUserName(sop.CreatorID); | ||
1105 | writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + sop.CreatorID + ";" + name); | ||
1106 | } | ||
1107 | |||
1078 | WriteUUID(writer, "FolderID", sop.FolderID, options); | 1108 | WriteUUID(writer, "FolderID", sop.FolderID, options); |
1079 | writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); | 1109 | writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); |
1080 | 1110 | ||
1081 | WriteTaskInventory(writer, sop.TaskInventory, options); | 1111 | WriteTaskInventory(writer, sop.TaskInventory, options, sop.ParentGroup.Scene); |
1082 | 1112 | ||
1083 | WriteUUID(writer, "UUID", sop.UUID, options); | 1113 | WriteUUID(writer, "UUID", sop.UUID, options); |
1084 | writer.WriteElementString("LocalId", sop.LocalId.ToString()); | 1114 | writer.WriteElementString("LocalId", sop.LocalId.ToString()); |
@@ -1202,7 +1232,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1202 | writer.WriteElementString(name, flagsStr); | 1232 | writer.WriteElementString(name, flagsStr); |
1203 | } | 1233 | } |
1204 | 1234 | ||
1205 | static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options) | 1235 | static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene) |
1206 | { | 1236 | { |
1207 | if (tinv.Count > 0) // otherwise skip this | 1237 | if (tinv.Count > 0) // otherwise skip this |
1208 | { | 1238 | { |
@@ -1215,7 +1245,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1215 | WriteUUID(writer, "AssetID", item.AssetID, options); | 1245 | WriteUUID(writer, "AssetID", item.AssetID, options); |
1216 | writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); | 1246 | writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); |
1217 | writer.WriteElementString("CreationDate", item.CreationDate.ToString()); | 1247 | writer.WriteElementString("CreationDate", item.CreationDate.ToString()); |
1248 | |||
1249 | |||
1218 | WriteUUID(writer, "CreatorID", item.CreatorID, options); | 1250 | WriteUUID(writer, "CreatorID", item.CreatorID, options); |
1251 | |||
1252 | if (item.CreatorData != null && item.CreatorData != string.Empty) | ||
1253 | writer.WriteElementString("CreatorData", item.CreatorData); | ||
1254 | else if (options.ContainsKey("profile")) | ||
1255 | { | ||
1256 | if (m_UserManagement == null) | ||
1257 | m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); | ||
1258 | string name = m_UserManagement.GetUserName(item.CreatorID); | ||
1259 | writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + item.CreatorID + ";" + name); | ||
1260 | } | ||
1261 | |||
1219 | writer.WriteElementString("Description", item.Description); | 1262 | writer.WriteElementString("Description", item.Description); |
1220 | writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); | 1263 | writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); |
1221 | writer.WriteElementString("Flags", item.Flags.ToString()); | 1264 | writer.WriteElementString("Flags", item.Flags.ToString()); |