aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2013-05-21 15:31:13 -0700
committerRobert Adams2013-05-21 15:31:13 -0700
commitece7b33a963081a217351a640f9780219cc5cbd6 (patch)
tree9a986669b22ad72611da98582e052601c279559d
parentBulletSim: fix BulletSim crashing if there is no [BulletSim] section (diff)
parentTo further help with tracking down the apperance of too much "Unknown User" i... (diff)
downloadopensim-SC_OLD-ece7b33a963081a217351a640f9780219cc5cbd6.zip
opensim-SC_OLD-ece7b33a963081a217351a640f9780219cc5cbd6.tar.gz
opensim-SC_OLD-ece7b33a963081a217351a640f9780219cc5cbd6.tar.bz2
opensim-SC_OLD-ece7b33a963081a217351a640f9780219cc5cbd6.tar.xz
Merge branch 'master' of git://opensimulator.org/git/opensim
-rw-r--r--OpenSim/Framework/Util.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs123
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs131
5 files changed, 203 insertions, 59 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index a3602e9..ada4e89 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2136,7 +2136,7 @@ namespace OpenSim.Framework
2136 /// <param name="secret">the secret part</param> 2136 /// <param name="secret">the secret part</param>
2137 public static bool ParseUniversalUserIdentifier(string value, out UUID uuid, out string url, out string firstname, out string lastname, out string secret) 2137 public static bool ParseUniversalUserIdentifier(string value, out UUID uuid, out string url, out string firstname, out string lastname, out string secret)
2138 { 2138 {
2139 uuid = UUID.Zero; url = string.Empty; firstname = "Unknown"; lastname = "User"; secret = string.Empty; 2139 uuid = UUID.Zero; url = string.Empty; firstname = "Unknown"; lastname = "UserUPUUI"; secret = string.Empty;
2140 2140
2141 string[] parts = value.Split(';'); 2141 string[] parts = value.Split(';');
2142 if (parts.Length >= 1) 2142 if (parts.Length >= 1)
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 8056030..4613344 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -371,7 +371,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
371 foreach (string fid in outstanding) 371 foreach (string fid in outstanding)
372 { 372 {
373 UUID fromAgentID; 373 UUID fromAgentID;
374 string firstname = "Unknown", lastname = "User"; 374 string firstname = "Unknown", lastname = "UserFMSFOIN";
375 if (!GetAgentInfo(client.Scene.RegionInfo.ScopeID, fid, out fromAgentID, out firstname, out lastname)) 375 if (!GetAgentInfo(client.Scene.RegionInfo.ScopeID, fid, out fromAgentID, out firstname, out lastname))
376 { 376 {
377 m_log.DebugFormat("[FRIENDS MODULE]: skipping malformed friend {0}", fid); 377 m_log.DebugFormat("[FRIENDS MODULE]: skipping malformed friend {0}", fid);
@@ -397,7 +397,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
397 397
398 protected virtual bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last) 398 protected virtual bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last)
399 { 399 {
400 first = "Unknown"; last = "User"; 400 first = "Unknown"; last = "UserFMGAI";
401 if (!UUID.TryParse(fid, out agentID)) 401 if (!UUID.TryParse(fid, out agentID))
402 return false; 402 return false;
403 403
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
index bf5c0bb..b3e3aa2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs
@@ -293,7 +293,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
293 293
294 protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last) 294 protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last)
295 { 295 {
296 first = "Unknown"; last = "User"; 296 first = "Unknown"; last = "UserHGGAI";
297 if (base.GetAgentInfo(scopeID, fid, out agentID, out first, out last)) 297 if (base.GetAgentInfo(scopeID, fid, out agentID, out first, out last))
298 return true; 298 return true;
299 299
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index 6847e57..a720d7b 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -157,13 +157,16 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
157 } 157 }
158 else 158 else
159 { 159 {
160 string[] names = GetUserNames(uuid); 160 string[] names;
161 bool foundRealName = TryGetUserNames(uuid, out names);
162
161 if (names.Length == 2) 163 if (names.Length == 2)
162 { 164 {
163 //m_log.DebugFormat("[XXX] HandleUUIDNameRequest {0} is {1} {2}", uuid, names[0], names[1]); 165 if (!foundRealName)
166 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], uuid, remote_client.Name);
167
164 remote_client.SendNameReply(uuid, names[0], names[1]); 168 remote_client.SendNameReply(uuid, names[0], names[1]);
165 } 169 }
166
167 } 170 }
168 } 171 }
169 172
@@ -246,10 +249,15 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
246 } 249 }
247 250
248 // search the local cache 251 // search the local cache
249 foreach (UserData data in m_UserCache.Values) 252 lock (m_UserCache)
250 if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null && 253 {
251 (data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower()))) 254 foreach (UserData data in m_UserCache.Values)
252 users.Add(data); 255 {
256 if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
257 (data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower())))
258 users.Add(data);
259 }
260 }
253 261
254 AddAdditionalUsers(query, users); 262 AddAdditionalUsers(query, users);
255 263
@@ -272,17 +280,24 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
272 } 280 }
273 } 281 }
274 282
275 private string[] GetUserNames(UUID uuid) 283 /// <summary>
284 /// Try to get the names bound to the given uuid.
285 /// </summary>
286 /// <returns>True if the name was found, false if not.</returns>
287 /// <param name='uuid'></param>
288 /// <param name='names'>The array of names if found. If not found, then names[0] = "Unknown" and names[1] = "User"</param>
289 private bool TryGetUserNames(UUID uuid, out string[] names)
276 { 290 {
277 string[] returnstring = new string[2]; 291 names = new string[2];
278 292
279 lock (m_UserCache) 293 lock (m_UserCache)
280 { 294 {
281 if (m_UserCache.ContainsKey(uuid)) 295 if (m_UserCache.ContainsKey(uuid))
282 { 296 {
283 returnstring[0] = m_UserCache[uuid].FirstName; 297 names[0] = m_UserCache[uuid].FirstName;
284 returnstring[1] = m_UserCache[uuid].LastName; 298 names[1] = m_UserCache[uuid].LastName;
285 return returnstring; 299
300 return true;
286 } 301 }
287 } 302 }
288 303
@@ -290,8 +305,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
290 305
291 if (account != null) 306 if (account != null)
292 { 307 {
293 returnstring[0] = account.FirstName; 308 names[0] = account.FirstName;
294 returnstring[1] = account.LastName; 309 names[1] = account.LastName;
295 310
296 UserData user = new UserData(); 311 UserData user = new UserData();
297 user.FirstName = account.FirstName; 312 user.FirstName = account.FirstName;
@@ -299,14 +314,16 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
299 314
300 lock (m_UserCache) 315 lock (m_UserCache)
301 m_UserCache[uuid] = user; 316 m_UserCache[uuid] = user;
317
318 return true;
302 } 319 }
303 else 320 else
304 { 321 {
305 returnstring[0] = "Unknown"; 322 names[0] = "Unknown";
306 returnstring[1] = "User"; 323 names[1] = "UserUMMTGUN";
307 }
308 324
309 return returnstring; 325 return false;
326 }
310 } 327 }
311 328
312 #region IUserManagement 329 #region IUserManagement
@@ -342,15 +359,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
342 359
343 public string GetUserName(UUID uuid) 360 public string GetUserName(UUID uuid)
344 { 361 {
345 string[] names = GetUserNames(uuid); 362 string[] names;
363 TryGetUserNames(uuid, out names);
364
346 if (names.Length == 2) 365 if (names.Length == 2)
347 { 366 {
348 string firstname = names[0]; 367 string firstname = names[0];
349 string lastname = names[1]; 368 string lastname = names[1];
350 369
351 return firstname + " " + lastname; 370 return firstname + " " + lastname;
352
353 } 371 }
372
354 return "(hippos)"; 373 return "(hippos)";
355 } 374 }
356 375
@@ -466,12 +485,13 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
466 //ignore updates without creator data 485 //ignore updates without creator data
467 return; 486 return;
468 } 487 }
488
469 //try update unknown users 489 //try update unknown users
470 //and creator's home URL's 490 //and creator's home URL's
471 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL))) 491 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL)))
472 { 492 {
473 m_UserCache.Remove (id); 493 m_UserCache.Remove (id);
474// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL); 494 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL);
475 } 495 }
476 else 496 else
477 { 497 {
@@ -516,7 +536,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
516 else 536 else
517 { 537 {
518 user.FirstName = "Unknown"; 538 user.FirstName = "Unknown";
519 user.LastName = "User"; 539 user.LastName = "UserUMMAU";
520 } 540 }
521 541
522 AddUserInternal (user); 542 AddUserInternal (user);
@@ -548,6 +568,13 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
548 protected void RegisterConsoleCmds() 568 protected void RegisterConsoleCmds()
549 { 569 {
550 MainConsole.Instance.Commands.AddCommand("Users", true, 570 MainConsole.Instance.Commands.AddCommand("Users", true,
571 "show name",
572 "show name <uuid>",
573 "Show the bindings between a single user UUID and a user name",
574 String.Empty,
575 HandleShowUser);
576
577 MainConsole.Instance.Commands.AddCommand("Users", true,
551 "show names", 578 "show names",
552 "show names", 579 "show names",
553 "Show the bindings between user UUIDs and user names", 580 "Show the bindings between user UUIDs and user names",
@@ -555,26 +582,54 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
555 HandleShowUsers); 582 HandleShowUsers);
556 } 583 }
557 584
558 private void HandleShowUsers(string module, string[] cmd) 585 private void HandleShowUser(string module, string[] cmd)
559 { 586 {
587 if (cmd.Length < 3)
588 {
589 MainConsole.Instance.OutputFormat("Usage: show name <uuid>");
590 return;
591 }
592
593 UUID userId;
594 if (!ConsoleUtil.TryParseConsoleUuid(MainConsole.Instance, cmd[2], out userId))
595 return;
596
597 string[] names;
598
599 UserData ud;
600
560 lock (m_UserCache) 601 lock (m_UserCache)
561 { 602 {
562 if (m_UserCache.Count == 0) 603 if (!m_UserCache.TryGetValue(userId, out ud))
563 { 604 {
564 MainConsole.Instance.Output("No users found"); 605 MainConsole.Instance.OutputFormat("No name known for user with id {0}", userId);
565 return; 606 return;
566 } 607 }
567 608 }
568 MainConsole.Instance.Output("UUID User Name"); 609
569 MainConsole.Instance.Output("-----------------------------------------------------------------------------"); 610 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
611 cdt.AddColumn("UUID", 36);
612 cdt.AddColumn("Name", 30);
613 cdt.AddColumn("HomeURL", 40);
614 cdt.AddRow(userId, string.Format("{0} {1}", ud.FirstName, ud.LastName), ud.HomeURL);
615
616 MainConsole.Instance.Output(cdt.ToString());
617 }
618
619 private void HandleShowUsers(string module, string[] cmd)
620 {
621 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
622 cdt.AddColumn("UUID", 36);
623 cdt.AddColumn("Name", 30);
624 cdt.AddColumn("HomeURL", 40);
625
626 lock (m_UserCache)
627 {
570 foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache) 628 foreach (KeyValuePair<UUID, UserData> kvp in m_UserCache)
571 { 629 cdt.AddRow(kvp.Key, string.Format("{0} {1}", kvp.Value.FirstName, kvp.Value.LastName), kvp.Value.HomeURL);
572 MainConsole.Instance.Output(String.Format("{0} {1} {2} ({3})",
573 kvp.Key, kvp.Value.FirstName, kvp.Value.LastName, kvp.Value.HomeURL));
574 }
575
576 return;
577 } 630 }
631
632 MainConsole.Instance.Output(cdt.ToString());
578 } 633 }
579 } 634 }
580} \ No newline at end of file 635} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 2d102de..79edc12 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -79,6 +79,8 @@ namespace OpenSim.Region.Physics.Meshing
79 79
80 private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh 80 private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh
81 81
82 private List<List<Vector3>> mConvexHulls = null;
83
82 private Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>(); 84 private Dictionary<ulong, Mesh> m_uniqueMeshes = new Dictionary<ulong, Mesh>();
83 85
84 public Meshmerizer(IConfigSource config) 86 public Meshmerizer(IConfigSource config)
@@ -363,6 +365,57 @@ namespace OpenSim.Region.Physics.Meshing
363 else if (map.ContainsKey("high_lod")) 365 else if (map.ContainsKey("high_lod"))
364 physicsParms = (OSDMap)map["high_lod"]; // if all else fails, use highest LOD display mesh and hope it works :) 366 physicsParms = (OSDMap)map["high_lod"]; // if all else fails, use highest LOD display mesh and hope it works :)
365 367
368 if (map.ContainsKey("physics_convex"))
369 { // pull this out also in case physics engine can use it
370 try
371 {
372 OSDMap convexBlock = (OSDMap)map["physics_convex"];
373 if (convexBlock.ContainsKey("HullList"))
374 {
375 byte[] hullList = convexBlock["HullList"].AsBinary();
376 Vector3 min = new Vector3(-0.5f, -0.5f, -0.5f);
377 if (convexBlock.ContainsKey("Min")) min = convexBlock["Min"].AsVector3();
378 Vector3 max = new Vector3(0.5f, 0.5f, 0.5f);
379 if (convexBlock.ContainsKey("Max")) max = convexBlock["Max"].AsVector3();
380
381 // decompress and decode hull points
382 byte[] posBytes = DecompressOsd(convexBlock["Positions"].AsBinary()).AsBinary();
383
384 List<List<Vector3>> hulls = new List<List<Vector3>>();
385 int posNdx = 0;
386
387 foreach (byte cnt in hullList)
388 {
389 int count = cnt == 0 ? 256 : cnt;
390 List<Vector3> hull = new List<Vector3>();
391
392 for (int i = 0; i < count; i++)
393 {
394 ushort uX = Utils.BytesToUInt16(posBytes, posNdx); posNdx += 2;
395 ushort uY = Utils.BytesToUInt16(posBytes, posNdx); posNdx += 2;
396 ushort uZ = Utils.BytesToUInt16(posBytes, posNdx); posNdx += 2;
397
398 Vector3 pos = new Vector3(
399 Utils.UInt16ToFloat(uX, min.X, max.X),
400 Utils.UInt16ToFloat(uY, min.Y, max.Y),
401 Utils.UInt16ToFloat(uZ, min.Z, max.Z)
402 );
403
404 hull.Add(pos);
405 }
406
407 hulls.Add(hull);
408 }
409
410 mConvexHulls = hulls;
411 }
412 }
413 catch (Exception e)
414 {
415 m_log.WarnFormat("[MESH]: exception decoding convex block: {0}", e.Message);
416 }
417 }
418
366 if (physicsParms == null) 419 if (physicsParms == null)
367 { 420 {
368 m_log.WarnFormat("[MESH]: No recognized physics mesh found in mesh asset for {0}", primName); 421 m_log.WarnFormat("[MESH]: No recognized physics mesh found in mesh asset for {0}", primName);
@@ -381,27 +434,7 @@ namespace OpenSim.Region.Physics.Meshing
381// byte[] decompressed = new byte[physSize * 5]; 434// byte[] decompressed = new byte[physSize * 5];
382 try 435 try
383 { 436 {
384 using (MemoryStream inMs = new MemoryStream(meshBytes)) 437 decodedMeshOsd = DecompressOsd(meshBytes);
385 {
386 using (MemoryStream outMs = new MemoryStream())
387 {
388 using (ZOutputStream zOut = new ZOutputStream(outMs))
389 {
390 byte[] readBuffer = new byte[2048];
391 int readLen = 0;
392 while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
393 {
394 zOut.Write(readBuffer, 0, readLen);
395 }
396 zOut.Flush();
397 outMs.Seek(0, SeekOrigin.Begin);
398
399 byte[] decompressedBuf = outMs.GetBuffer();
400
401 decodedMeshOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
402 }
403 }
404 }
405 } 438 }
406 catch (Exception e) 439 catch (Exception e)
407 { 440 {
@@ -428,6 +461,41 @@ namespace OpenSim.Region.Physics.Meshing
428 return true; 461 return true;
429 } 462 }
430 463
464
465 /// <summary>
466 /// decompresses a gzipped OSD object
467 /// </summary>
468 /// <param name="decodedOsd"></param> the OSD object
469 /// <param name="meshBytes"></param>
470 /// <returns></returns>
471 private static OSD DecompressOsd(byte[] meshBytes)
472 {
473 OSD decodedOsd = null;
474
475 using (MemoryStream inMs = new MemoryStream(meshBytes))
476 {
477 using (MemoryStream outMs = new MemoryStream())
478 {
479 using (ZOutputStream zOut = new ZOutputStream(outMs))
480 {
481 byte[] readBuffer = new byte[2048];
482 int readLen = 0;
483 while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
484 {
485 zOut.Write(readBuffer, 0, readLen);
486 }
487 zOut.Flush();
488 outMs.Seek(0, SeekOrigin.Begin);
489
490 byte[] decompressedBuf = outMs.GetBuffer();
491
492 decodedOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
493 }
494 }
495 }
496 return decodedOsd;
497 }
498
431 /// <summary> 499 /// <summary>
432 /// Generate the co-ords and faces necessary to construct a mesh from the sculpt data the accompanies a prim. 500 /// Generate the co-ords and faces necessary to construct a mesh from the sculpt data the accompanies a prim.
433 /// </summary> 501 /// </summary>
@@ -704,6 +772,27 @@ namespace OpenSim.Region.Physics.Meshing
704 return true; 772 return true;
705 } 773 }
706 774
775 /// <summary>
776 /// temporary prototype code - please do not use until the interface has been finalized!
777 /// </summary>
778 /// <param name="size">value to scale the hull points by</param>
779 /// <returns>a list of hulls if they exist and have been successfully decoded, otherwise null</returns>
780 public List<List<Vector3>> GetConvexHulls(Vector3 size)
781 {
782 if (mConvexHulls == null)
783 return null;
784
785 List<List<Vector3>> hulls = new List<List<Vector3>>();
786 foreach (var hull in mConvexHulls)
787 {
788 List<Vector3> verts = new List<Vector3>();
789 foreach (var vert in hull)
790 verts.Add(vert * size);
791 }
792
793 return hulls;
794 }
795
707 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) 796 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
708 { 797 {
709 return CreateMesh(primName, primShape, size, lod, false, true); 798 return CreateMesh(primName, primShape, size, lod, false, true);