From 4a9ee9f870b53abbc5ba8814c35d694c3fd186a1 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 15 May 2008 20:25:42 +0000 Subject: testing avatar appearance as a user service --- OpenSim/Data/MSSQL/MSSQLUserData.cs | 18 +++++++++--------- OpenSim/Data/MySQL/MySQLUserData.cs | 18 +++++++++--------- OpenSim/Data/NHibernate/NHibernateUserData.cs | 4 ++-- OpenSim/Data/SQLite/SQLiteUserData.cs | 18 +++++++++--------- OpenSim/Data/UserDataBase.cs | 14 ++++++++++++-- OpenSim/Region/Environment/Scenes/Scene.cs | 22 ++++++++++++---------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 7 +++++++ 7 files changed, 60 insertions(+), 41 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index 4904bfe..844b7fa 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs @@ -747,15 +747,15 @@ namespace OpenSim.Data.MSSQL /// Appearance /// TODO: stubs for now to get us to a compiling state gently - override public AvatarAppearance GetUserAppearance(LLUUID user) - { - return new AvatarAppearance(); - } - - override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) - { - return; - } + // override public AvatarAppearance GetUserAppearance(LLUUID user) + // { + // return new AvatarAppearance(); + // } + + // override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) + // { + // return; + // } override public void AddAttachment(LLUUID user, LLUUID item) { diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 622a618..a1e1094 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs @@ -630,15 +630,15 @@ namespace OpenSim.Data.MySQL /// Appearance /// TODO: stubs for now to get us to a compiling state gently - override public AvatarAppearance GetUserAppearance(LLUUID user) - { - return new AvatarAppearance(); - } - - override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) - { - return; - } + // override public AvatarAppearance GetUserAppearance(LLUUID user) + // { + // return new AvatarAppearance(); + // } + + // override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) + // { + // return; + // } override public void AddAttachment(LLUUID user, LLUUID item) { diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index 81af4d4..6ba2783 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs @@ -306,7 +306,7 @@ namespace OpenSim.Data.NHibernate /// Appearance /// 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; // 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); using (ISession session = factory.OpenSession()) diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index e80a0a9..8f78e0b 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs @@ -480,15 +480,15 @@ namespace OpenSim.Data.SQLite /// Appearance /// TODO: stubs for now to get us to a compiling state gently - override public AvatarAppearance GetUserAppearance(LLUUID user) - { - return new AvatarAppearance(); - } - - override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) - { - return; - } + // override public AvatarAppearance GetUserAppearance(LLUUID user) + // { + // return new AvatarAppearance(); + // } + + // override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) + // { + // return; + // } override public void AddAttachment(LLUUID user, LLUUID item) { diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs index fb784dc..a4e2941 100644 --- a/OpenSim/Data/UserDataBase.cs +++ b/OpenSim/Data/UserDataBase.cs @@ -33,6 +33,8 @@ namespace OpenSim.Data { public abstract class UserDataBase : IUserData { + private Dictionary aplist = new Dictionary(); + public abstract UserProfileData GetUserByUUID(LLUUID user); public abstract UserProfileData GetUserByName(string fname, string lname); public abstract UserAgentData GetAgentByUUID(LLUUID user); @@ -53,8 +55,16 @@ namespace OpenSim.Data public abstract string Name {get;} public abstract void Initialise(string connect); public abstract List GeneratePickerResults(LLUUID queryID, string query); - public abstract AvatarAppearance GetUserAppearance(LLUUID user); - public abstract void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); + public AvatarAppearance GetUserAppearance(LLUUID user) { + 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 RemoveAttachment(LLUUID user, LLUUID item); public abstract List GetAttachments(LLUUID user); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 51f2942..1964ef4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1797,16 +1797,18 @@ namespace OpenSim.Region.Environment.Scenes protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) { - if (m_AvatarFactory == null || - !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; - GetDefaultAvatarAppearance(out wearables, out visualParams); - appearance = new AvatarAppearance(client.AgentId, wearables, visualParams); - } + appearance = CommsManager.UserService.GetUserAppearance(client.AgentId); + + // if (m_AvatarFactory == null || + // !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; + // GetDefaultAvatarAppearance(out wearables, out visualParams); + // appearance = new AvatarAppearance(client.AgentId, wearables, visualParams); + // } } /// diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 3815dfb..f8f96a0 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -405,6 +405,8 @@ namespace OpenSim.Region.Environment.Scenes RegisterToEvents(); SetDirectionVectors(); + m_appearance = m_scene.CommsManager.UserService.GetUserAppearance(client.AgentId); + try { m_scene.LandChannel.SendLandUpdate(this, true); @@ -1465,6 +1467,7 @@ namespace OpenSim.Region.Environment.Scenes public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable) { m_appearance.SetWearable(wearableId, wearable); + m_scene.CommsManager.UserService.UpdateUserAppearance(client.AgentId, m_appearance); client.SendWearables(m_appearance.Wearables, m_appearance.Serial++); } @@ -1506,6 +1509,7 @@ namespace OpenSim.Region.Environment.Scenes public void SetAppearance(byte[] texture, List visualParam) { m_appearance.SetAppearance(texture, visualParam); + m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); SetHeight(m_appearance.AvatarHeight); SendAppearanceToAllOtherAgents(); @@ -1804,6 +1808,7 @@ namespace OpenSim.Region.Environment.Scenes static ScenePresence() { + LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); DefaultTexture = textu.ToBytes(); } @@ -2030,6 +2035,8 @@ namespace OpenSim.Region.Environment.Scenes m_controllingClient = client; m_regionInfo = region; m_scene = scene; + m_appearance = m_scene.CommsManager.UserService.GetUserAppearance(client.AgentId); + RegisterToEvents(); /* -- cgit v1.1