Very partial Avatar Appearance (ie, clothes/body parts) "storage". In standalone mode it will mean that when you log off and log back on ,as long as the region server hasn't been restarted , your avatar will start with wearing the clothes that it wore on log off. In grid mode its even more limited in that wearing/removing clothes/body parts are only stored in the region server instance you are one. so if you are in a different region to your login region (which are on different region server instances), and then change clothes, those changes won't be remembered. So as said, its very limited but is a small step towards having proper appearance persist.

Just need to store this data out to a database.
afrisby
MW 2007-12-02 14:56:23 +00:00
parent 86ae8e97cd
commit cac98171e5
5 changed files with 104 additions and 41 deletions

View File

@ -333,7 +333,7 @@ namespace OpenSim.Framework.Communications.Cache
//really need to fix this call, if lbsa71 saw this he would die.
m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
CachedUserInfo userInfo =
m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId);
m_userTransactions.Manager.CommsManager.UserProfileCacheService.GetUserDetails(ourClient.AgentId);
if (userInfo != null)
{
InventoryItemBase item = new InventoryItemBase();

View File

@ -64,11 +64,11 @@ namespace OpenSim.Framework.Communications
get { return m_interRegion; }
}
protected UserProfileCacheService m_userProfileCache;
protected UserProfileCacheService m_userProfileCacheService;
public UserProfileCacheService UserProfileCache
public UserProfileCacheService UserProfileCacheService
{
get { return m_userProfileCache; }
get { return m_userProfileCacheService; }
}
protected AssetTransactionManager m_transactionsManager;
@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications
{
m_networkServersInfo = serversInfo;
m_assetCache = assetCache;
m_userProfileCache = new UserProfileCacheService(this);
m_userProfileCacheService = new UserProfileCacheService(this);
m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile);
}
@ -156,7 +156,7 @@ namespace OpenSim.Framework.Communications
public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
{
if (uuid == m_userProfileCache.libraryRoot.agentID)
if (uuid == m_userProfileCacheService.libraryRoot.agentID)
{
remote_client.SendNameReply(uuid, "Mr", "OpenSim");
}
@ -175,11 +175,7 @@ namespace OpenSim.Framework.Communications
}
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
{
List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
return pickerlist;
}

View File

@ -1,5 +1,6 @@
using System;
using libsecondlife;
using System.Collections.Generic;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
@ -11,18 +12,30 @@ namespace OpenSim.Region.Environment.Modules
public class AvatarFactoryModule : IAvatarFactory
{
private Scene m_scene = null;
private Dictionary<LLUUID, AvatarWearing> m_avatarsClothes = new Dictionary<LLUUID, AvatarWearing>();
public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
out byte[] visualParams)
{
if (!m_avatarsClothes.ContainsKey(avatarId))
{
GetDefaultAvatarAppearance(out wearables, out visualParams);
AvatarWearing wearing = new AvatarWearing(wearables);
m_avatarsClothes[avatarId] = wearing;
return true;
}
else
{
visualParams = SetDefaultVisualParams();
wearables = m_avatarsClothes[avatarId].IsWearing;
return true;
}
}
public void Initialise(Scene scene, IConfigSource source)
{
scene.RegisterModuleInterface<IAvatarFactory>(this);
// scene.EventManager.OnNewClient += NewClient;
scene.EventManager.OnNewClient += NewClient;
if (m_scene == null)
{
@ -50,7 +63,7 @@ namespace OpenSim.Region.Environment.Modules
public void NewClient(IClientAPI client)
{
// client.OnAvatarNowWearing += AvatarIsWearing;
client.OnAvatarNowWearing += AvatarIsWearing;
}
public void RemoveClient(IClientAPI client)
@ -64,15 +77,25 @@ namespace OpenSim.Region.Environment.Modules
//Todo look up the assetid from the inventory cache (or something) for each itemId that is in AvatarWearingArgs
// then store assetid and itemId and wearable type in a database
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
{
if (wear.Type < 13)
{
LLUUID assetId;
CachedUserInfo profile = m_scene.CommsManager.UserProfileCache.GetUserDetails(clientView.AgentId);
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
if (profile != null)
{
InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID);
if (baseItem != null)
{
assetId = baseItem.assetID;
//Tempoaray dictionary storage. This is be storing to a database
if (m_avatarsClothes.ContainsKey(clientView.AgentId))
{
AvatarWearing avWearing = m_avatarsClothes[clientView.AgentId];
avWearing.IsWearing[wear.Type].AssetID = assetId;
avWearing.IsWearing[wear.Type].ItemID = wear.ItemID;
}
}
}
}
}
@ -80,13 +103,57 @@ namespace OpenSim.Region.Environment.Modules
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
{
visualParams = SetDefaultVisualParams();
wearables = AvatarWearable.DefaultWearables;
}
private static byte[] SetDefaultVisualParams()
{
byte[] visualParams;
visualParams = new byte[218];
for (int i = 0; i < 218; i++)
{
visualParams[i] = 100;
}
return visualParams;
}
wearables = AvatarWearable.DefaultWearables;
public class AvatarWearing
{
public AvatarWearable[] IsWearing;
public AvatarWearing()
{
IsWearing = new AvatarWearable[13];
for (int i = 0; i < 13; i++)
{
IsWearing[i] = new AvatarWearable();
}
}
public AvatarWearing(AvatarWearable[] wearing)
{
if (wearing.Length == 13)
{
IsWearing = new AvatarWearable[13];
for (int i = 0; i < 13; i++)
{
IsWearing[i] = new AvatarWearable();
IsWearing[i].AssetID = wearing[i].AssetID;
IsWearing[i].ItemID = wearing[i].ItemID;
}
}
else
{
IsWearing = new AvatarWearable[13];
for (int i = 0; i < 13; i++)
{
IsWearing[i] = new AvatarWearable();
}
}
}
}
}
}

View File

@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
{
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
userInfo.AddItem(remoteClient.AgentId, item);
@ -75,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes
public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
{
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
if (userInfo.RootFolder != null)
@ -109,7 +109,7 @@ namespace OpenSim.Region.Environment.Scenes
public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
LLUUID itemID)
{
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
if (userInfo.RootFolder != null)
@ -157,10 +157,10 @@ namespace OpenSim.Region.Environment.Scenes
public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, string newName)
{
InventoryItemBase item = CommsManager.UserProfileCache.libraryRoot.HasItem(oldItemID);
InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(oldItemID);
if (item == null)
{
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(oldAgentID);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID);
if (userInfo == null)
{
MainLog.Instance.Warn("INVENTORY", "Failed to find user " + oldAgentID.ToString());
@ -212,7 +212,7 @@ namespace OpenSim.Region.Environment.Scenes
private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
AssetBase asset, uint nextOwnerMask)
{
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
InventoryItemBase item = new InventoryItemBase();
@ -252,7 +252,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (transActionID == LLUUID.Zero)
{
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
AssetBase asset = CreateAsset(name, description, invType, assetType, null);
@ -320,7 +320,7 @@ namespace OpenSim.Region.Environment.Scenes
public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
{
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
LLUUID copyID = LLUUID.Random();
if (userInfo != null)
{
@ -398,7 +398,7 @@ namespace OpenSim.Region.Environment.Scenes
if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
{
string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
AssetBase asset = CreateAsset(
@ -454,7 +454,7 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
{
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
if (userInfo.RootFolder != null)

View File

@ -949,7 +949,7 @@ namespace OpenSim.Region.Environment.Scenes
CreateAndAddScenePresence(client, child);
m_LandManager.sendParcelOverlay(client);
CommsManager.UserProfileCache.AddNewUser(client.AgentId);
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
CommsManager.TransactionsManager.AddUser(client.AgentId);
}
@ -999,10 +999,10 @@ namespace OpenSim.Region.Environment.Scenes
client.OnGodKickUser += handleGodlikeKickUser;
client.OnCreateNewInventoryItem += CreateNewInventoryItem;
client.OnCreateNewInventoryFolder += CommsManager.UserProfileCache.HandleCreateInventoryFolder;
client.OnFetchInventoryDescendents += CommsManager.UserProfileCache.HandleFecthInventoryDescendents;
client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder;
client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFecthInventoryDescendents;
client.OnRequestTaskInventory += RequestTaskInventory;
client.OnFetchInventory += CommsManager.UserProfileCache.HandleFetchInventory;
client.OnFetchInventory += CommsManager.UserProfileCacheService.HandleFetchInventory;
client.OnUpdateInventoryItem += UDPUpdateInventoryItemAsset;
client.OnCopyInventoryItem += CopyInventoryItem;
client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest;