diff options
author | UbitUmarov | 2014-10-11 22:41:59 +0100 |
---|---|---|
committer | UbitUmarov | 2014-10-11 22:41:59 +0100 |
commit | c3e88b7b3810aace6e2260526d8f74df88d2cead (patch) | |
tree | 3d9785b551646316ff796e4475785505d13f61a9 /OpenSim | |
parent | dont let test mesh go to meshes inventory folder that is not displayed by (diff) | |
download | opensim-SC-c3e88b7b3810aace6e2260526d8f74df88d2cead.zip opensim-SC-c3e88b7b3810aace6e2260526d8f74df88d2cead.tar.gz opensim-SC-c3e88b7b3810aace6e2260526d8f74df88d2cead.tar.bz2 opensim-SC-c3e88b7b3810aace6e2260526d8f74df88d2cead.tar.xz |
changed skeleton, do parse the mesh on upload to check skeleton. Sooner or
later this parsing needs to validate the model cost also.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 44 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | 8 |
2 files changed, 26 insertions, 26 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 344df2b..ab8f0c9 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, bool avatarSkeleton, bool avatarCollider, ref string error); | 61 | bool IsAtestUpload, 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,8 +531,6 @@ 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; | ||
536 | 534 | ||
537 | string assetName = llsdRequest.name; | 535 | string assetName = llsdRequest.name; |
538 | 536 | ||
@@ -584,7 +582,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
584 | 582 | ||
585 | 583 | ||
586 | if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, | 584 | if (!m_ModelCost.MeshModelCost(llsdRequest.asset_resources, baseCost, out modelcost, |
587 | meshcostdata,out avatarSkeleton, out avatarCollider, out error, ref warning)) | 585 | meshcostdata, out error, ref warning)) |
588 | { | 586 | { |
589 | LLSDAssetUploadError resperror = new LLSDAssetUploadError(); | 587 | LLSDAssetUploadError resperror = new LLSDAssetUploadError(); |
590 | resperror.message = error; | 588 | resperror.message = error; |
@@ -667,7 +665,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
667 | AssetUploader uploader = | 665 | AssetUploader uploader = |
668 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | 666 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, |
669 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, | 667 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, |
670 | texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload, avatarSkeleton, avatarCollider); | 668 | texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload); |
671 | 669 | ||
672 | m_HostCapsObj.HttpListener.AddStreamHandler( | 670 | m_HostCapsObj.HttpListener.AddStreamHandler( |
673 | new BinaryStreamHandler( | 671 | new BinaryStreamHandler( |
@@ -714,7 +712,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
714 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, | 712 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, |
715 | string assetType, int cost, | 713 | string assetType, int cost, |
716 | UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, | 714 | UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, |
717 | bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider, ref string error) | 715 | bool IsAtestUpload, ref string error) |
718 | { | 716 | { |
719 | 717 | ||
720 | lock (m_ModelCost) | 718 | lock (m_ModelCost) |
@@ -800,7 +798,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
800 | OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); | 798 | OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data); |
801 | 799 | ||
802 | // compare and get updated information | 800 | // compare and get updated information |
803 | 801 | /* does nothing still we do need something to avoid special viewer to upload something diferent from the cost estimation | |
804 | bool mismatchError = true; | 802 | bool mismatchError = true; |
805 | 803 | ||
806 | while (mismatchError) | 804 | while (mismatchError) |
@@ -816,7 +814,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
816 | 814 | ||
817 | return; | 815 | return; |
818 | } | 816 | } |
819 | 817 | */ | |
820 | OSDArray instance_list = (OSDArray)request["instance_list"]; | 818 | OSDArray instance_list = (OSDArray)request["instance_list"]; |
821 | OSDArray mesh_list = (OSDArray)request["mesh_list"]; | 819 | OSDArray mesh_list = (OSDArray)request["mesh_list"]; |
822 | OSDArray texture_list = (OSDArray)request["texture_list"]; | 820 | OSDArray texture_list = (OSDArray)request["texture_list"]; |
@@ -831,7 +829,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
831 | 829 | ||
832 | 830 | ||
833 | // if (doTextInv) | 831 | // if (doTextInv) |
834 | if (doTextInv || avatarSkeleton) | ||
835 | m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); | 832 | m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); |
836 | 833 | ||
837 | 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 |
@@ -879,10 +876,17 @@ namespace OpenSim.Region.ClientStack.Linden | |||
879 | 876 | ||
880 | // create and store meshs assets | 877 | // create and store meshs assets |
881 | 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; | ||
882 | for (int i = 0; i < mesh_list.Count; i++) | 884 | for (int i = 0; i < mesh_list.Count; i++) |
883 | { | 885 | { |
884 | /* | 886 | curAvSkeleton = false; |
885 | // do we really need this heavy thing? | 887 | curAvCollider = false; |
888 | |||
889 | // we do need to parse the mesh now | ||
886 | OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]); | 890 | OSD osd = OSDParser.DeserializeLLSDBinary(mesh_list[i]); |
887 | if (osd is OSDMap) | 891 | if (osd is OSDMap) |
888 | { | 892 | { |
@@ -891,9 +895,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
891 | { | 895 | { |
892 | OSDMap skeleton = (OSDMap)mosd["skeleton"]; | 896 | OSDMap skeleton = (OSDMap)mosd["skeleton"]; |
893 | int sksize = skeleton["size"].AsInteger(); | 897 | int sksize = skeleton["size"].AsInteger(); |
898 | if (sksize > 0) | ||
899 | curAvSkeleton = true; | ||
894 | } | 900 | } |
895 | } | 901 | } |
896 | */ | ||
897 | 902 | ||
898 | AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); | 903 | AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); |
899 | meshAsset.Data = mesh_list[i].AsBinary(); | 904 | meshAsset.Data = mesh_list[i].AsBinary(); |
@@ -901,10 +906,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
901 | meshAsset.Local = true; | 906 | meshAsset.Local = true; |
902 | m_assetService.Store(meshAsset); | 907 | m_assetService.Store(meshAsset); |
903 | meshAssets.Add(meshAsset.FullID); | 908 | meshAssets.Add(meshAsset.FullID); |
904 | 909 | meshAvatarSkeletons.Add(curAvSkeleton); | |
910 | meshAvatarColliders.Add(curAvCollider); | ||
905 | 911 | ||
906 | // test code | 912 | // test code |
907 | if (avatarSkeleton && client != null) | 913 | if (curAvSkeleton && client != null) |
908 | { | 914 | { |
909 | string name = assetName; | 915 | string name = assetName; |
910 | if (name.Length > 25) | 916 | if (name.Length > 25) |
@@ -1594,14 +1600,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1594 | private int m_nreqmeshs; | 1600 | private int m_nreqmeshs; |
1595 | private int m_nreqinstances; | 1601 | private int m_nreqinstances; |
1596 | private bool m_IsAtestUpload; | 1602 | private bool m_IsAtestUpload; |
1597 | private bool m_avatarSkeleton; | 1603 | |
1598 | private bool m_avatarCollider; | ||
1599 | |||
1600 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, | 1604 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, |
1601 | UUID parentFolderID, string invType, string assetType, string path, | 1605 | UUID parentFolderID, string invType, string assetType, string path, |
1602 | IHttpServer httpServer, bool dumpAssetsToFile, | 1606 | IHttpServer httpServer, bool dumpAssetsToFile, |
1603 | int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, | 1607 | int totalCost, UUID texturesFolder, int nreqtextures, int nreqmeshs, int nreqinstances, |
1604 | bool IsAtestUpload,bool avatarSkeleton, bool avatarCollider) | 1608 | bool IsAtestUpload) |
1605 | { | 1609 | { |
1606 | m_assetName = assetName; | 1610 | m_assetName = assetName; |
1607 | m_assetDes = description; | 1611 | m_assetDes = description; |
@@ -1620,8 +1624,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1620 | m_nreqmeshs = nreqmeshs; | 1624 | m_nreqmeshs = nreqmeshs; |
1621 | m_nreqinstances = nreqinstances; | 1625 | m_nreqinstances = nreqinstances; |
1622 | m_IsAtestUpload = IsAtestUpload; | 1626 | m_IsAtestUpload = IsAtestUpload; |
1623 | m_avatarSkeleton = avatarSkeleton; | ||
1624 | m_avatarCollider = avatarCollider; | ||
1625 | 1627 | ||
1626 | m_timeoutTimer.Elapsed += TimedOut; | 1628 | m_timeoutTimer.Elapsed += TimedOut; |
1627 | m_timeoutTimer.Interval = 120000; | 1629 | m_timeoutTimer.Interval = 120000; |
@@ -1667,7 +1669,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1667 | { | 1669 | { |
1668 | 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, |
1669 | m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, | 1671 | m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, |
1670 | m_avatarSkeleton, m_avatarCollider, ref m_error); | 1672 | ref m_error); |
1671 | } | 1673 | } |
1672 | if (m_IsAtestUpload) | 1674 | if (m_IsAtestUpload) |
1673 | { | 1675 | { |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index db6f9fd..546bcd9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs | |||
@@ -99,15 +99,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
99 | // avatarSkeleton if mesh includes a avatar skeleton | 99 | // avatarSkeleton if mesh includes a avatar skeleton |
100 | // useAvatarCollider if we should use physics mesh for avatar | 100 | // useAvatarCollider if we should use physics mesh for avatar |
101 | public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, | 101 | public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, |
102 | LLSDAssetUploadResponseData meshcostdata,out bool avatarSkeleton, out bool useAvatarCollider, | 102 | LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning) |
103 | out string error, ref string warning) | ||
104 | { | 103 | { |
105 | totalcost = 0; | 104 | totalcost = 0; |
106 | error = string.Empty; | 105 | error = string.Empty; |
107 | 106 | ||
108 | avatarSkeleton = false; | 107 | bool avatarSkeleton = false; |
109 | useAvatarCollider = false; | 108 | |
110 | |||
111 | if (resources == null || | 109 | if (resources == null || |
112 | resources.instance_list == null || | 110 | resources.instance_list == null || |
113 | resources.instance_list.Array.Count == 0) | 111 | resources.instance_list.Array.Count == 0) |