i can haz pantz?

You sure can.  This change set restores pants (and the rest of the
default appearance) in grid mode.  The 
root issue had to do with serializing multi-faced textures to the 
grid server.  This also restores the lookup path through the avatar
factory module, as that seems the reasonable place to have it live.
Some clean up patches are coming later as well, plus testing on 
standalone, but this should be in a good kicking around state for 
grid users.
0.6.0-stable
Sean Dague 2008-05-19 19:08:59 +00:00
parent 4b622ec881
commit 9808f39b6f
6 changed files with 125 additions and 123 deletions

View File

@ -661,9 +661,7 @@ namespace OpenSim.Data.MySQL
AvatarAppearance appearance = null; AvatarAppearance appearance = null;
if (!m_appearanceMapper.TryGetValue(user.UUID, out appearance)) if (!m_appearanceMapper.TryGetValue(user.UUID, out appearance))
{ {
appearance = new AvatarAppearance(); appearance = null;
appearance.Owner = user;
UpdateUserAppearance(user, appearance);
} }
return appearance; return appearance;
} }

View File

@ -60,15 +60,12 @@ namespace OpenSim.Data
public abstract void Initialise(string connect); public abstract void Initialise(string connect);
public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
public AvatarAppearance GetUserAppearance(LLUUID user) { public AvatarAppearance GetUserAppearance(LLUUID user) {
AvatarAppearance aa; AvatarAppearance aa = null;
try { try {
aa = aplist[user]; aa = aplist[user];
m_log.Info("[APPEARANCE] Found appearance for " + user.ToString() + aa.ToString()); m_log.Info("[APPEARANCE] Found appearance for " + user.ToString() + aa.ToString());
} catch (System.Collections.Generic.KeyNotFoundException e) { } catch (System.Collections.Generic.KeyNotFoundException e) {
aplist[user] = new AvatarAppearance(); m_log.Info("[APPEARANCE] No appearance found for " + user.ToString());
aplist[user].Owner = user;
aa = aplist[user];
m_log.Info("[APPEARANCE] Setting up default appearance for " + user.ToString() + aa.ToString());
} }
return aa; return aa;
} }

View File

@ -611,7 +611,7 @@ namespace OpenSim.Framework.Communications
m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Key, e.ToString()); m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Key, e.ToString());
} }
} }
return new AvatarAppearance(); return null;
} }
public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)

View File

@ -256,8 +256,14 @@ namespace OpenSim.Grid.UserServer
if (requestData.Contains("owner")) if (requestData.Contains("owner"))
{ {
appearance = GetUserAppearance(new LLUUID((string)requestData["owner"])); appearance = GetUserAppearance(new LLUUID((string)requestData["owner"]));
if (appearance == null) {
responseData = new Hashtable();
responseData["error_type"] = "no appearance";
responseData["error_desc"] = "There was no appearance found for this avatar";
} else {
responseData = appearance.ToHashTable(); responseData = appearance.ToHashTable();
} }
}
else else
{ {
responseData = new Hashtable(); responseData = new Hashtable();

View File

@ -1780,28 +1780,27 @@ namespace OpenSim.Region.Environment.Scenes
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
{ {
AvatarAppearance appearance = CommsManager.UserService.GetUserAppearance(client.AgentId);
AvatarAppearance appearance = null;
GetAvatarAppearance(client, out appearance);
ScenePresence avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance); ScenePresence avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance);
return avatar; return avatar;
} }
// protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
// { {
// appearance = CommsManager.UserService.GetUserAppearance(client.AgentId); appearance = CommsManager.UserService.GetUserAppearance(client.AgentId);
// // if (m_AvatarFactory == null || if (m_AvatarFactory == null ||
// // !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
// // { {
// // //not found Appearance // not found Appearance
// // m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis"); m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis");
// // byte[] visualParams; appearance = new AvatarAppearance();
// // AvatarWearable[] wearables; }
// // GetDefaultAvatarAppearance(out wearables, out visualParams); }
// // appearance = new AvatarAppearance(client.AgentId, wearables, visualParams);
// // }
// }
/// <summary> /// <summary>
/// Remove the given client from the scene. /// Remove the given client from the scene.

View File

@ -59,112 +59,114 @@ namespace OpenSim.Region.Modules.AvatarFactory
public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance)
{ {
appearance = m_scene.CommsManager.UserService.GetUserAppearance(avatarId);
//should only let one thread at a time do this part
EventWaitHandle waitHandle = null;
bool fetchInProgress = false;
lock (m_syncLock)
{
appearance = CheckCache(avatarId);
if (appearance != null)
{
return true; return true;
}
//not in cache so check to see if another thread is already fetching it // //should only let one thread at a time do this part
if (m_fetchesInProgress.TryGetValue(avatarId, out waitHandle)) // EventWaitHandle waitHandle = null;
{ // bool fetchInProgress = false;
fetchInProgress = true; // lock (m_syncLock)
} // {
else // appearance = CheckCache(avatarId);
{ // if (appearance != null)
fetchInProgress = false; // {
// return true;
// }
//no thread already fetching this appearance, so add a wait handle to list // //not in cache so check to see if another thread is already fetching it
//for any following threads that want the same appearance // if (m_fetchesInProgress.TryGetValue(avatarId, out waitHandle))
waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset); // {
m_fetchesInProgress.Add(avatarId, waitHandle); // fetchInProgress = true;
} // }
} // else
// {
// fetchInProgress = false;
if (fetchInProgress) // //no thread already fetching this appearance, so add a wait handle to list
{ // //for any following threads that want the same appearance
waitHandle.WaitOne(); // waitHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
appearance = CheckCache(avatarId); // m_fetchesInProgress.Add(avatarId, waitHandle);
if (appearance != null) // }
{ // }
waitHandle = null;
return true;
}
else
{
waitHandle = null;
return false;
}
}
else
{
// BUG: !? (Reduced from 5000 to 500 by Adam)
Thread.Sleep(500); //why is this here?
//this is the first thread to request this appearance // if (fetchInProgress)
//so let it check the db and if not found then create a default appearance // {
//and add that to the cache // waitHandle.WaitOne();
appearance = CheckDatabase(avatarId); // appearance = CheckCache(avatarId);
if (appearance != null) // if (appearance != null)
{ // {
//appearance has now been added to cache so lets pulse any waiting threads // waitHandle = null;
lock (m_syncLock) // return true;
{ // }
m_fetchesInProgress.Remove(avatarId); // else
waitHandle.Set(); // {
} // waitHandle = null;
// waitHandle.Close(); // return false;
waitHandle = null; // }
return true; // }
} // else
// {
// // BUG: !? (Reduced from 5000 to 500 by Adam)
// Thread.Sleep(500); //why is this here?
//not found a appearance for the user, so create a new default one // //this is the first thread to request this appearance
appearance = CreateDefault(avatarId); // //so let it check the db and if not found then create a default appearance
if (appearance != null) // //and add that to the cache
{ // appearance = CheckDatabase(avatarId);
//update database // if (appearance != null)
if (m_enablePersist) // {
{ // //appearance has now been added to cache so lets pulse any waiting threads
m_appearanceMapper.Add(avatarId.UUID, appearance); // lock (m_syncLock)
} // {
// m_fetchesInProgress.Remove(avatarId);
// waitHandle.Set();
// }
// // waitHandle.Close();
// waitHandle = null;
// return true;
// }
//add appearance to dictionary cache // //not found a appearance for the user, so create a new default one
lock (m_avatarsAppearance) // appearance = CreateDefault(avatarId);
{ // if (appearance != null)
m_avatarsAppearance[avatarId] = appearance; // {
} // //update database
// if (m_enablePersist)
// {
// m_appearanceMapper.Add(avatarId.UUID, appearance);
// }
//appearance has now been added to cache so lets pulse any waiting threads // //add appearance to dictionary cache
lock (m_syncLock) // lock (m_avatarsAppearance)
{ // {
m_fetchesInProgress.Remove(avatarId); // m_avatarsAppearance[avatarId] = appearance;
waitHandle.Set(); // }
}
// waitHandle.Close(); // //appearance has now been added to cache so lets pulse any waiting threads
waitHandle = null; // lock (m_syncLock)
return true; // {
} // m_fetchesInProgress.Remove(avatarId);
else // waitHandle.Set();
{ // }
//something went wrong, so release the wait handle and remove it // // waitHandle.Close();
//all waiting threads will fail to find cached appearance // waitHandle = null;
//but its better for them to fail than wait for ever // return true;
lock (m_syncLock) // }
{ // else
m_fetchesInProgress.Remove(avatarId); // {
waitHandle.Set(); // //something went wrong, so release the wait handle and remove it
} // //all waiting threads will fail to find cached appearance
//waitHandle.Close(); // //but its better for them to fail than wait for ever
waitHandle = null; // lock (m_syncLock)
return false; // {
} // m_fetchesInProgress.Remove(avatarId);
} // waitHandle.Set();
// }
// //waitHandle.Close();
// waitHandle = null;
// return false;
// }
// }
} }
private AvatarAppearance CreateDefault(LLUUID avatarId) private AvatarAppearance CreateDefault(LLUUID avatarId)