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
parent
86ae8e97cd
commit
cac98171e5
|
@ -333,7 +333,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
//really need to fix this call, if lbsa71 saw this he would die.
|
//really need to fix this call, if lbsa71 saw this he would die.
|
||||||
m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
|
m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
|
||||||
CachedUserInfo userInfo =
|
CachedUserInfo userInfo =
|
||||||
m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId);
|
m_userTransactions.Manager.CommsManager.UserProfileCacheService.GetUserDetails(ourClient.AgentId);
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
InventoryItemBase item = new InventoryItemBase();
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
|
|
|
@ -64,11 +64,11 @@ namespace OpenSim.Framework.Communications
|
||||||
get { return m_interRegion; }
|
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;
|
protected AssetTransactionManager m_transactionsManager;
|
||||||
|
@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications
|
||||||
{
|
{
|
||||||
m_networkServersInfo = serversInfo;
|
m_networkServersInfo = serversInfo;
|
||||||
m_assetCache = assetCache;
|
m_assetCache = assetCache;
|
||||||
m_userProfileCache = new UserProfileCacheService(this);
|
m_userProfileCacheService = new UserProfileCacheService(this);
|
||||||
m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile);
|
m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ namespace OpenSim.Framework.Communications
|
||||||
|
|
||||||
public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
|
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");
|
remote_client.SendNameReply(uuid, "Mr", "OpenSim");
|
||||||
}
|
}
|
||||||
|
@ -175,11 +175,7 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
|
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
|
||||||
{
|
{
|
||||||
|
List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
|
||||||
|
|
||||||
List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
|
|
||||||
|
|
||||||
|
|
||||||
return pickerlist;
|
return pickerlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
@ -11,18 +12,30 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
public class AvatarFactoryModule : IAvatarFactory
|
public class AvatarFactoryModule : IAvatarFactory
|
||||||
{
|
{
|
||||||
private Scene m_scene = null;
|
private Scene m_scene = null;
|
||||||
|
private Dictionary<LLUUID, AvatarWearing> m_avatarsClothes = new Dictionary<LLUUID, AvatarWearing>();
|
||||||
|
|
||||||
public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
|
public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables,
|
||||||
out byte[] visualParams)
|
out byte[] visualParams)
|
||||||
{
|
{
|
||||||
GetDefaultAvatarAppearance(out wearables, out visualParams);
|
if (!m_avatarsClothes.ContainsKey(avatarId))
|
||||||
return true;
|
{
|
||||||
|
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)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
{
|
||||||
scene.RegisterModuleInterface<IAvatarFactory>(this);
|
scene.RegisterModuleInterface<IAvatarFactory>(this);
|
||||||
// scene.EventManager.OnNewClient += NewClient;
|
scene.EventManager.OnNewClient += NewClient;
|
||||||
|
|
||||||
if (m_scene == null)
|
if (m_scene == null)
|
||||||
{
|
{
|
||||||
|
@ -50,43 +63,97 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
|
|
||||||
public void NewClient(IClientAPI client)
|
public void NewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
// client.OnAvatarNowWearing += AvatarIsWearing;
|
client.OnAvatarNowWearing += AvatarIsWearing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveClient(IClientAPI client)
|
public void RemoveClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
// client.OnAvatarNowWearing -= AvatarIsWearing;
|
// client.OnAvatarNowWearing -= AvatarIsWearing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
|
public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
|
||||||
{
|
{
|
||||||
IClientAPI clientView = (IClientAPI) sender;
|
IClientAPI clientView = (IClientAPI)sender;
|
||||||
//Todo look up the assetid from the inventory cache (or something) for each itemId that is in AvatarWearingArgs
|
//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
|
// then store assetid and itemId and wearable type in a database
|
||||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||||
{
|
|
||||||
LLUUID assetId;
|
|
||||||
CachedUserInfo profile = m_scene.CommsManager.UserProfileCache.GetUserDetails(clientView.AgentId);
|
|
||||||
if (profile != null)
|
|
||||||
{
|
{
|
||||||
InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID);
|
if (wear.Type < 13)
|
||||||
if (baseItem != null)
|
|
||||||
{
|
{
|
||||||
assetId = baseItem.assetID;
|
LLUUID assetId;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
|
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];
|
visualParams = new byte[218];
|
||||||
for (int i = 0; i < 218; i++)
|
for (int i = 0; i < 218; i++)
|
||||||
{
|
{
|
||||||
visualParams[i] = 100;
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
|
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
userInfo.AddItem(remoteClient.AgentId, item);
|
userInfo.AddItem(remoteClient.AgentId, item);
|
||||||
|
@ -75,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
|
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 != null)
|
||||||
{
|
{
|
||||||
if (userInfo.RootFolder != null)
|
if (userInfo.RootFolder != null)
|
||||||
|
@ -109,7 +109,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
|
public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
|
||||||
LLUUID itemID)
|
LLUUID itemID)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
if (userInfo.RootFolder != 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)
|
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)
|
if (item == null)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(oldAgentID);
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID);
|
||||||
if (userInfo == null)
|
if (userInfo == null)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Warn("INVENTORY", "Failed to find user " + oldAgentID.ToString());
|
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,
|
private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
|
||||||
AssetBase asset, uint nextOwnerMask)
|
AssetBase asset, uint nextOwnerMask)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
InventoryItemBase item = new InventoryItemBase();
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
|
@ -252,7 +252,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
if (transActionID == LLUUID.Zero)
|
if (transActionID == LLUUID.Zero)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
AssetBase asset = CreateAsset(name, description, invType, assetType, 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)
|
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();
|
LLUUID copyID = LLUUID.Random();
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
|
@ -398,7 +398,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
|
if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
|
||||||
{
|
{
|
||||||
string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
|
string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
|
||||||
CachedUserInfo userInfo = CommsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
|
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
AssetBase asset = CreateAsset(
|
AssetBase asset = CreateAsset(
|
||||||
|
@ -454,7 +454,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public virtual void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
|
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 != null)
|
||||||
{
|
{
|
||||||
if (userInfo.RootFolder != null)
|
if (userInfo.RootFolder != null)
|
||||||
|
|
|
@ -949,7 +949,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
CreateAndAddScenePresence(client, child);
|
CreateAndAddScenePresence(client, child);
|
||||||
|
|
||||||
m_LandManager.sendParcelOverlay(client);
|
m_LandManager.sendParcelOverlay(client);
|
||||||
CommsManager.UserProfileCache.AddNewUser(client.AgentId);
|
CommsManager.UserProfileCacheService.AddNewUser(client.AgentId);
|
||||||
CommsManager.TransactionsManager.AddUser(client.AgentId);
|
CommsManager.TransactionsManager.AddUser(client.AgentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,10 +999,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
client.OnGodKickUser += handleGodlikeKickUser;
|
client.OnGodKickUser += handleGodlikeKickUser;
|
||||||
|
|
||||||
client.OnCreateNewInventoryItem += CreateNewInventoryItem;
|
client.OnCreateNewInventoryItem += CreateNewInventoryItem;
|
||||||
client.OnCreateNewInventoryFolder += CommsManager.UserProfileCache.HandleCreateInventoryFolder;
|
client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder;
|
||||||
client.OnFetchInventoryDescendents += CommsManager.UserProfileCache.HandleFecthInventoryDescendents;
|
client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFecthInventoryDescendents;
|
||||||
client.OnRequestTaskInventory += RequestTaskInventory;
|
client.OnRequestTaskInventory += RequestTaskInventory;
|
||||||
client.OnFetchInventory += CommsManager.UserProfileCache.HandleFetchInventory;
|
client.OnFetchInventory += CommsManager.UserProfileCacheService.HandleFetchInventory;
|
||||||
client.OnUpdateInventoryItem += UDPUpdateInventoryItemAsset;
|
client.OnUpdateInventoryItem += UDPUpdateInventoryItemAsset;
|
||||||
client.OnCopyInventoryItem += CopyInventoryItem;
|
client.OnCopyInventoryItem += CopyInventoryItem;
|
||||||
client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest;
|
client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest;
|
||||||
|
|
Loading…
Reference in New Issue