this removes use of the mapper for wearables, and I can confirm things
get saved to the database. There are still issues on wearing things after a cleared cache that I'm looking at now.0.6.0-stable
parent
0b719286a4
commit
53bcf2139e
|
@ -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 AvatarAppearance GetUserAppearance(LLUUID user)
|
||||
{
|
||||
return new AvatarAppearance();
|
||||
}
|
||||
|
||||
// override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
override public void AddAttachment(LLUUID user, LLUUID item)
|
||||
{
|
||||
|
|
|
@ -191,6 +191,12 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public void ExecuteSql(string sql)
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Given a list of tables, return the version of the tables, as seen in the database
|
||||
/// </summary>
|
||||
|
@ -532,38 +538,42 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
public AvatarAppearance readAppearanceRow(IDataReader reader)
|
||||
{
|
||||
AvatarAppearance appearance = new AvatarAppearance();
|
||||
appearance.Owner = new LLUUID((string)reader["owner"]);
|
||||
appearance.Serial = Convert.ToInt32(reader["serial"]);
|
||||
appearance.VisualParams = (byte[])reader["visual_params"];
|
||||
appearance.Texture = new LLObject.TextureEntry((byte[])reader["texture"], 0, ((byte[])reader["texture"]).Length);
|
||||
appearance.AvatarHeight = (float)Convert.ToDouble(reader["avatar_height"]);
|
||||
appearance.BodyItem = new LLUUID((string)reader["body_item"]);
|
||||
appearance.BodyAsset = new LLUUID((string)reader["body_asset"]);
|
||||
appearance.SkinItem = new LLUUID((string)reader["skin_item"]);
|
||||
appearance.SkinAsset = new LLUUID((string)reader["skin_asset"]);
|
||||
appearance.HairItem = new LLUUID((string)reader["hair_item"]);
|
||||
appearance.HairAsset = new LLUUID((string)reader["hair_asset"]);
|
||||
appearance.EyesItem = new LLUUID((string)reader["eyes_item"]);
|
||||
appearance.EyesAsset = new LLUUID((string)reader["eyes_asset"]);
|
||||
appearance.ShirtItem = new LLUUID((string)reader["shirt_item"]);
|
||||
appearance.ShirtAsset = new LLUUID((string)reader["shirt_asset"]);
|
||||
appearance.PantsItem = new LLUUID((string)reader["pants_item"]);
|
||||
appearance.PantsAsset = new LLUUID((string)reader["pants_asset"]);
|
||||
appearance.ShoesItem = new LLUUID((string)reader["shoes_item"]);
|
||||
appearance.ShoesAsset = new LLUUID((string)reader["shoes_asset"]);
|
||||
appearance.SocksItem = new LLUUID((string)reader["socks_item"]);
|
||||
appearance.SocksAsset = new LLUUID((string)reader["socks_asset"]);
|
||||
appearance.JacketItem = new LLUUID((string)reader["jacket_item"]);
|
||||
appearance.JacketAsset = new LLUUID((string)reader["jacket_asset"]);
|
||||
appearance.GlovesItem = new LLUUID((string)reader["gloves_item"]);
|
||||
appearance.GlovesAsset = new LLUUID((string)reader["gloves_asset"]);
|
||||
appearance.UnderShirtItem = new LLUUID((string)reader["undershirt_item"]);
|
||||
appearance.UnderShirtAsset = new LLUUID((string)reader["undershirt_asset"]);
|
||||
appearance.UnderPantsItem = new LLUUID((string)reader["underpants_item"]);
|
||||
appearance.UnderPantsAsset = new LLUUID((string)reader["underpants_asset"]);
|
||||
appearance.SkirtItem = new LLUUID((string)reader["skirt_item"]);
|
||||
appearance.SkirtAsset = new LLUUID((string)reader["skirt_asset"]);
|
||||
AvatarAppearance appearance = null;
|
||||
if (reader.Read())
|
||||
{
|
||||
appearance = new AvatarAppearance();
|
||||
appearance.Owner = new LLUUID((string)reader["owner"]);
|
||||
appearance.Serial = Convert.ToInt32(reader["serial"]);
|
||||
appearance.VisualParams = (byte[])reader["visual_params"];
|
||||
appearance.Texture = new LLObject.TextureEntry((byte[])reader["texture"], 0, ((byte[])reader["texture"]).Length);
|
||||
appearance.AvatarHeight = (float)Convert.ToDouble(reader["avatar_height"]);
|
||||
appearance.BodyItem = new LLUUID((string)reader["body_item"]);
|
||||
appearance.BodyAsset = new LLUUID((string)reader["body_asset"]);
|
||||
appearance.SkinItem = new LLUUID((string)reader["skin_item"]);
|
||||
appearance.SkinAsset = new LLUUID((string)reader["skin_asset"]);
|
||||
appearance.HairItem = new LLUUID((string)reader["hair_item"]);
|
||||
appearance.HairAsset = new LLUUID((string)reader["hair_asset"]);
|
||||
appearance.EyesItem = new LLUUID((string)reader["eyes_item"]);
|
||||
appearance.EyesAsset = new LLUUID((string)reader["eyes_asset"]);
|
||||
appearance.ShirtItem = new LLUUID((string)reader["shirt_item"]);
|
||||
appearance.ShirtAsset = new LLUUID((string)reader["shirt_asset"]);
|
||||
appearance.PantsItem = new LLUUID((string)reader["pants_item"]);
|
||||
appearance.PantsAsset = new LLUUID((string)reader["pants_asset"]);
|
||||
appearance.ShoesItem = new LLUUID((string)reader["shoes_item"]);
|
||||
appearance.ShoesAsset = new LLUUID((string)reader["shoes_asset"]);
|
||||
appearance.SocksItem = new LLUUID((string)reader["socks_item"]);
|
||||
appearance.SocksAsset = new LLUUID((string)reader["socks_asset"]);
|
||||
appearance.JacketItem = new LLUUID((string)reader["jacket_item"]);
|
||||
appearance.JacketAsset = new LLUUID((string)reader["jacket_asset"]);
|
||||
appearance.GlovesItem = new LLUUID((string)reader["gloves_item"]);
|
||||
appearance.GlovesAsset = new LLUUID((string)reader["gloves_asset"]);
|
||||
appearance.UnderShirtItem = new LLUUID((string)reader["undershirt_item"]);
|
||||
appearance.UnderShirtAsset = new LLUUID((string)reader["undershirt_asset"]);
|
||||
appearance.UnderPantsItem = new LLUUID((string)reader["underpants_item"]);
|
||||
appearance.UnderPantsAsset = new LLUUID((string)reader["underpants_asset"]);
|
||||
appearance.SkirtItem = new LLUUID((string)reader["skirt_item"]);
|
||||
appearance.SkirtAsset = new LLUUID((string)reader["skirt_asset"]);
|
||||
}
|
||||
return appearance;
|
||||
}
|
||||
|
||||
|
@ -1007,10 +1017,10 @@ namespace OpenSim.Data.MySQL
|
|||
MySqlCommand cmd = (MySqlCommand) dbcon.CreateCommand();
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.AddWithValue("?owner", appearance.Owner.ToString());
|
||||
cmd.Parameters.AddWithValue("?serial", appearance.Serial.ToString());
|
||||
cmd.Parameters.AddWithValue("?serial", appearance.Serial);
|
||||
cmd.Parameters.AddWithValue("?visual_params", appearance.VisualParams);
|
||||
cmd.Parameters.AddWithValue("?texture", appearance.Texture.ToBytes());
|
||||
cmd.Parameters.AddWithValue("?avatar_height", appearance.AvatarHeight.ToString());
|
||||
cmd.Parameters.AddWithValue("?avatar_height", appearance.AvatarHeight);
|
||||
cmd.Parameters.AddWithValue("?body_item", appearance.BodyItem.ToString());
|
||||
cmd.Parameters.AddWithValue("?body_asset", appearance.BodyAsset.ToString());
|
||||
cmd.Parameters.AddWithValue("?skin_item", appearance.SkinItem.ToString());
|
||||
|
@ -1038,11 +1048,9 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("?skirt_item", appearance.SkirtItem.ToString());
|
||||
cmd.Parameters.AddWithValue("?skirt_asset", appearance.SkirtAsset.ToString());
|
||||
|
||||
int x;
|
||||
if ((x = cmd.ExecuteNonQuery()) > 0)
|
||||
{
|
||||
if (cmd.ExecuteNonQuery() > 0)
|
||||
returnval = true;
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -34,8 +34,6 @@ using libsecondlife;
|
|||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Data.Base;
|
||||
using OpenSim.Data.MapperFactory;
|
||||
using OpenSim.Data.MySQLMapper;
|
||||
|
||||
namespace OpenSim.Data.MySQL
|
||||
{
|
||||
|
@ -56,8 +54,6 @@ namespace OpenSim.Data.MySQL
|
|||
private string m_userFriendsTableName;
|
||||
private string m_appearanceTableName = "avatarappearance";
|
||||
private string m_connectString;
|
||||
private BaseDatabaseConnector m_databaseMapper;
|
||||
private AppearanceTableMapper m_appearanceMapper;
|
||||
|
||||
/// <summary>
|
||||
/// Loads and initialises the MySQL storage plugin
|
||||
|
@ -107,15 +103,6 @@ namespace OpenSim.Data.MySQL
|
|||
database = new MySQLManager(m_connectString);
|
||||
}
|
||||
|
||||
string mapperTypeStr = "MySQL";
|
||||
DataMapperFactory.MAPPER_TYPE mapperType =
|
||||
(DataMapperFactory.MAPPER_TYPE)
|
||||
Enum.Parse(typeof (DataMapperFactory.MAPPER_TYPE), mapperTypeStr);
|
||||
|
||||
m_databaseMapper = DataMapperFactory.GetDataBaseMapper(mapperType, m_connectString);
|
||||
|
||||
m_appearanceMapper = new AppearanceTableMapper(m_databaseMapper, "AvatarAppearance");
|
||||
|
||||
TestTables();
|
||||
}
|
||||
|
||||
|
@ -204,6 +191,12 @@ namespace OpenSim.Data.MySQL
|
|||
database.ExecuteResourceSql("CreateAvatarAppearance.sql");
|
||||
return;
|
||||
}
|
||||
else if (oldVersion.Contains("Rev.1"))
|
||||
{
|
||||
database.ExecuteSql("drop table avatarappearance");
|
||||
database.ExecuteResourceSql("CreateAvatarAppearance.sql");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -676,18 +669,35 @@ namespace OpenSim.Data.MySQL
|
|||
// override
|
||||
override public AvatarAppearance GetUserAppearance(LLUUID user)
|
||||
{
|
||||
AvatarAppearance appearance = null;
|
||||
if (!m_appearanceMapper.TryGetValue(user.UUID, out appearance))
|
||||
{
|
||||
appearance = null;
|
||||
}
|
||||
return appearance;
|
||||
}
|
||||
try {
|
||||
lock (database)
|
||||
{
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?owner"] = user.ToString();
|
||||
|
||||
IDbCommand result = database.Query("SELECT * FROM " + m_appearanceTableName + " WHERE owner = ?owner", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
AvatarAppearance appearance = database.readAppearanceRow(reader);
|
||||
|
||||
reader.Close();
|
||||
result.Dispose();
|
||||
|
||||
return appearance;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
database.Reconnect();
|
||||
m_log.Error(e.ToString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// override
|
||||
override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
|
||||
{
|
||||
m_appearanceMapper.Update(user.UUID, appearance);
|
||||
appearance.Owner = user;
|
||||
database.insertAppearanceRow(appearance);
|
||||
}
|
||||
|
||||
override public void AddAttachment(LLUUID user, LLUUID item)
|
||||
|
|
|
@ -4,36 +4,39 @@
|
|||
|
||||
DROP TABLE IF EXISTS `avatarappearance`;
|
||||
CREATE TABLE `avatarappearance` (
|
||||
`UUID` char(36) NOT NULL,
|
||||
`Serial` int(10) unsigned NOT NULL,
|
||||
`WearableItem0` char(36) NOT NULL,
|
||||
`WearableAsset0` char(36) NOT NULL,
|
||||
`WearableItem1` char(36) NOT NULL,
|
||||
`WearableAsset1` char(36) NOT NULL,
|
||||
`WearableItem2` char(36) NOT NULL,
|
||||
`WearableAsset2` char(36) NOT NULL,
|
||||
`WearableItem3` char(36) NOT NULL,
|
||||
`WearableAsset3` char(36) NOT NULL,
|
||||
`WearableItem4` char(36) NOT NULL,
|
||||
`WearableAsset4` char(36) NOT NULL,
|
||||
`WearableItem5` char(36) NOT NULL,
|
||||
`WearableAsset5` char(36) NOT NULL,
|
||||
`WearableItem6` char(36) NOT NULL,
|
||||
`WearableAsset6` char(36) NOT NULL,
|
||||
`WearableItem7` char(36) NOT NULL,
|
||||
`WearableAsset7` char(36) NOT NULL,
|
||||
`WearableItem8` char(36) NOT NULL,
|
||||
`WearableAsset8` char(36) NOT NULL,
|
||||
`WearableItem9` char(36) NOT NULL,
|
||||
`WearableAsset9` char(36) NOT NULL,
|
||||
`WearableItem10` char(36) NOT NULL,
|
||||
`WearableAsset10` char(36) NOT NULL,
|
||||
`WearableItem11` char(36) NOT NULL,
|
||||
`WearableAsset11` char(36) NOT NULL,
|
||||
`WearableItem12` char(36) NOT NULL,
|
||||
`WearableAsset12` char(36) NOT NULL,
|
||||
Owner char(36) NOT NULL,
|
||||
Serial int(10) unsigned NOT NULL,
|
||||
Visual_Params blob NOT NULL,
|
||||
Texture blob NOT NULL,
|
||||
Avatar_Height float NOT NULL,
|
||||
Body_Item char(36) NOT NULL,
|
||||
Body_Asset char(36) NOT NULL,
|
||||
Skin_Item char(36) NOT NULL,
|
||||
Skin_Asset char(36) NOT NULL,
|
||||
Hair_Item char(36) NOT NULL,
|
||||
Hair_Asset char(36) NOT NULL,
|
||||
Eyes_Item char(36) NOT NULL,
|
||||
Eyes_Asset char(36) NOT NULL,
|
||||
Shirt_Item char(36) NOT NULL,
|
||||
Shirt_Asset char(36) NOT NULL,
|
||||
Pants_Item char(36) NOT NULL,
|
||||
Pants_Asset char(36) NOT NULL,
|
||||
Shoes_Item char(36) NOT NULL,
|
||||
Shoes_Asset char(36) NOT NULL,
|
||||
Socks_Item char(36) NOT NULL,
|
||||
Socks_Asset char(36) NOT NULL,
|
||||
Jacket_Item char(36) NOT NULL,
|
||||
Jacket_Asset char(36) NOT NULL,
|
||||
Gloves_Item char(36) NOT NULL,
|
||||
Gloves_Asset char(36) NOT NULL,
|
||||
Undershirt_Item char(36) NOT NULL,
|
||||
Undershirt_Asset char(36) NOT NULL,
|
||||
Underpants_Item char(36) NOT NULL,
|
||||
Underpants_Asset char(36) NOT NULL,
|
||||
Skirt_Item char(36) NOT NULL,
|
||||
Skirt_Asset char(36) NOT NULL,
|
||||
|
||||
|
||||
PRIMARY KEY (`UUID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev.1';
|
||||
PRIMARY KEY (`Owner`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev.2';
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ namespace OpenSim.Data.NHibernate
|
|||
|
||||
/// Appearance
|
||||
/// TODO: stubs for now to get us to a compiling state gently
|
||||
public AvatarAppearance GetUserAppearance(LLUUID user)
|
||||
public override 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
|
|||
}
|
||||
|
||||
|
||||
public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
|
||||
public override void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
|
||||
{
|
||||
bool exists = ExistsAppearance(user);
|
||||
using (ISession session = factory.OpenSession())
|
||||
|
|
|
@ -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 AvatarAppearance GetUserAppearance(LLUUID user)
|
||||
{
|
||||
return new AvatarAppearance();
|
||||
}
|
||||
|
||||
// override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
override public void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
override public void AddAttachment(LLUUID user, LLUUID item)
|
||||
{
|
||||
|
|
|
@ -59,20 +59,22 @@ namespace OpenSim.Data
|
|||
public abstract string Name {get;}
|
||||
public abstract void Initialise(string connect);
|
||||
public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
|
||||
public virtual AvatarAppearance GetUserAppearance(LLUUID user) {
|
||||
AvatarAppearance aa = null;
|
||||
try {
|
||||
aa = aplist[user];
|
||||
m_log.Info("[APPEARANCE] Found appearance for " + user.ToString() + aa.ToString());
|
||||
} catch (System.Collections.Generic.KeyNotFoundException e) {
|
||||
m_log.Info("[APPEARANCE] No appearance found for " + user.ToString());
|
||||
}
|
||||
return aa;
|
||||
}
|
||||
public virtual void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) {
|
||||
aplist[user] = appearance;
|
||||
m_log.Info("[APPEARANCE] Setting appearance for " + user.ToString() + appearance.ToString());
|
||||
}
|
||||
public abstract AvatarAppearance GetUserAppearance(LLUUID user);
|
||||
public abstract void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);
|
||||
// public virtual AvatarAppearance GetUserAppearance(LLUUID user) {
|
||||
// AvatarAppearance aa = null;
|
||||
// try {
|
||||
// aa = aplist[user];
|
||||
// m_log.Info("[APPEARANCE] Found appearance for " + user.ToString() + aa.ToString());
|
||||
// } catch (System.Collections.Generic.KeyNotFoundException e) {
|
||||
// m_log.Info("[APPEARANCE] No appearance found for " + user.ToString());
|
||||
// }
|
||||
// return aa;
|
||||
// }
|
||||
// public virtual void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) {
|
||||
// aplist[user] = appearance;
|
||||
// m_log.Info("[APPEARANCE] Setting appearance for " + user.ToString() + appearance.ToString());
|
||||
// }
|
||||
public abstract void AddAttachment(LLUUID user, LLUUID item);
|
||||
public abstract void RemoveAttachment(LLUUID user, LLUUID item);
|
||||
public abstract List<LLUUID> GetAttachments(LLUUID user);
|
||||
|
|
|
@ -1456,8 +1456,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
SendFullUpdateToAllClients();
|
||||
SendAppearanceToAllOtherAgents();
|
||||
// This is probably egregious
|
||||
m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
|
||||
SendOwnAppearance();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,9 +61,14 @@ namespace OpenSim.Region.Modules.AvatarFactory
|
|||
{
|
||||
appearance = m_scene.CommsManager.UserService.GetUserAppearance(avatarId);
|
||||
if (appearance != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[APPEARANCE] appearance not found for {0}", avatarId.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
// //should only let one thread at a time do this part
|
||||
// EventWaitHandle waitHandle = null;
|
||||
|
|
Loading…
Reference in New Issue