while this doesn't fix the initial no pants issue in grid (which still baffles me)
it does make setting appearance in grid stick.0.6.0-stable
parent
fbc98ca537
commit
06b1535ec5
|
@ -1779,29 +1779,28 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
|
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child)
|
||||||
{
|
{
|
||||||
AvatarAppearance appearance;
|
AvatarAppearance appearance = CommsManager.UserService.GetUserAppearance(client.AgentId);
|
||||||
GetAvatarAppearance(client, out appearance);
|
|
||||||
|
|
||||||
ScenePresence avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance);
|
ScenePresence avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance);
|
||||||
|
|
||||||
return avatar;
|
return avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
|
// protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance)
|
||||||
{
|
// {
|
||||||
appearance = CommsManager.UserService.GetUserAppearance(client.AgentId);
|
// appearance = CommsManager.UserService.GetUserAppearance(client.AgentId);
|
||||||
|
|
||||||
// if (m_AvatarFactory == null ||
|
// // if (m_AvatarFactory == null ||
|
||||||
// !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
|
// // !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
|
||||||
// {
|
// // {
|
||||||
// //not found Appearance
|
// // //not found Appearance
|
||||||
// m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis");
|
// // m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis");
|
||||||
// byte[] visualParams;
|
// // byte[] visualParams;
|
||||||
// AvatarWearable[] wearables;
|
// // AvatarWearable[] wearables;
|
||||||
// GetDefaultAvatarAppearance(out wearables, out visualParams);
|
// // GetDefaultAvatarAppearance(out wearables, out visualParams);
|
||||||
// appearance = new AvatarAppearance(client.AgentId, wearables, visualParams);
|
// // appearance = new AvatarAppearance(client.AgentId, wearables, visualParams);
|
||||||
// }
|
// // }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove the given client from the scene.
|
/// Remove the given client from the scene.
|
||||||
|
|
|
@ -1452,13 +1452,8 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendInitialData()
|
public void SendInitialData()
|
||||||
{
|
{
|
||||||
// justincc - very temporary fix for the fact that m_apperance appears to be null at this point in grid mode
|
|
||||||
LLObject.TextureEntry texture = AvatarAppearance.GetDefaultTexture();
|
|
||||||
if (null != m_appearance)
|
|
||||||
texture = m_appearance.Texture;
|
|
||||||
|
|
||||||
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
|
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
|
||||||
m_pos, texture.ToBytes(), m_parentID);
|
m_pos, m_appearance.Texture.ToBytes(), m_parentID);
|
||||||
|
|
||||||
if (!m_isChildAgent)
|
if (!m_isChildAgent)
|
||||||
{
|
{
|
||||||
|
@ -1467,11 +1462,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
SendFullUpdateToAllClients();
|
SendFullUpdateToAllClients();
|
||||||
SendAppearanceToAllOtherAgents();
|
SendAppearanceToAllOtherAgents();
|
||||||
|
// This is probably egregious
|
||||||
|
m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable)
|
public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable)
|
||||||
{
|
{
|
||||||
|
m_log.Info("[APPEARANCE] Setting wearable with client, wearableid, wearable");
|
||||||
m_appearance.SetWearable(wearableId, wearable);
|
m_appearance.SetWearable(wearableId, wearable);
|
||||||
m_scene.CommsManager.UserService.UpdateUserAppearance(client.AgentId, m_appearance);
|
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++);
|
||||||
|
@ -1483,6 +1481,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
public void SendOwnAppearance()
|
public void SendOwnAppearance()
|
||||||
{
|
{
|
||||||
|
m_log.Info("[APPEARANCE] Sending Own Appearace");
|
||||||
ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
|
ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1514,19 +1513,30 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void SetAppearance(byte[] texture, List<byte> visualParam)
|
public void SetAppearance(byte[] texture, List<byte> visualParam)
|
||||||
{
|
{
|
||||||
|
m_log.Warn("[APPEARANCE] Setting Appearance");
|
||||||
m_appearance.SetAppearance(texture, visualParam);
|
m_appearance.SetAppearance(texture, visualParam);
|
||||||
SetHeight(m_appearance.AvatarHeight);
|
SetHeight(m_appearance.AvatarHeight);
|
||||||
m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
|
m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
|
||||||
|
|
||||||
SendAppearanceToAllOtherAgents();
|
SendAppearanceToAllOtherAgents();
|
||||||
|
SendOwnAppearance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetWearable(int wearableId, AvatarWearable wearable)
|
public void SetWearable(int wearableId, AvatarWearable wearable)
|
||||||
{
|
{
|
||||||
|
m_log.Warn("[APPEARANCE] Setting Wearable");
|
||||||
m_appearance.SetWearable(wearableId, wearable);
|
m_appearance.SetWearable(wearableId, wearable);
|
||||||
m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
|
m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Because appearance setting is in a module, we actually need
|
||||||
|
// to give it access to our appearance directly, otherwise we
|
||||||
|
// get a synchronization issue.
|
||||||
|
public AvatarAppearance Appearance {
|
||||||
|
get { return m_appearance; }
|
||||||
|
set { m_appearance = value; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -27,8 +27,11 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Data.Base;
|
using OpenSim.Data.Base;
|
||||||
using OpenSim.Data.MapperFactory;
|
using OpenSim.Data.MapperFactory;
|
||||||
|
@ -41,6 +44,7 @@ namespace OpenSim.Region.Modules.AvatarFactory
|
||||||
{
|
{
|
||||||
public class AvatarFactoryModule : IAvatarFactory, IRegionModule
|
public class AvatarFactoryModule : IAvatarFactory, IRegionModule
|
||||||
{
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private Scene m_scene = null;
|
private Scene m_scene = null;
|
||||||
private readonly Dictionary<LLUUID, AvatarAppearance> m_avatarsAppearance = new Dictionary<LLUUID, AvatarAppearance>();
|
private readonly Dictionary<LLUUID, AvatarAppearance> m_avatarsAppearance = new Dictionary<LLUUID, AvatarAppearance>();
|
||||||
|
|
||||||
|
@ -215,31 +219,31 @@ namespace OpenSim.Region.Modules.AvatarFactory
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_configured)
|
// if (!m_configured)
|
||||||
{
|
// {
|
||||||
m_configured = true;
|
// m_configured = true;
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
m_enablePersist = source.Configs["Startup"].GetBoolean("appearance_persist", false);
|
// m_enablePersist = source.Configs["Startup"].GetBoolean("appearance_persist", false);
|
||||||
}
|
// }
|
||||||
catch (Exception)
|
// catch (Exception)
|
||||||
{
|
// {
|
||||||
}
|
// }
|
||||||
if (m_enablePersist)
|
// if (m_enablePersist)
|
||||||
{
|
// {
|
||||||
m_connectionString = source.Configs["Startup"].GetString("appearance_connection_string", "");
|
// m_connectionString = source.Configs["Startup"].GetString("appearance_connection_string", "");
|
||||||
|
|
||||||
string mapperTypeStr = source.Configs["Startup"].GetString("appearance_database", "MySQL");
|
// string mapperTypeStr = source.Configs["Startup"].GetString("appearance_database", "MySQL");
|
||||||
|
|
||||||
DataMapperFactory.MAPPER_TYPE mapperType =
|
// DataMapperFactory.MAPPER_TYPE mapperType =
|
||||||
(DataMapperFactory.MAPPER_TYPE)
|
// (DataMapperFactory.MAPPER_TYPE)
|
||||||
Enum.Parse(typeof (DataMapperFactory.MAPPER_TYPE), mapperTypeStr);
|
// Enum.Parse(typeof (DataMapperFactory.MAPPER_TYPE), mapperTypeStr);
|
||||||
|
|
||||||
m_databaseMapper = DataMapperFactory.GetDataBaseMapper(mapperType, m_connectionString);
|
// m_databaseMapper = DataMapperFactory.GetDataBaseMapper(mapperType, m_connectionString);
|
||||||
|
|
||||||
m_appearanceMapper = new AppearanceTableMapper(m_databaseMapper, "AvatarAppearance");
|
// m_appearanceMapper = new AppearanceTableMapper(m_databaseMapper, "AvatarAppearance");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -273,13 +277,14 @@ namespace OpenSim.Region.Modules.AvatarFactory
|
||||||
public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
|
public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
|
||||||
{
|
{
|
||||||
IClientAPI clientView = (IClientAPI)sender;
|
IClientAPI clientView = (IClientAPI)sender;
|
||||||
|
ScenePresence avatar = m_scene.GetScenePresence(clientView.AgentId);
|
||||||
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
|
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
|
||||||
AvatarAppearance avatAppearance = m_scene.CommsManager.UserService.GetUserAppearance(clientView.AgentId);
|
AvatarAppearance avatAppearance = avatar.Appearance;
|
||||||
|
m_log.Info("Calling Avatar is Wearing");
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
if (profile.RootFolder != null)
|
if (profile.RootFolder != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||||
{
|
{
|
||||||
if (wear.Type < 13)
|
if (wear.Type < 13)
|
||||||
|
@ -292,7 +297,7 @@ namespace OpenSim.Region.Modules.AvatarFactory
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLUUID assetId;
|
LLUUID assetId;
|
||||||
|
|
||||||
InventoryItemBase baseItem = profile.RootFolder.FindItem(wear.ItemID);
|
InventoryItemBase baseItem = profile.RootFolder.FindItem(wear.ItemID);
|
||||||
|
|
||||||
if (baseItem != null)
|
if (baseItem != null)
|
||||||
|
@ -301,10 +306,18 @@ namespace OpenSim.Region.Modules.AvatarFactory
|
||||||
avatAppearance.Wearables[wear.Type].AssetID = assetId;
|
avatAppearance.Wearables[wear.Type].AssetID = assetId;
|
||||||
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
|
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[APPEARANCE] Can't find inventory item {0}, not wearing", wear.ItemID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_scene.CommsManager.UserService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
|
m_scene.CommsManager.UserService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Error("Root Profile is null, we can't set the appearance");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -866,6 +866,7 @@
|
||||||
<Reference name="System.Xml"/>
|
<Reference name="System.Xml"/>
|
||||||
<Reference name="System.Data"/>
|
<Reference name="System.Data"/>
|
||||||
<Reference name="libsecondlife.dll"/>
|
<Reference name="libsecondlife.dll"/>
|
||||||
|
<Reference name="log4net.dll"/>
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Framework.Communications"/>
|
<Reference name="OpenSim.Framework.Communications"/>
|
||||||
<Reference name="OpenSim.Data.Base" />
|
<Reference name="OpenSim.Data.Base" />
|
||||||
|
|
Loading…
Reference in New Issue