testing avatar appearance as a user service

0.6.0-stable
Sean Dague 2008-05-15 20:25:42 +00:00
parent 3dcc3e4798
commit 4a9ee9f870
7 changed files with 57 additions and 38 deletions

View File

@ -747,15 +747,15 @@ namespace OpenSim.Data.MSSQL
/// Appearance /// Appearance
/// TODO: stubs for now to get us to a compiling state gently /// TODO: stubs for now to get us to a compiling state gently
override public AvatarAppearance GetUserAppearance(LLUUID user) // override public AvatarAppearance GetUserAppearance(LLUUID user)
{ // {
return new AvatarAppearance(); // return new AvatarAppearance();
} // }
override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) // override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
{ // {
return; // return;
} // }
override public void AddAttachment(LLUUID user, LLUUID item) override public void AddAttachment(LLUUID user, LLUUID item)
{ {

View File

@ -630,15 +630,15 @@ namespace OpenSim.Data.MySQL
/// Appearance /// Appearance
/// TODO: stubs for now to get us to a compiling state gently /// TODO: stubs for now to get us to a compiling state gently
override public AvatarAppearance GetUserAppearance(LLUUID user) // override public AvatarAppearance GetUserAppearance(LLUUID user)
{ // {
return new AvatarAppearance(); // return new AvatarAppearance();
} // }
override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) // override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
{ // {
return; // return;
} // }
override public void AddAttachment(LLUUID user, LLUUID item) override public void AddAttachment(LLUUID user, LLUUID item)
{ {

View File

@ -306,7 +306,7 @@ namespace OpenSim.Data.NHibernate
/// Appearance /// Appearance
/// TODO: stubs for now to get us to a compiling state gently /// TODO: stubs for now to get us to a compiling state gently
override public AvatarAppearance GetUserAppearance(LLUUID user) public AvatarAppearance GetUserAppearance(LLUUID user)
{ {
AvatarAppearance appearance; AvatarAppearance appearance;
// TODO: I'm sure I'll have to do something silly here // TODO: I'm sure I'll have to do something silly here
@ -328,7 +328,7 @@ namespace OpenSim.Data.NHibernate
} }
override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
{ {
bool exists = ExistsAppearance(user); bool exists = ExistsAppearance(user);
using (ISession session = factory.OpenSession()) using (ISession session = factory.OpenSession())

View File

@ -480,15 +480,15 @@ namespace OpenSim.Data.SQLite
/// Appearance /// Appearance
/// TODO: stubs for now to get us to a compiling state gently /// TODO: stubs for now to get us to a compiling state gently
override public AvatarAppearance GetUserAppearance(LLUUID user) // override public AvatarAppearance GetUserAppearance(LLUUID user)
{ // {
return new AvatarAppearance(); // return new AvatarAppearance();
} // }
override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) // override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
{ // {
return; // return;
} // }
override public void AddAttachment(LLUUID user, LLUUID item) override public void AddAttachment(LLUUID user, LLUUID item)
{ {

View File

@ -33,6 +33,8 @@ namespace OpenSim.Data
{ {
public abstract class UserDataBase : IUserData public abstract class UserDataBase : IUserData
{ {
private Dictionary<LLUUID, AvatarAppearance> aplist = new Dictionary<LLUUID, AvatarAppearance>();
public abstract UserProfileData GetUserByUUID(LLUUID user); public abstract UserProfileData GetUserByUUID(LLUUID user);
public abstract UserProfileData GetUserByName(string fname, string lname); public abstract UserProfileData GetUserByName(string fname, string lname);
public abstract UserAgentData GetAgentByUUID(LLUUID user); public abstract UserAgentData GetAgentByUUID(LLUUID user);
@ -53,8 +55,16 @@ namespace OpenSim.Data
public abstract string Name {get;} public abstract string Name {get;}
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 abstract AvatarAppearance GetUserAppearance(LLUUID user); public AvatarAppearance GetUserAppearance(LLUUID user) {
public abstract void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); if (aplist[user] != null) {
aplist[user] = new AvatarAppearance();
aplist[user].Owner = user;
}
return aplist[user];
}
public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) {
aplist[user] = appearance;
}
public abstract void AddAttachment(LLUUID user, LLUUID item); public abstract void AddAttachment(LLUUID user, LLUUID item);
public abstract void RemoveAttachment(LLUUID user, LLUUID item); public abstract void RemoveAttachment(LLUUID user, LLUUID item);
public abstract List<LLUUID> GetAttachments(LLUUID user); public abstract List<LLUUID> GetAttachments(LLUUID user);

View File

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

View File

@ -405,6 +405,8 @@ namespace OpenSim.Region.Environment.Scenes
RegisterToEvents(); RegisterToEvents();
SetDirectionVectors(); SetDirectionVectors();
m_appearance = m_scene.CommsManager.UserService.GetUserAppearance(client.AgentId);
try try
{ {
m_scene.LandChannel.SendLandUpdate(this, true); m_scene.LandChannel.SendLandUpdate(this, true);
@ -1465,6 +1467,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable) public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable)
{ {
m_appearance.SetWearable(wearableId, wearable); m_appearance.SetWearable(wearableId, wearable);
m_scene.CommsManager.UserService.UpdateUserAppearance(client.AgentId, m_appearance);
client.SendWearables(m_appearance.Wearables, m_appearance.Serial++); client.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
} }
@ -1506,6 +1509,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SetAppearance(byte[] texture, List<byte> visualParam) public void SetAppearance(byte[] texture, List<byte> visualParam)
{ {
m_appearance.SetAppearance(texture, visualParam); m_appearance.SetAppearance(texture, visualParam);
m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
SetHeight(m_appearance.AvatarHeight); SetHeight(m_appearance.AvatarHeight);
SendAppearanceToAllOtherAgents(); SendAppearanceToAllOtherAgents();
@ -1804,6 +1808,7 @@ namespace OpenSim.Region.Environment.Scenes
static ScenePresence() static ScenePresence()
{ {
LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTexture();
DefaultTexture = textu.ToBytes(); DefaultTexture = textu.ToBytes();
} }
@ -2030,6 +2035,8 @@ namespace OpenSim.Region.Environment.Scenes
m_controllingClient = client; m_controllingClient = client;
m_regionInfo = region; m_regionInfo = region;
m_scene = scene; m_scene = scene;
m_appearance = m_scene.CommsManager.UserService.GetUserAppearance(client.AgentId);
RegisterToEvents(); RegisterToEvents();
/* /*