Fixed bug in AvatarFactoryModule that resulted in removing cloth items, not being persisted.

ThreadPoolClientBranch
MW 2008-02-15 12:39:45 +00:00
parent 5e625e5380
commit 23c7c6dabd
2 changed files with 31 additions and 29 deletions

View File

@ -99,7 +99,6 @@ namespace OpenSim.Region.Environment.Modules
waitHandle = null;
return false;
}
}
else
{
@ -179,7 +178,6 @@ namespace OpenSim.Region.Environment.Modules
private AvatarAppearance CheckDatabase(LLUUID avatarId)
{
AvatarAppearance appearance = null;
//check db
if (m_enablePersist)
{
if (m_appearanceMapper.TryGetValue(avatarId.UUID, out appearance))
@ -198,13 +196,11 @@ namespace OpenSim.Region.Environment.Modules
private AvatarAppearance CheckCache(LLUUID avatarId)
{
AvatarAppearance appearance = null;
//check cache
lock (m_avatarsAppearance)
{
if (m_avatarsAppearance.ContainsKey(avatarId))
{
appearance = m_avatarsAppearance[avatarId];
// return true;
}
}
return appearance;
@ -212,11 +208,9 @@ namespace OpenSim.Region.Environment.Modules
public void Initialise(Scene scene, IConfigSource source)
{
scene.RegisterModuleInterface<IAvatarFactory>(this);
scene.EventManager.OnNewClient += NewClient;
if (m_scene == null)
{
m_scene = scene;
@ -277,11 +271,26 @@ namespace OpenSim.Region.Environment.Modules
{
if (profile.RootFolder != null)
{
//Todo look up the assetid from the inventory cache for each itemId that is in AvatarWearingArgs
// then store assetid and itemId and wearable type in a database
if (m_avatarsAppearance.ContainsKey(clientView.AgentId))
{
AvatarAppearance avatAppearance = null;
lock (m_avatarsAppearance)
{
avatAppearance = m_avatarsAppearance[clientView.AgentId];
}
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (wear.Type < 13)
{
if (wear.ItemID == LLUUID.Zero)
{
avatAppearance.Wearables[wear.Type].ItemID = LLUUID.Zero;
avatAppearance.Wearables[wear.Type].AssetID = LLUUID.Zero;
UpdateDatabase(clientView.AgentId, avatAppearance);
}
else
{
LLUUID assetId;
@ -289,15 +298,6 @@ namespace OpenSim.Region.Environment.Modules
if (baseItem != null)
{
assetId = baseItem.assetID;
if (m_avatarsAppearance.ContainsKey(clientView.AgentId))
{
AvatarAppearance avatAppearance = null;
lock (m_avatarsAppearance)
{
avatAppearance = m_avatarsAppearance[clientView.AgentId];
}
avatAppearance.Wearables[wear.Type].AssetID = assetId;
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
@ -309,6 +309,7 @@ namespace OpenSim.Region.Environment.Modules
}
}
}
}
public void UpdateDatabase(LLUUID userID, AvatarAppearance avatAppearance)
{

View File

@ -1422,6 +1422,7 @@ namespace OpenSim.Region.Environment.Scenes
!m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
{
//not found Appearance
m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis");
byte[] visualParams;
AvatarWearable[] wearables;
AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams);