aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
diff options
context:
space:
mode:
authorUbitUmarov2014-10-11 10:01:26 +0100
committerUbitUmarov2014-10-11 10:01:26 +0100
commit1a6ef2d60e4aff73e614ef45a0040c45316707f3 (patch)
treefd9e84ceb05e17e5c2a14bc079d656756fdbaa47 /OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs
parentMerge branch 'master' into ubitworkmaster (diff)
downloadopensim-SC_OLD-1a6ef2d60e4aff73e614ef45a0040c45316707f3.zip
opensim-SC_OLD-1a6ef2d60e4aff73e614ef45a0040c45316707f3.tar.gz
opensim-SC_OLD-1a6ef2d60e4aff73e614ef45a0040c45316707f3.tar.bz2
opensim-SC_OLD-1a6ef2d60e4aff73e614ef45a0040c45316707f3.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/MeshCost.cs44
1 files changed, 39 insertions, 5 deletions
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
96 // basicCost input region assets upload cost 96 // basicCost input region assets upload cost
97 // totalcost returns model total upload fee 97 // totalcost returns model total upload fee
98 // meshcostdata returns detailed costs for viewer 98 // meshcostdata returns detailed costs for viewer
99 public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost, 99 // avatarSkeleton if mesh includes a avatar skeleton
100 LLSDAssetUploadResponseData meshcostdata, out string error, ref string warning) 100 // useAvatarCollider if we should use physics mesh for avatar
101 public bool MeshModelCost(LLSDAssetResource resources, int basicCost, out int totalcost,
102 LLSDAssetUploadResponseData meshcostdata,out bool avatarSkeleton, out bool useAvatarCollider,
103 out string error, ref string warning)
101 { 104 {
102 totalcost = 0; 105 totalcost = 0;
103 error = string.Empty; 106 error = string.Empty;
104 107
108 avatarSkeleton = false;
109 useAvatarCollider = false;
110
105 if (resources == null || 111 if (resources == null ||
106 resources.instance_list == null || 112 resources.instance_list == null ||
107 resources.instance_list.Array.Count == 0) 113 resources.instance_list.Array.Count == 0)
@@ -145,6 +151,10 @@ namespace OpenSim.Region.ClientStack.Linden
145 float meshsfee = 0; 151 float meshsfee = 0;
146 int numberMeshs = 0; 152 int numberMeshs = 0;
147 bool haveMeshs = false; 153 bool haveMeshs = false;
154
155 bool curskeleton;
156 bool curAvatarPhys;
157
148 List<ameshCostParam> meshsCosts = new List<ameshCostParam>(); 158 List<ameshCostParam> meshsCosts = new List<ameshCostParam>();
149 159
150 if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0) 160 if (resources.mesh_list != null && resources.mesh_list.Array.Count > 0)
@@ -156,10 +166,20 @@ namespace OpenSim.Region.ClientStack.Linden
156 ameshCostParam curCost = new ameshCostParam(); 166 ameshCostParam curCost = new ameshCostParam();
157 byte[] data = (byte[])resources.mesh_list.Array[i]; 167 byte[] data = (byte[])resources.mesh_list.Array[i];
158 168
159 if (!MeshCost(data, curCost, out error)) 169 if (!MeshCost(data, curCost,out curskeleton, out curAvatarPhys, out error))
160 { 170 {
161 return false; 171 return false;
162 } 172 }
173
174 if (curskeleton)
175 {
176 if (avatarSkeleton)
177 {
178 error = "model can only contain a avatar skeleton";
179 return false;
180 }
181 avatarSkeleton = true;
182 }
163 meshsCosts.Add(curCost); 183 meshsCosts.Add(curCost);
164 meshsfee += curCost.costFee; 184 meshsfee += curCost.costFee;
165 } 185 }
@@ -273,7 +293,7 @@ namespace OpenSim.Region.ClientStack.Linden
273 } 293 }
274 294
275 // single mesh asset cost 295 // single mesh asset cost
276 private bool MeshCost(byte[] data, ameshCostParam cost, out string error) 296 private bool MeshCost(byte[] data, ameshCostParam cost,out bool skeleton, out bool avatarPhys, out string error)
277 { 297 {
278 cost.highLODSize = 0; 298 cost.highLODSize = 0;
279 cost.medLODSize = 0; 299 cost.medLODSize = 0;
@@ -284,6 +304,9 @@ namespace OpenSim.Region.ClientStack.Linden
284 304
285 error = string.Empty; 305 error = string.Empty;
286 306
307 skeleton = false;
308 avatarPhys = false;
309
287 if (data == null || data.Length == 0) 310 if (data == null || data.Length == 0)
288 { 311 {
289 error = "Missing model information."; 312 error = "Missing model information.";
@@ -330,6 +353,17 @@ namespace OpenSim.Region.ClientStack.Linden
330 353
331 int submesh_offset = -1; 354 int submesh_offset = -1;
332 355
356 if (map.ContainsKey("skeleton"))
357 {
358 tmpmap = (OSDMap)map["skeleton"];
359 if (tmpmap.ContainsKey("offset") && tmpmap.ContainsKey("size"))
360 {
361 int sksize = tmpmap["size"].AsInteger();
362 if(sksize > 0)
363 skeleton = true;
364 }
365 }
366
333 if (map.ContainsKey("physics_convex")) 367 if (map.ContainsKey("physics_convex"))
334 { 368 {
335 tmpmap = (OSDMap)map["physics_convex"]; 369 tmpmap = (OSDMap)map["physics_convex"];