diff options
author | dahlia | 2011-06-29 17:36:41 -0700 |
---|---|---|
committer | dahlia | 2011-06-29 17:36:41 -0700 |
commit | 5c18ebf42470038720dffcf676bf3f9dd174d443 (patch) | |
tree | 35a3e76cb407f160a04f25d3ad7c270ead7f304b /OpenSim/Region/Physics/Meshing | |
parent | Don't follow inventory links of links. (diff) | |
download | opensim-SC_OLD-5c18ebf42470038720dffcf676bf3f9dd174d443.zip opensim-SC_OLD-5c18ebf42470038720dffcf676bf3f9dd174d443.tar.gz opensim-SC_OLD-5c18ebf42470038720dffcf676bf3f9dd174d443.tar.bz2 opensim-SC_OLD-5c18ebf42470038720dffcf676bf3f9dd174d443.tar.xz |
Allow physics proxy generation for meshes using new asset format.
Fix an invalid cast exception while decoding new mesh asset format.
Diffstat (limited to 'OpenSim/Region/Physics/Meshing')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 99b2d84..a5fe45b 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -291,7 +291,14 @@ namespace OpenSim.Region.Physics.Meshing | |||
291 | { | 291 | { |
292 | try | 292 | try |
293 | { | 293 | { |
294 | meshOsd = (OSDMap)OSDParser.DeserializeLLSDBinary(data); | 294 | OSD osd = OSDParser.DeserializeLLSDBinary(data); |
295 | if (osd is OSDMap) | ||
296 | meshOsd = (OSDMap)osd; | ||
297 | else | ||
298 | { | ||
299 | m_log.Warn("[Mesh}: unable to cast mesh asset to OSDMap"); | ||
300 | return null; | ||
301 | } | ||
295 | } | 302 | } |
296 | catch (Exception e) | 303 | catch (Exception e) |
297 | { | 304 | { |
@@ -302,11 +309,17 @@ namespace OpenSim.Region.Physics.Meshing | |||
302 | 309 | ||
303 | if (meshOsd is OSDMap) | 310 | if (meshOsd is OSDMap) |
304 | { | 311 | { |
312 | OSDMap physicsParms = null; | ||
305 | OSDMap map = (OSDMap)meshOsd; | 313 | OSDMap map = (OSDMap)meshOsd; |
306 | OSDMap physicsParms = (OSDMap)map["physics_shape"]; // old asset format | 314 | if (map.ContainsKey("physics_shape")) |
307 | 315 | physicsParms = (OSDMap)map["physics_shape"]; // old asset format | |
308 | if (physicsParms.Count == 0) | 316 | else if (map.ContainsKey("physics_mesh")) |
309 | physicsParms = (OSDMap)map["physics_mesh"]; // new asset format | 317 | physicsParms = (OSDMap)map["physics_mesh"]; // new asset format |
318 | if (physicsParms == null) | ||
319 | { | ||
320 | m_log.Warn("[Mesh]: no recognized physics mesh found in mesh asset"); | ||
321 | return null; | ||
322 | } | ||
310 | 323 | ||
311 | int physOffset = physicsParms["offset"].AsInteger() + (int)start; | 324 | int physOffset = physicsParms["offset"].AsInteger() + (int)start; |
312 | int physSize = physicsParms["size"].AsInteger(); | 325 | int physSize = physicsParms["size"].AsInteger(); |