diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 99 |
1 files changed, 98 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index a3e26b4..b5e2c40 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1002,6 +1002,93 @@ namespace OpenSim.Region.Environment.Scenes | |||
1002 | } | 1002 | } |
1003 | } | 1003 | } |
1004 | } | 1004 | } |
1005 | public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID) | ||
1006 | { | ||
1007 | SceneObjectGroup objectGroup = grp; | ||
1008 | if (objectGroup != null) | ||
1009 | { | ||
1010 | string sceneObjectXml = objectGroup.ToXmlString(); | ||
1011 | |||
1012 | CachedUserInfo userInfo = | ||
1013 | CommsManager.UserProfileCacheService.GetUserDetails(agentID); | ||
1014 | if (userInfo != null) | ||
1015 | { | ||
1016 | Queue<InventoryFolderImpl> searchfolders = new Queue<InventoryFolderImpl>(); | ||
1017 | searchfolders.Enqueue(userInfo.RootFolder); | ||
1018 | |||
1019 | LLUUID foundFolder = userInfo.RootFolder.ID; | ||
1020 | |||
1021 | // search through folders to find the asset. | ||
1022 | while (searchfolders.Count > 0) | ||
1023 | { | ||
1024 | |||
1025 | InventoryFolderImpl fld = searchfolders.Dequeue(); | ||
1026 | lock (fld) | ||
1027 | { | ||
1028 | if (fld != null) | ||
1029 | { | ||
1030 | if (fld.Items.ContainsKey(assetID)) | ||
1031 | { | ||
1032 | foundFolder = fld.ID; | ||
1033 | searchfolders.Clear(); | ||
1034 | break; | ||
1035 | } | ||
1036 | else | ||
1037 | { | ||
1038 | foreach (InventoryFolderImpl subfld in fld.SubFolders.Values) | ||
1039 | { | ||
1040 | searchfolders.Enqueue(subfld); | ||
1041 | } | ||
1042 | } | ||
1043 | } | ||
1044 | } | ||
1045 | } | ||
1046 | AssetBase asset = CreateAsset( | ||
1047 | objectGroup.GetPartName(objectGroup.LocalId), | ||
1048 | objectGroup.GetPartDescription(objectGroup.LocalId), | ||
1049 | (sbyte)InventoryType.Object, | ||
1050 | (sbyte)AssetType.Object, | ||
1051 | Helpers.StringToField(sceneObjectXml)); | ||
1052 | AssetCache.AddAsset(asset); | ||
1053 | |||
1054 | InventoryItemBase item = new InventoryItemBase(); | ||
1055 | item.Creator = objectGroup.RootPart.CreatorID; | ||
1056 | item.Owner = agentID; | ||
1057 | item.ID = assetID; | ||
1058 | item.AssetID = asset.FullID; | ||
1059 | item.Description = asset.Description; | ||
1060 | item.Name = asset.Name; | ||
1061 | item.AssetType = asset.Type; | ||
1062 | item.InvType = asset.InvType; | ||
1063 | |||
1064 | // Sticking it in root folder for now.. objects folder later? | ||
1065 | |||
1066 | item.Folder = foundFolder;// DeRezPacket.AgentBlock.DestinationID; | ||
1067 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | ||
1068 | if (agentID != objectGroup.RootPart.OwnerID) | ||
1069 | { | ||
1070 | item.BasePermissions = objectGroup.RootPart.NextOwnerMask; | ||
1071 | item.CurrentPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1072 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1073 | } | ||
1074 | else | ||
1075 | { | ||
1076 | item.BasePermissions = objectGroup.RootPart.BaseMask; | ||
1077 | item.CurrentPermissions = objectGroup.RootPart.OwnerMask; | ||
1078 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
1079 | } | ||
1080 | |||
1081 | userInfo.AddItem(agentID, item); | ||
1082 | |||
1083 | // this gets called when the agent loggs off! | ||
1084 | if (remoteClient != null) | ||
1085 | { | ||
1086 | remoteClient.SendInventoryItemCreateUpdate(item); | ||
1087 | } | ||
1088 | |||
1089 | } | ||
1090 | } | ||
1091 | } | ||
1005 | public LLUUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID AgentId) | 1092 | public LLUUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID AgentId) |
1006 | { | 1093 | { |
1007 | SceneObjectGroup objectGroup = grp; | 1094 | SceneObjectGroup objectGroup = grp; |
@@ -1184,7 +1271,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
1184 | } | 1271 | } |
1185 | 1272 | ||
1186 | rootPart.TrimPermissions(); | 1273 | rootPart.TrimPermissions(); |
1187 | group.ApplyPhysics(m_physicalPrim); | 1274 | |
1275 | if (!attachment) | ||
1276 | { | ||
1277 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
1278 | { | ||
1279 | group.RootPart.Shape.State = (byte)0; | ||
1280 | } | ||
1281 | group.ApplyPhysics(m_physicalPrim); | ||
1282 | } | ||
1283 | |||
1284 | |||
1188 | group.StartScripts(); | 1285 | group.StartScripts(); |
1189 | 1286 | ||
1190 | 1287 | ||