Fixed a couple of bugs with Appearance. Appearance is all good now.

slimupdates
Diva Canto 2010-01-11 17:30:05 -08:00
parent 4e7c449c5a
commit 77e43f4801
16 changed files with 124 additions and 68 deletions

View File

@ -1397,7 +1397,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
AvatarAppearance ava = null; AvatarAppearance ava = null;
AvatarData avatar = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(srca); AvatarData avatar = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(srca);
if (avatar != null) if (avatar != null)
ava = avatar.ToAvatarAppearance(); ava = avatar.ToAvatarAppearance(srca);
// If the model has no associated appearance we're done. // If the model has no associated appearance we're done.
@ -1639,7 +1639,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// While the inventory is being fetched, setup for appearance processing // While the inventory is being fetched, setup for appearance processing
AvatarData adata = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(ID); AvatarData adata = m_app.SceneManager.CurrentOrFirstScene.AvatarService.GetAvatar(ID);
if (adata != null) if (adata != null)
mava = adata.ToAvatarAppearance(); mava = adata.ToAvatarAppearance(ID);
else else
mava = new AvatarAppearance(); mava = new AvatarAppearance();

View File

@ -304,7 +304,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
String.Format("appearance data not found for user {0} {1}", String.Format("appearance data not found for user {0} {1}",
rdata.userProfile.FirstName, rdata.userProfile.SurName)); rdata.userProfile.FirstName, rdata.userProfile.SurName));
} }
rdata.userAppearance = adata.ToAvatarAppearance(); rdata.userAppearance = adata.ToAvatarAppearance(rdata.userProfile.ID);
rdata.initXmlWriter(); rdata.initXmlWriter();
@ -446,7 +446,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (adata != null) if (adata != null)
{ {
AvatarAppearance old = adata.ToAvatarAppearance(); AvatarAppearance old = adata.ToAvatarAppearance(rdata.userProfile.ID);
rdata.userAppearance = new AvatarAppearance(); rdata.userAppearance = new AvatarAppearance();
rdata.userAppearance.Owner = old.Owner; rdata.userAppearance.Owner = old.Owner;
adata = new AvatarData(rdata.userAppearance); adata = new AvatarData(rdata.userAppearance);

View File

@ -536,7 +536,7 @@ namespace OpenSim.Client.MXP.PacketHandler
agent.CapsPath = "http://localhost/"; agent.CapsPath = "http://localhost/";
AvatarData avatar = scene.AvatarService.GetAvatar(account.PrincipalID); AvatarData avatar = scene.AvatarService.GetAvatar(account.PrincipalID);
if (avatar != null) if (avatar != null)
agent.Appearance = avatar.ToAvatarAppearance(); //userService.GetUserAppearance(userProfile.ID); agent.Appearance = avatar.ToAvatarAppearance(account.PrincipalID); //userService.GetUserAppearance(userProfile.ID);
if (agent.Appearance == null) if (agent.Appearance == null)
{ {

View File

@ -197,7 +197,6 @@ namespace OpenSim
LoadPlugins(); LoadPlugins();
foreach (IApplicationPlugin plugin in m_plugins) foreach (IApplicationPlugin plugin in m_plugins)
{ {
m_log.Debug("XXX PostInitialise " + plugin.Name);
plugin.PostInitialise(); plugin.PostInitialise();
} }

View File

@ -5474,6 +5474,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// for the client session anyway, in order to protect ourselves against bad code in plugins // for the client session anyway, in order to protect ourselves against bad code in plugins
try try
{ {
byte[] visualparams = new byte[appear.VisualParam.Length]; byte[] visualparams = new byte[appear.VisualParam.Length];
for (int i = 0; i < appear.VisualParam.Length; i++) for (int i = 0; i < appear.VisualParam.Length; i++)
visualparams[i] = appear.VisualParam[i].ParamValue; visualparams[i] = appear.VisualParam[i].ParamValue;

View File

@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
//if ((profile != null) && (profile.RootFolder != null)) //if ((profile != null) && (profile.RootFolder != null))
if (avatar != null) if (avatar != null)
{ {
appearance = avatar.ToAvatarAppearance(); appearance = avatar.ToAvatarAppearance(avatarId);
return true; return true;
} }
@ -153,6 +153,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
/// <param name="e"></param> /// <param name="e"></param>
public void AvatarIsWearing(Object sender, AvatarWearingArgs e) public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
{ {
m_log.DebugFormat("[APPEARANCE]: AvatarIsWearing");
IClientAPI clientView = (IClientAPI)sender; IClientAPI clientView = (IClientAPI)sender;
ScenePresence sp = m_scene.GetScenePresence(clientView.AgentId); ScenePresence sp = m_scene.GetScenePresence(clientView.AgentId);
@ -162,12 +164,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
return; return;
} }
AvatarAppearance avatAppearance = null; AvatarAppearance avatAppearance = sp.Appearance;
if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) //if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance))
{ //{
m_log.Warn("[APPEARANCE]: We didn't seem to find the appearance, falling back to ScenePresence"); // m_log.Warn("[APPEARANCE]: We didn't seem to find the appearance, falling back to ScenePresence");
avatAppearance = sp.Appearance; // avatAppearance = sp.Appearance;
} //}
//m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name);
@ -194,6 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
public void UpdateDatabase(UUID user, AvatarAppearance appearance) public void UpdateDatabase(UUID user, AvatarAppearance appearance)
{ {
m_log.DebugFormat("[APPEARANCE]: UpdateDatabase");
AvatarData adata = new AvatarData(appearance); AvatarData adata = new AvatarData(appearance);
m_scene.AvatarService.SetAvatar(user, adata); m_scene.AvatarService.SetAvatar(user, adata);

View File

@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar
IConfig userConfig = source.Configs["AvatarService"]; IConfig userConfig = source.Configs["AvatarService"];
if (userConfig == null) if (userConfig == null)
{ {
m_log.Error("[USER CONNECTOR]: AvatarService missing from OpenSim.ini"); m_log.Error("[AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini");
return; return;
} }
@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar
if (serviceDll == String.Empty) if (serviceDll == String.Empty)
{ {
m_log.Error("[USER CONNECTOR]: No LocalServiceModule named in section AvatarService"); m_log.Error("[AVATAR CONNECTOR]: No LocalServiceModule named in section AvatarService");
return; return;
} }
@ -92,11 +92,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar
if (m_AvatarService == null) if (m_AvatarService == null)
{ {
m_log.Error("[USER CONNECTOR]: Can't load user account service"); m_log.Error("[AVATAR CONNECTOR]: Can't load user account service");
return; return;
} }
m_Enabled = true; m_Enabled = true;
m_log.Info("[USER CONNECTOR]: Local avatar connector enabled"); m_log.Info("[AVATAR CONNECTOR]: Local avatar connector enabled");
} }
} }
} }
@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar
if (!m_Enabled) if (!m_Enabled)
return; return;
scene.RegisterModuleInterface<IAvatarService>(m_AvatarService); scene.RegisterModuleInterface<IAvatarService>(this);
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)

View File

@ -2358,7 +2358,7 @@ namespace OpenSim.Region.Framework.Scenes
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item); item = InventoryService.GetItem(item);
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, /*item.AssetID*/ att.UUID);
} }
return att.UUID; return att.UUID;
} }
@ -2403,7 +2403,7 @@ namespace OpenSim.Region.Framework.Scenes
// XXYY!! // XXYY!!
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item); item = InventoryService.GetItem(item);
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); presence.Appearance.SetAttachment((int)AttachmentPt, itemID, /*item.AssetID*/ att.UUID);
if (m_AvatarFactory != null) if (m_AvatarFactory != null)
{ {

View File

@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes
get get
{ {
if (m_AvatarService == null) if (m_AvatarService == null)
m_AvatarService = RequestModuleInterface<OpenSim.Services.Interfaces.IAvatarService>(); m_AvatarService = RequestModuleInterface<IAvatarService>();
return m_AvatarService; return m_AvatarService;
} }
} }

View File

@ -250,7 +250,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState; InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState;
icon.EndInvoke(iar); icon.EndInvoke(iar);
m_log.WarnFormat(" --> InformClientOfNeighbourCompleted"); //m_log.WarnFormat(" --> InformClientOfNeighbourCompleted");
} }
/// <summary> /// <summary>
@ -456,7 +456,7 @@ namespace OpenSim.Region.Framework.Scenes
int count = 0; int count = 0;
foreach (GridRegion neighbour in neighbours) foreach (GridRegion neighbour in neighbours)
{ {
m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName);
// Don't do it if there's already an agent in that region // Don't do it if there's already an agent in that region
if (newRegions.Contains(neighbour.RegionHandle)) if (newRegions.Contains(neighbour.RegionHandle))
newAgent = true; newAgent = true;

View File

@ -2565,14 +2565,18 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
} }
#endregion Bake Cache Check #endregion Bake Cache Check
m_appearance.SetAppearance(textureEntry, visualParams); m_appearance.SetAppearance(textureEntry, visualParams);
if (m_appearance.AvatarHeight > 0) if (m_appearance.AvatarHeight > 0)
SetHeight(m_appearance.AvatarHeight); SetHeight(m_appearance.AvatarHeight);
AvatarData adata = new AvatarData(m_appearance); AvatarData adata = new AvatarData(m_appearance);
m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata);
SendAppearanceToAllOtherAgents(); SendAppearanceToAllOtherAgents();

View File

@ -67,7 +67,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
AvatarData adata = scene.AvatarService.GetAvatar(target); AvatarData adata = scene.AvatarService.GetAvatar(target);
if (adata != null) if (adata != null)
{ {
AvatarAppearance x = adata.ToAvatarAppearance(); AvatarAppearance x = adata.ToAvatarAppearance(target);
m_appearanceCache.Add(target, x); m_appearanceCache.Add(target, x);

View File

@ -73,6 +73,12 @@ namespace OpenSim.Services.AvatarService
public bool SetAvatar(UUID principalID, AvatarData avatar) public bool SetAvatar(UUID principalID, AvatarData avatar)
{ {
int count = 0;
foreach (KeyValuePair<string, string> kvp in avatar.Data)
if (kvp.Key.StartsWith("_"))
count++;
m_log.DebugFormat("[AVATAR SERVICE]: SetAvatar for {0}, attachs={1}", principalID, count);
m_Database.Delete("PrincipalID", principalID.ToString()); m_Database.Delete("PrincipalID", principalID.ToString());
AvatarBaseData av = new AvatarBaseData(); AvatarBaseData av = new AvatarBaseData();

View File

@ -131,17 +131,15 @@ namespace OpenSim.Services.Interfaces
AvatarType = 1; // SL avatars AvatarType = 1; // SL avatars
Data = new Dictionary<string, string>(); Data = new Dictionary<string, string>();
Data["Serial"] = appearance.Serial.ToString();
// Wearables // Wearables
Data["AvatarHeight"] = appearance.AvatarHeight.ToString(); Data["AvatarHeight"] = appearance.AvatarHeight.ToString();
Data["BodyItem"] = appearance.BodyItem.ToString(); Data["BodyItem"] = appearance.BodyItem.ToString();
Data["EyesItem"] = appearance.EyesItem.ToString(); Data["EyesItem"] = appearance.EyesItem.ToString();
Data["GlovesItem"] = appearance.GlovesItem.ToString(); Data["GlovesItem"] = appearance.GlovesItem.ToString();
Data["HairItem"] = appearance.HairItem.ToString(); Data["HairItem"] = appearance.HairItem.ToString();
//Data["HipOffset"] = appearance.HipOffset.ToString();
Data["JacketItem"] = appearance.JacketItem.ToString(); Data["JacketItem"] = appearance.JacketItem.ToString();
Data["Owner"] = appearance.Owner.ToString();
Data["PantsItem"] = appearance.PantsItem.ToString(); Data["PantsItem"] = appearance.PantsItem.ToString();
Data["Serial"] = appearance.Serial.ToString();
Data["ShirtItem"] = appearance.ShirtItem.ToString(); Data["ShirtItem"] = appearance.ShirtItem.ToString();
Data["ShoesItem"] = appearance.ShoesItem.ToString(); Data["ShoesItem"] = appearance.ShoesItem.ToString();
Data["SkinItem"] = appearance.SkinItem.ToString(); Data["SkinItem"] = appearance.SkinItem.ToString();
@ -150,28 +148,48 @@ namespace OpenSim.Services.Interfaces
Data["UnderPantsItem"] = appearance.UnderPantsItem.ToString(); Data["UnderPantsItem"] = appearance.UnderPantsItem.ToString();
Data["UnderShirtItem"] = appearance.UnderShirtItem.ToString(); Data["UnderShirtItem"] = appearance.UnderShirtItem.ToString();
Data["BodyAsset"] = appearance.BodyAsset.ToString();
Data["EyesAsset"] = appearance.EyesAsset.ToString();
Data["GlovesAsset"] = appearance.GlovesAsset.ToString();
Data["HairAsset"] = appearance.HairAsset.ToString();
Data["JacketAsset"] = appearance.JacketAsset.ToString();
Data["PantsAsset"] = appearance.PantsAsset.ToString();
Data["ShirtAsset"] = appearance.ShirtAsset.ToString();
Data["ShoesAsset"] = appearance.ShoesAsset.ToString();
Data["SkinAsset"] = appearance.SkinAsset.ToString();
Data["SkirtAsset"] = appearance.SkirtAsset.ToString();
Data["SocksAsset"] = appearance.SocksAsset.ToString();
Data["UnderPantsAsset"] = appearance.UnderPantsAsset.ToString();
Data["UnderShirtAsset"] = appearance.UnderShirtAsset.ToString();
// Attachments // Attachments
Hashtable attachs = appearance.GetAttachments(); Hashtable attachs = appearance.GetAttachments();
foreach (KeyValuePair<int, Hashtable> kvp in attachs) if (attachs != null)
foreach (DictionaryEntry dentry in attachs)
{ {
Data["_ap_" + kvp.Key] = kvp.Value["item"].ToString(); if (dentry.Value != null)
{
Hashtable tab = (Hashtable)dentry.Value;
if (tab.ContainsKey("item") && tab["item"] != null)
Data["_ap_" + dentry.Key] = tab["item"].ToString();
}
} }
} }
public AvatarAppearance ToAvatarAppearance() public AvatarAppearance ToAvatarAppearance(UUID owner)
{ {
AvatarAppearance appearance = new AvatarAppearance(); AvatarAppearance appearance = new AvatarAppearance(owner);
try
{
appearance.Serial = Int32.Parse(Data["Serial"]);
// Wearables // Wearables
appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]);
appearance.BodyItem = UUID.Parse(Data["BodyItem"]); appearance.BodyItem = UUID.Parse(Data["BodyItem"]);
appearance.EyesItem = UUID.Parse(Data["EyesItem"]); appearance.EyesItem = UUID.Parse(Data["EyesItem"]);
appearance.GlovesItem = UUID.Parse(Data["GlovesItem"]); appearance.GlovesItem = UUID.Parse(Data["GlovesItem"]);
appearance.HairItem = UUID.Parse(Data["HairItem"]); appearance.HairItem = UUID.Parse(Data["HairItem"]);
//appearance.HipOffset = float.Parse(Data["HipOffset"]);
appearance.JacketItem = UUID.Parse(Data["JacketItem"]); appearance.JacketItem = UUID.Parse(Data["JacketItem"]);
appearance.Owner = UUID.Parse(Data["Owner"]);
appearance.PantsItem = UUID.Parse(Data["PantsItem"]); appearance.PantsItem = UUID.Parse(Data["PantsItem"]);
appearance.Serial = Int32.Parse(Data["Serial"]);
appearance.ShirtItem = UUID.Parse(Data["ShirtItem"]); appearance.ShirtItem = UUID.Parse(Data["ShirtItem"]);
appearance.ShoesItem = UUID.Parse(Data["ShoesItem"]); appearance.ShoesItem = UUID.Parse(Data["ShoesItem"]);
appearance.SkinItem = UUID.Parse(Data["SkinItem"]); appearance.SkinItem = UUID.Parse(Data["SkinItem"]);
@ -180,6 +198,20 @@ namespace OpenSim.Services.Interfaces
appearance.UnderPantsItem = UUID.Parse(Data["UnderPantsItem"]); appearance.UnderPantsItem = UUID.Parse(Data["UnderPantsItem"]);
appearance.UnderShirtItem = UUID.Parse(Data["UnderShirtItem"]); appearance.UnderShirtItem = UUID.Parse(Data["UnderShirtItem"]);
appearance.BodyAsset = UUID.Parse(Data["BodyAsset"]);
appearance.EyesAsset = UUID.Parse(Data["EyesAsset"]);
appearance.GlovesAsset = UUID.Parse(Data["GlovesAsset"]);
appearance.HairAsset = UUID.Parse(Data["HairAsset"]);
appearance.JacketAsset = UUID.Parse(Data["JacketAsset"]);
appearance.PantsAsset = UUID.Parse(Data["PantsAsset"]);
appearance.ShirtAsset = UUID.Parse(Data["ShirtAsset"]);
appearance.ShoesAsset = UUID.Parse(Data["ShoesAsset"]);
appearance.SkinAsset = UUID.Parse(Data["SkinAsset"]);
appearance.SkirtAsset = UUID.Parse(Data["SkirtAsset"]);
appearance.SocksAsset = UUID.Parse(Data["SocksAsset"]);
appearance.UnderPantsAsset = UUID.Parse(Data["UnderPantsAsset"]);
appearance.UnderShirtAsset = UUID.Parse(Data["UnderShirtAsset"]);
// Attachments // Attachments
Dictionary<string, string> attchs = new Dictionary<string, string>(); Dictionary<string, string> attchs = new Dictionary<string, string>();
foreach (KeyValuePair<string, string> _kvp in Data) foreach (KeyValuePair<string, string> _kvp in Data)
@ -193,10 +225,15 @@ namespace OpenSim.Services.Interfaces
if (!Int32.TryParse(pointStr, out point)) if (!Int32.TryParse(pointStr, out point))
continue; continue;
Hashtable tmp = new Hashtable(); Hashtable tmp = new Hashtable();
tmp["item"] = _kvp.Value; UUID uuid = UUID.Zero;
UUID.TryParse(_kvp.Value, out uuid);
tmp["item"] = uuid;
tmp["asset"] = UUID.Zero.ToString(); tmp["asset"] = UUID.Zero.ToString();
aaAttachs[point] = tmp; aaAttachs[point] = tmp;
} }
appearance.SetAttachments(aaAttachs);
}
catch { }
return appearance; return appearance;
} }

View File

@ -375,7 +375,7 @@ namespace OpenSim.Services.LLLoginService
aCircuit.AgentID = account.PrincipalID; aCircuit.AgentID = account.PrincipalID;
if (avatar != null) if (avatar != null)
aCircuit.Appearance = avatar.ToAvatarAppearance(); aCircuit.Appearance = avatar.ToAvatarAppearance(account.PrincipalID);
//aCircuit.BaseFolder = irrelevant //aCircuit.BaseFolder = irrelevant
aCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); aCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
aCircuit.child = false; // the first login agent is root aCircuit.child = false; // the first login agent is root

View File

@ -20,6 +20,7 @@
PresenceServices = "LocalPresenceServicesConnector" PresenceServices = "LocalPresenceServicesConnector"
UserAccountServices = "LocalUserAccountServicesConnector" UserAccountServices = "LocalUserAccountServicesConnector"
SimulationServices = "RemoteSimulationConnectorModule" SimulationServices = "RemoteSimulationConnectorModule"
AvatarServices = "LocalAvatarServicesConnector";
InventoryServiceInConnector = true InventoryServiceInConnector = true
AssetServiceInConnector = true AssetServiceInConnector = true
HGAuthServiceInConnector = true HGAuthServiceInConnector = true
@ -44,6 +45,10 @@
LocalGridInventoryService = "OpenSim.Services.InventoryService.dll:InventoryService" LocalGridInventoryService = "OpenSim.Services.InventoryService.dll:InventoryService"
HypergridInventoryService = "OpenSim.Services.Connectors.dll:HGInventoryServiceConnector" HypergridInventoryService = "OpenSim.Services.Connectors.dll:HGInventoryServiceConnector"
[AvatarService]
; For the InventoryServiceInConnector
LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService"
[LibraryService] [LibraryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService" LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"
LibraryName = "OpenSim Library" LibraryName = "OpenSim Library"
@ -79,6 +84,7 @@
InventoryService = "OpenSim.Services.InventoryService.dll:InventoryService" InventoryService = "OpenSim.Services.InventoryService.dll:InventoryService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
GridService = "OpenSim.Services.GridService.dll:GridService" GridService = "OpenSim.Services.GridService.dll:GridService"
AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService"
DefaultRegion = "OpenSim Test" DefaultRegion = "OpenSim Test"
WelcomeMessage = "Welcome, Avatar!" WelcomeMessage = "Welcome, Avatar!"