aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs68
1 files changed, 62 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 75634e0..3a070c3 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.Linden
58 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, 58 string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder,
59 byte[] data, string inventoryType, string assetType, 59 byte[] data, string inventoryType, string assetType,
60 int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, 60 int cost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
61 bool IsAtestUpload, ref string error); 61 bool IsAtestUpload, bool avatarSkeleton, bool avatarCollider, ref string error);
62 62
63 public delegate UUID UpdateItem(UUID itemID, byte[] data); 63 public delegate UUID UpdateItem(UUID itemID, byte[] data);
64 64
@@ -531,6 +531,8 @@ namespace OpenSim.Region.ClientStack.Linden
531 int nreqmeshs= 0; 531 int nreqmeshs= 0;
532 int nreqinstances = 0; 532 int nreqinstances = 0;
533 bool IsAtestUpload = false; 533 bool IsAtestUpload = false;
534 bool avatarSkeleton = false;
535 bool avatarCollider = false;
534 536
535 string assetName = llsdRequest.name; 537 string assetName = llsdRequest.name;
536 538
@@ -580,8 +582,9 @@ namespace OpenSim.Region.ClientStack.Linden
580 string error; 582 string error;
581 int modelcost; 583 int modelcost;
582 584
585
583 if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, 586 if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost,
584 meshcostdata, out error, ref warning)) 587 meshcostdata,out avatarSkeleton, out avatarCollider, out error, ref warning))
585 { 588 {
586 LLSDAssetUploadError resperror = new LLSDAssetUploadError(); 589 LLSDAssetUploadError resperror = new LLSDAssetUploadError();
587 resperror.message = error; 590 resperror.message = error;
@@ -664,7 +667,7 @@ namespace OpenSim.Region.ClientStack.Linden
664 AssetUploader uploader = 667 AssetUploader uploader =
665 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, 668 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
666 llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, 669 llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost,
667 texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload); 670 texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload, avatarSkeleton, avatarCollider);
668 671
669 m_HostCapsObj.HttpListener.AddStreamHandler( 672 m_HostCapsObj.HttpListener.AddStreamHandler(
670 new BinaryStreamHandler( 673 new BinaryStreamHandler(
@@ -711,7 +714,7 @@ namespace OpenSim.Region.ClientStack.Linden
711 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, 714 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
712 string assetType, int cost, 715 string assetType, int cost,
713 UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, 716 UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
714 bool IsAtestUpload, ref string error) 717 bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider, ref string error)
715 { 718 {
716 719
717 lock (m_ModelCost) 720 lock (m_ModelCost)
@@ -877,12 +880,60 @@ namespace OpenSim.Region.ClientStack.Linden
877 List<UUID> meshAssets = new List<UUID>(); 880 List<UUID> meshAssets = new List<UUID>();
878 for (int i = 0; i < mesh_list.Count; i++) 881 for (int i = 0; i < mesh_list.Count; i++)
879 { 882 {
883/*
884 // do we really need this heavy thing?
885 OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]);
886 if (osd is OSDMap)
887 {
888 OSDMap mosd = (OSDMap)osd;
889 if (mosd.ContainsKey("skeleton"))
890 {
891 OSDMap skeleton = (OSDMap)mosd["skeleton"];
892 int sksize = skeleton["size"].AsInteger();
893 }
894 }
895*/
896
880 AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); 897 AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr);
881 meshAsset.Data = mesh_list[i].AsBinary(); 898 meshAsset.Data = mesh_list[i].AsBinary();
882 if (istest) 899 if (istest)
883 meshAsset.Local = true; 900 meshAsset.Local = true;
884 m_assetService.Store(meshAsset); 901 m_assetService.Store(meshAsset);
885 meshAssets.Add(meshAsset.FullID); 902 meshAssets.Add(meshAsset.FullID);
903
904
905 // test code
906 if (avatarSkeleton)
907 {
908 string name = assetName;
909 if (name.Length > 25)
910 name = name.Substring(0, 24);
911 name += "_Mesh#" + i.ToString();
912 InventoryItemBase meshitem = new InventoryItemBase();
913 meshitem.Owner = m_HostCapsObj.AgentID;
914 meshitem.CreatorId = creatorIDstr;
915 meshitem.CreatorData = String.Empty;
916 meshitem.ID = UUID.Random();
917 meshitem.AssetID = meshAsset.FullID;
918 meshitem.Description = "mesh ";
919 meshitem.Name = name;
920 meshitem.AssetType = (int)AssetType.Mesh;
921 meshitem.InvType = (int)InventoryType.Mesh;
922 meshitem.Folder = UUID.Zero; // send to default
923
924 // If we set PermissionMask.All then when we rez the item the next permissions will replace the current
925 // (owner) permissions. This becomes a problem if next permissions are changed.
926 meshitem.CurrentPermissions
927 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
928
929 meshitem.BasePermissions = (uint)PermissionMask.All;
930 meshitem.EveryOnePermissions = 0;
931 meshitem.NextPermissions = (uint)PermissionMask.All;
932 meshitem.CreationDate = Util.UnixTimeSinceEpoch();
933
934 m_Scene.AddInventoryItem(client, meshitem);
935 meshitem = null;
936 }
886 } 937 }
887 938
888 int skipedMeshs = 0; 939 int skipedMeshs = 0;
@@ -1540,12 +1591,14 @@ namespace OpenSim.Region.ClientStack.Linden
1540 private int m_nreqmeshs; 1591 private int m_nreqmeshs;
1541 private int m_nreqinstances; 1592 private int m_nreqinstances;
1542 private bool m_IsAtestUpload; 1593 private bool m_IsAtestUpload;
1594 private bool m_avatarSkeleton;
1595 private bool m_avatarCollider;
1543 1596
1544 public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, 1597 public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem,
1545 UUID parentFolderID, string invType, string assetType, string path, 1598 UUID parentFolderID, string invType, string assetType, string path,
1546 IHttpServer httpServer, bool dumpAssetsToFile, 1599 IHttpServer httpServer, bool dumpAssetsToFile,
1547 int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, 1600 int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances,
1548 bool IsAtestUpload) 1601 bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider)
1549 { 1602 {
1550 m_assetName = assetName; 1603 m_assetName = assetName;
1551 m_assetDes = description; 1604 m_assetDes = description;
@@ -1564,6 +1617,8 @@ namespace OpenSim.Region.ClientStack.Linden
1564 m_nreqmeshs = nreqmeshs; 1617 m_nreqmeshs = nreqmeshs;
1565 m_nreqinstances = nreqinstances; 1618 m_nreqinstances = nreqinstances;
1566 m_IsAtestUpload = IsAtestUpload; 1619 m_IsAtestUpload = IsAtestUpload;
1620 m_avatarSkeleton = avatarSkeleton;
1621 m_avatarCollider = avatarCollider;
1567 1622
1568 m_timeoutTimer.Elapsed += TimedOut; 1623 m_timeoutTimer.Elapsed += TimedOut;
1569 m_timeoutTimer.Interval = 120000; 1624 m_timeoutTimer.Interval = 120000;
@@ -1608,7 +1663,8 @@ namespace OpenSim.Region.ClientStack.Linden
1608 if (handlerUpLoad != null) 1663 if (handlerUpLoad != null)
1609 { 1664 {
1610 handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, 1665 handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,
1611 m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, ref m_error); 1666 m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload,
1667 m_avatarSkeleton, m_avatarCollider, ref m_error);
1612 } 1668 }
1613 if (m_IsAtestUpload) 1669 if (m_IsAtestUpload)
1614 { 1670 {