diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 150 |
1 files changed, 123 insertions, 27 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 8241e07..ab8f0c9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -105,6 +105,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
105 | private static readonly string m_getObjectCostPath = "0102/"; | 105 | private static readonly string m_getObjectCostPath = "0102/"; |
106 | private static readonly string m_ResourceCostSelectedPath = "0103/"; | 106 | private static readonly string m_ResourceCostSelectedPath = "0103/"; |
107 | private static readonly string m_UpdateAgentInformationPath = "0500/"; | 107 | private static readonly string m_UpdateAgentInformationPath = "0500/"; |
108 | private static readonly string m_animSetTaskUpdatePath = "0260/"; | ||
108 | 109 | ||
109 | // These are callbacks which will be setup by the scene so that we can update scene data when we | 110 | // These are callbacks which will be setup by the scene so that we can update scene data when we |
110 | // receive capability calls | 111 | // receive capability calls |
@@ -248,13 +249,31 @@ namespace OpenSim.Region.ClientStack.Linden | |||
248 | //m_capsHandlers["MapLayer"] = | 249 | //m_capsHandlers["MapLayer"] = |
249 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", | 250 | // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", |
250 | // capsBase + m_mapLayerPath, | 251 | // capsBase + m_mapLayerPath, |
251 | // GetMapLayer); | 252 | // GetMapLayer); |
253 | |||
254 | IRequestHandler getObjectPhysicsDataHandler | ||
255 | = new RestStreamHandler( | ||
256 | "POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData, "GetObjectPhysicsData", null); | ||
257 | m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); | ||
258 | |||
259 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); | ||
260 | m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); | ||
261 | IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); | ||
262 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); | ||
263 | |||
264 | |||
252 | IRequestHandler req | 265 | IRequestHandler req |
253 | = new RestStreamHandler( | 266 | = new RestStreamHandler( |
254 | "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null); | 267 | "POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory, "UpdateScript", null); |
255 | 268 | ||
256 | m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); | 269 | m_HostCapsObj.RegisterHandler("UpdateScriptTaskInventory", req); |
257 | m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); | 270 | m_HostCapsObj.RegisterHandler("UpdateScriptTask", req); |
271 | |||
272 | // IRequestHandler animSetRequestHandler | ||
273 | // = new RestStreamHandler( | ||
274 | // "POST", capsBase + m_animSetTaskUpdatePath, AnimSetTaskInventory, "UpdateScript", null); | ||
275 | |||
276 | // m_HostCapsObj.RegisterHandler("UpdateAnimSetTaskInventory", animSetRequestHandler); | ||
258 | } | 277 | } |
259 | catch (Exception e) | 278 | catch (Exception e) |
260 | { | 279 | { |
@@ -280,15 +299,15 @@ namespace OpenSim.Region.ClientStack.Linden | |||
280 | "POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory, "Update*", null); | 299 | "POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory, "Update*", null); |
281 | 300 | ||
282 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); | 301 | m_HostCapsObj.RegisterHandler("UpdateNotecardAgentInventory", req); |
302 | m_HostCapsObj.RegisterHandler("UpdateAnimSetAgentInventory", req); | ||
283 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); | 303 | m_HostCapsObj.RegisterHandler("UpdateScriptAgentInventory", req); |
284 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); | 304 | m_HostCapsObj.RegisterHandler("UpdateScriptAgent", req); |
285 | IRequestHandler getObjectPhysicsDataHandler = new RestStreamHandler("POST", capsBase + m_getObjectPhysicsDataPath, GetObjectPhysicsData); | 305 | |
286 | m_HostCapsObj.RegisterHandler("GetObjectPhysicsData", getObjectPhysicsDataHandler); | 306 | |
287 | IRequestHandler getObjectCostHandler = new RestStreamHandler("POST", capsBase + m_getObjectCostPath, GetObjectCost); | 307 | |
288 | m_HostCapsObj.RegisterHandler("GetObjectCost", getObjectCostHandler); | 308 | IRequestHandler UpdateAgentInformationHandler |
289 | IRequestHandler ResourceCostSelectedHandler = new RestStreamHandler("POST", capsBase + m_ResourceCostSelectedPath, ResourceCostSelected); | 309 | = new RestStreamHandler( |
290 | m_HostCapsObj.RegisterHandler("ResourceCostSelected", ResourceCostSelectedHandler); | 310 | "POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation, "UpdateAgentInformation", null); |
291 | IRequestHandler UpdateAgentInformationHandler = new RestStreamHandler("POST", capsBase + m_UpdateAgentInformationPath, UpdateAgentInformation); | ||
292 | m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); | 311 | m_HostCapsObj.RegisterHandler("UpdateAgentInformation", UpdateAgentInformationHandler); |
293 | 312 | ||
294 | m_HostCapsObj.RegisterHandler( | 313 | m_HostCapsObj.RegisterHandler( |
@@ -361,18 +380,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
361 | foreach (OSD c in capsRequested) | 380 | foreach (OSD c in capsRequested) |
362 | validCaps.Add(c.AsString()); | 381 | validCaps.Add(c.AsString()); |
363 | 382 | ||
364 | Hashtable caps = m_HostCapsObj.CapsHandlers.GetCapsDetails(true, validCaps); | 383 | string result = LLSDHelpers.SerialiseLLSDReply(m_HostCapsObj.GetCapsDetails(true, validCaps)); |
365 | |||
366 | // Add the external too | ||
367 | foreach (KeyValuePair<string, string> kvp in m_HostCapsObj.ExternalCapsHandlers) | ||
368 | { | ||
369 | if (!validCaps.Contains(kvp.Key)) | ||
370 | continue; | ||
371 | |||
372 | caps[kvp.Key] = kvp.Value; | ||
373 | } | ||
374 | |||
375 | string result = LLSDHelpers.SerialiseLLSDReply(caps); | ||
376 | 384 | ||
377 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); | 385 | //m_log.DebugFormat("[CAPS] CapsRequest {0}", result); |
378 | 386 | ||
@@ -530,6 +538,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
530 | 538 | ||
531 | if (llsdRequest.asset_type == "texture" || | 539 | if (llsdRequest.asset_type == "texture" || |
532 | llsdRequest.asset_type == "animation" || | 540 | llsdRequest.asset_type == "animation" || |
541 | llsdRequest.asset_type == "animatn" || // this is the asset name actually used by viewers | ||
533 | llsdRequest.asset_type == "mesh" || | 542 | llsdRequest.asset_type == "mesh" || |
534 | llsdRequest.asset_type == "sound") | 543 | llsdRequest.asset_type == "sound") |
535 | { | 544 | { |
@@ -571,6 +580,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
571 | string error; | 580 | string error; |
572 | int modelcost; | 581 | int modelcost; |
573 | 582 | ||
583 | |||
574 | if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, | 584 | if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, |
575 | meshcostdata, out error, ref warning)) | 585 | meshcostdata, out error, ref warning)) |
576 | { | 586 | { |
@@ -748,11 +758,21 @@ namespace OpenSim.Region.ClientStack.Linden | |||
748 | inType = (sbyte)InventoryType.Sound; | 758 | inType = (sbyte)InventoryType.Sound; |
749 | assType = (sbyte)AssetType.Sound; | 759 | assType = (sbyte)AssetType.Sound; |
750 | } | 760 | } |
761 | else if (inventoryType == "snapshot") | ||
762 | { | ||
763 | inType = (sbyte)InventoryType.Snapshot; | ||
764 | } | ||
751 | else if (inventoryType == "animation") | 765 | else if (inventoryType == "animation") |
752 | { | 766 | { |
753 | inType = (sbyte)InventoryType.Animation; | 767 | inType = (sbyte)InventoryType.Animation; |
754 | assType = (sbyte)AssetType.Animation; | 768 | assType = (sbyte)AssetType.Animation; |
755 | } | 769 | } |
770 | else if (inventoryType == "animset") | ||
771 | { | ||
772 | inType = (sbyte)CustomInventoryType.AnimationSet; | ||
773 | assType = (sbyte)CustomAssetType.AnimationSet; | ||
774 | m_log.Debug("got animset upload request"); | ||
775 | } | ||
756 | else if (inventoryType == "wearable") | 776 | else if (inventoryType == "wearable") |
757 | { | 777 | { |
758 | inType = (sbyte)InventoryType.Wearable; | 778 | inType = (sbyte)InventoryType.Wearable; |
@@ -778,7 +798,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
778 | OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); | 798 | OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); |
779 | 799 | ||
780 | // compare and get updated information | 800 | // compare and get updated information |
781 | 801 | /* does nothing still we do need something to avoid special viewer to upload something diferent from the cost estimation | |
782 | bool mismatchError = true; | 802 | bool mismatchError = true; |
783 | 803 | ||
784 | while (mismatchError) | 804 | while (mismatchError) |
@@ -794,7 +814,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
794 | 814 | ||
795 | return; | 815 | return; |
796 | } | 816 | } |
797 | 817 | */ | |
798 | OSDArray instance_list = (OSDArray)request["instance_list"]; | 818 | OSDArray instance_list = (OSDArray)request["instance_list"]; |
799 | OSDArray mesh_list = (OSDArray)request["mesh_list"]; | 819 | OSDArray mesh_list = (OSDArray)request["mesh_list"]; |
800 | OSDArray texture_list = (OSDArray)request["texture_list"]; | 820 | OSDArray texture_list = (OSDArray)request["texture_list"]; |
@@ -808,7 +828,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
808 | List<UUID> textures = new List<UUID>(); | 828 | List<UUID> textures = new List<UUID>(); |
809 | 829 | ||
810 | 830 | ||
811 | if (doTextInv) | 831 | // if (doTextInv) |
812 | m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); | 832 | m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); |
813 | 833 | ||
814 | if(client == null) // don't put textures in inventory if there is no client | 834 | if(client == null) // don't put textures in inventory if there is no client |
@@ -856,14 +876,73 @@ namespace OpenSim.Region.ClientStack.Linden | |||
856 | 876 | ||
857 | // create and store meshs assets | 877 | // create and store meshs assets |
858 | List<UUID> meshAssets = new List<UUID>(); | 878 | List<UUID> meshAssets = new List<UUID>(); |
879 | List<bool> meshAvatarSkeletons = new List<bool>(); | ||
880 | List<bool> meshAvatarColliders = new List<bool>(); | ||
881 | |||
882 | bool curAvSkeleton; | ||
883 | bool curAvCollider; | ||
859 | for (int i = 0; i < mesh_list.Count; i++) | 884 | for (int i = 0; i < mesh_list.Count; i++) |
860 | { | 885 | { |
886 | curAvSkeleton = false; | ||
887 | curAvCollider = false; | ||
888 | |||
889 | // we do need to parse the mesh now | ||
890 | OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]); | ||
891 | if (osd is OSDMap) | ||
892 | { | ||
893 | OSDMap mosd = (OSDMap)osd; | ||
894 | if (mosd.ContainsKey("skeleton")) | ||
895 | { | ||
896 | OSDMap skeleton = (OSDMap)mosd["skeleton"]; | ||
897 | int sksize = skeleton["size"].AsInteger(); | ||
898 | if (sksize > 0) | ||
899 | curAvSkeleton = true; | ||
900 | } | ||
901 | } | ||
902 | |||
861 | AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); | 903 | AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); |
862 | meshAsset.Data = mesh_list[i].AsBinary(); | 904 | meshAsset.Data = mesh_list[i].AsBinary(); |
863 | if (istest) | 905 | if (istest) |
864 | meshAsset.Local = true; | 906 | meshAsset.Local = true; |
865 | m_assetService.Store(meshAsset); | 907 | m_assetService.Store(meshAsset); |
866 | meshAssets.Add(meshAsset.FullID); | 908 | meshAssets.Add(meshAsset.FullID); |
909 | meshAvatarSkeletons.Add(curAvSkeleton); | ||
910 | meshAvatarColliders.Add(curAvCollider); | ||
911 | |||
912 | // test code | ||
913 | if (curAvSkeleton && client != null) | ||
914 | { | ||
915 | string name = assetName; | ||
916 | if (name.Length > 25) | ||
917 | name = name.Substring(0, 24); | ||
918 | name += "_Mesh#" + i.ToString(); | ||
919 | InventoryItemBase meshitem = new InventoryItemBase(); | ||
920 | meshitem.Owner = m_HostCapsObj.AgentID; | ||
921 | meshitem.CreatorId = creatorIDstr; | ||
922 | meshitem.CreatorData = String.Empty; | ||
923 | meshitem.ID = UUID.Random(); | ||
924 | meshitem.AssetID = meshAsset.FullID; | ||
925 | meshitem.Description = "mesh "; | ||
926 | meshitem.Name = name; | ||
927 | meshitem.AssetType = (int)AssetType.Mesh; | ||
928 | meshitem.InvType = (int)InventoryType.Mesh; | ||
929 | // meshitem.Folder = UUID.Zero; // send to default | ||
930 | |||
931 | meshitem.Folder = parentFolder; // dont let it go to folder Meshes that viewers dont show | ||
932 | |||
933 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current | ||
934 | // (owner) permissions. This becomes a problem if next permissions are changed. | ||
935 | meshitem.CurrentPermissions | ||
936 | = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); | ||
937 | |||
938 | meshitem.BasePermissions = (uint)PermissionMask.All; | ||
939 | meshitem.EveryOnePermissions = 0; | ||
940 | meshitem.NextPermissions = (uint)PermissionMask.All; | ||
941 | meshitem.CreationDate = Util.UnixTimeSinceEpoch(); | ||
942 | |||
943 | m_Scene.AddInventoryItem(client, meshitem); | ||
944 | meshitem = null; | ||
945 | } | ||
867 | } | 946 | } |
868 | 947 | ||
869 | int skipedMeshs = 0; | 948 | int skipedMeshs = 0; |
@@ -1104,7 +1183,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1104 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current | 1183 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current |
1105 | // (owner) permissions. This becomes a problem if next permissions are changed. | 1184 | // (owner) permissions. This becomes a problem if next permissions are changed. |
1106 | 1185 | ||
1107 | if (restrictPerms) | 1186 | if (inType == (sbyte)CustomInventoryType.AnimationSet) |
1187 | { | ||
1188 | AnimationSet.setCreateItemPermitions(item); | ||
1189 | } | ||
1190 | |||
1191 | else if (restrictPerms) | ||
1108 | { | 1192 | { |
1109 | item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); | 1193 | item.BasePermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); |
1110 | item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); | 1194 | item.CurrentPermissions = (uint)(PermissionMask.Move | PermissionMask.Modify); |
@@ -1380,6 +1464,17 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1380 | 1464 | ||
1381 | resp[uuid.ToString()] = object_data; | 1465 | resp[uuid.ToString()] = object_data; |
1382 | } | 1466 | } |
1467 | else | ||
1468 | { | ||
1469 | OSDMap object_data = new OSDMap(); | ||
1470 | object_data["linked_set_resource_cost"] = 0; | ||
1471 | object_data["resource_cost"] = 0; | ||
1472 | object_data["physics_cost"] = 0; | ||
1473 | object_data["linked_set_physics_cost"] = 0; | ||
1474 | |||
1475 | resp[uuid.ToString()] = object_data; | ||
1476 | } | ||
1477 | |||
1383 | } | 1478 | } |
1384 | } | 1479 | } |
1385 | 1480 | ||
@@ -1444,7 +1539,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1444 | } | 1539 | } |
1445 | } | 1540 | } |
1446 | 1541 | ||
1447 | if (simul != 0) | 1542 | // if (simul != 0) |
1448 | { | 1543 | { |
1449 | OSDMap object_data = new OSDMap(); | 1544 | OSDMap object_data = new OSDMap(); |
1450 | 1545 | ||
@@ -1505,7 +1600,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1505 | private int m_nreqmeshs; | 1600 | private int m_nreqmeshs; |
1506 | private int m_nreqinstances; | 1601 | private int m_nreqinstances; |
1507 | private bool m_IsAtestUpload; | 1602 | private bool m_IsAtestUpload; |
1508 | 1603 | ||
1509 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, | 1604 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, |
1510 | UUID parentFolderID, string invType, string assetType, string path, | 1605 | UUID parentFolderID, string invType, string assetType, string path, |
1511 | IHttpServer httpServer, bool dumpAssetsToFile, | 1606 | IHttpServer httpServer, bool dumpAssetsToFile, |
@@ -1573,7 +1668,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1573 | if (handlerUpLoad != null) | 1668 | if (handlerUpLoad != null) |
1574 | { | 1669 | { |
1575 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, | 1670 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, |
1576 | m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, ref m_error); | 1671 | m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, |
1672 | ref m_error); | ||
1577 | } | 1673 | } |
1578 | if (m_IsAtestUpload) | 1674 | if (m_IsAtestUpload) |
1579 | { | 1675 | { |