From 1a6ef2d60e4aff73e614ef45a0040c45316707f3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 11 Oct 2014 10:01:26 +0100 Subject: check for avatar skeleton data on meshs headers on cost estimation. Dont let a model have more than one mesh with skeleton, for testing create a mesh inventory item, for this meshs. Add also option to read a avatar collider replacement. This information still needs to be saved somewhere so it can be checked on attachment, etc, without parsing the mesh asset again. --- .../Linden/Caps/BunchOfCaps/MeshCost.cs | 44 +++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs index 4a3fae6..db6f9fd 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs @@ -96,12 +96,18 @@ namespace OpenSim.Region.ClientStack.Linden // basicCost input region assets upload cost // totalcost returns model total upload fee // meshcostdata returns detailed costs for viewer - public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, - LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning) + // avatarSkeleton if mesh includes a avatar skeleton + // useAvatarCollider if we should use physics mesh for avatar + public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, + LLSDAssetUploadResponseData meshcostdata,out bool avatarSkeleton, out bool useAvatarCollider, + out string error, ref string warning) { totalcost = 0; error = string.Empty; - + + avatarSkeleton = false; + useAvatarCollider = false; + if (resources == null || resources.instance_list == null || resources.instance_list.Array.Count == 0) @@ -145,6 +151,10 @@ namespace OpenSim.Region.ClientStack.Linden float meshsfee = 0; int numberMeshs = 0; bool haveMeshs = false; + + bool curskeleton; + bool curAvatarPhys; + List meshsCosts = new List(); if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0) @@ -156,10 +166,20 @@ namespace OpenSim.Region.ClientStack.Linden ameshCostParam curCost = new ameshCostParam(); byte[] data = (byte[])resources.mesh_list.Array[i]; - if (!MeshCost(data, curCost, out error)) + if (!MeshCost(data, curCost,out curskeleton, out curAvatarPhys, out error)) { return false; } + + if (curskeleton) + { + if (avatarSkeleton) + { + error = "model can only contain a avatar skeleton"; + return false; + } + avatarSkeleton = true; + } meshsCosts.Add(curCost); meshsfee += curCost.costFee; } @@ -273,7 +293,7 @@ namespace OpenSim.Region.ClientStack.Linden } // single mesh asset cost - private bool MeshCost(byte[] data, ameshCostParam cost, out string error) + private bool MeshCost(byte[] data, ameshCostParam cost,out bool skeleton, out bool avatarPhys, out string error) { cost.highLODSize = 0; cost.medLODSize = 0; @@ -284,6 +304,9 @@ namespace OpenSim.Region.ClientStack.Linden error = string.Empty; + skeleton = false; + avatarPhys = false; + if (data == null || data.Length == 0) { error = "Missing model information."; @@ -330,6 +353,17 @@ namespace OpenSim.Region.ClientStack.Linden int submesh_offset = -1; + if (map.ContainsKey("skeleton")) + { + tmpmap = (OSDMap)map["skeleton"]; + if (tmpmap.ContainsKey("offset") && tmpmap.ContainsKey("size")) + { + int sksize = tmpmap["size"].AsInteger(); + if(sksize > 0) + skeleton = true; + } + } + if (map.ContainsKey("physics_convex")) { tmpmap = (OSDMap)map["physics_convex"]; -- cgit v1.1