* minor: Add documentation to some of the appearance methods, change some logging messages

0.6.0-stable
Justin Clarke Casey 2008-10-28 17:35:36 +00:00
parent f34079cc8c
commit 247b806134
6 changed files with 50 additions and 32 deletions

View File

@ -71,17 +71,23 @@ namespace OpenSim.Framework
{ {
defaultWearables[i] = new AvatarWearable(); defaultWearables[i] = new AvatarWearable();
} }
// Body
defaultWearables[0].AssetID = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); defaultWearables[0].AssetID = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
defaultWearables[0].ItemID = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); defaultWearables[0].ItemID = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
// Skin
defaultWearables[1].ItemID = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9"); defaultWearables[1].ItemID = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9");
defaultWearables[1].AssetID = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); defaultWearables[1].AssetID = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb");
// Shirt
defaultWearables[4].ItemID = new UUID("77c41e39-38f9-f75a-0000-585989bf0000"); defaultWearables[4].ItemID = new UUID("77c41e39-38f9-f75a-0000-585989bf0000");
defaultWearables[4].AssetID = new UUID("00000000-38f9-1111-024e-222222111110"); defaultWearables[4].AssetID = new UUID("00000000-38f9-1111-024e-222222111110");
// Pants
defaultWearables[5].ItemID = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); defaultWearables[5].ItemID = new UUID("77c41e39-38f9-f75a-0000-5859892f1111");
defaultWearables[5].AssetID = new UUID("00000000-38f9-1111-024e-222222111120"); defaultWearables[5].AssetID = new UUID("00000000-38f9-1111-024e-222222111120");
return defaultWearables; return defaultWearables;
} }
} }

View File

@ -635,8 +635,20 @@ namespace OpenSim.Framework
// void ActivateGesture(UUID assetId, UUID gestureId); // void ActivateGesture(UUID assetId, UUID gestureId);
/// <summary>
/// Tell this client what items it should be wearing now
/// </summary>
/// <param name="wearables"></param>
void SendWearables(AvatarWearable[] wearables, int serial); void SendWearables(AvatarWearable[] wearables, int serial);
/// <summary>
/// Send information about the given agent's appearance to another client.
/// </summary>
/// <param name="agentID">The id of the agent associated with the appearance</param>
/// <param name="visualParams"></param>
/// <param name="textureEntry"></param>
void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry); void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry);
void SendStartPingCheck(byte seq); void SendStartPingCheck(byte seq);
/// <summary> /// <summary>

View File

@ -2222,10 +2222,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Appearance/ Wearables Methods #region Appearance/ Wearables Methods
/// <summary>
///
/// </summary>
/// <param name="wearables"></param>
public void SendWearables(AvatarWearable[] wearables, int serial) public void SendWearables(AvatarWearable[] wearables, int serial)
{ {
AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate); AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate);
@ -2248,12 +2244,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(aw, ThrottleOutPacketType.Task); OutPacket(aw, ThrottleOutPacketType.Task);
} }
/// <summary>
///
/// </summary>
/// <param name="agentID"></param>
/// <param name="visualParams"></param>
/// <param name="textureEntry"></param>
public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)
{ {
AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance);
@ -4199,6 +4189,7 @@ Console.WriteLine(msgpack.ToString());
} }
break; break;
case PacketType.RegionHandshakeReply: case PacketType.RegionHandshakeReply:
handlerRegionHandShakeReply = OnRegionHandShakeReply; handlerRegionHandShakeReply = OnRegionHandShakeReply;
@ -4208,6 +4199,7 @@ Console.WriteLine(msgpack.ToString());
} }
break; break;
case PacketType.AgentWearablesRequest: case PacketType.AgentWearablesRequest:
handlerRequestWearables = OnRequestWearables; handlerRequestWearables = OnRequestWearables;
@ -4224,6 +4216,7 @@ Console.WriteLine(msgpack.ToString());
} }
break; break;
case PacketType.AgentSetAppearance: case PacketType.AgentSetAppearance:
AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;

View File

@ -131,8 +131,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory
} }
else else
{ {
// UUID assetId;
InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID); InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID);
if (baseItem != null) if (baseItem != null)
@ -141,7 +139,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory
} }
else else
{ {
m_log.ErrorFormat("[APPEARANCE] Can't find inventory item {0}, setting to default", appearance.Wearables[i].ItemID); m_log.ErrorFormat("[APPEARANCE]: Can't find inventory item {0}, setting to default", appearance.Wearables[i].ItemID);
appearance.Wearables[i].AssetID = def.Wearables[i].AssetID; appearance.Wearables[i].AssetID = def.Wearables[i].AssetID;
} }
} }
@ -149,7 +147,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory
} }
else else
{ {
m_log.Error("[APPEARANCE] you have no inventory, appearance stuff isn't going to work"); m_log.Error("[APPEARANCE]: you have no inventory, appearance stuff isn't going to work");
} }
} }
@ -157,19 +155,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory
{ {
IClientAPI clientView = (IClientAPI)sender; IClientAPI clientView = (IClientAPI)sender;
ScenePresence avatar = m_scene.GetScenePresence(clientView.AgentId); ScenePresence avatar = m_scene.GetScenePresence(clientView.AgentId);
if (avatar == null) {
m_log.Info("Avatar is child agent, ignoring AvatarIsWearing event"); if (avatar == null)
{
m_log.Warn("[APPEARANCE]: Avatar is child agent, ignoring AvatarIsWearing event");
return; return;
} }
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
AvatarAppearance avatAppearance = null; AvatarAppearance avatAppearance = null;
if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) { if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance))
m_log.Info("We didn't seem to find the appearance, falling back to ScenePresense"); {
m_log.Info("[APPEARANCE]: We didn't seem to find the appearance, falling back to ScenePresense");
avatAppearance = avatar.Appearance; avatAppearance = avatar.Appearance;
} }
m_log.Info("Calling Avatar is Wearing");
m_log.Info("[APPEARANCE]: Calling Avatar is Wearing");
if (profile != null) if (profile != null)
{ {
if (profile.RootFolder != null) if (profile.RootFolder != null)
@ -181,6 +184,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
} }
} }
SetAppearanceAssets(profile, ref avatAppearance); SetAppearanceAssets(profile, ref avatAppearance);
m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance); m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
@ -188,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory
} }
else else
{ {
m_log.Error("Root Profile is null, we can't set the appearance"); m_log.Error("[APPEARANCE]: Root Profile is null, we can't set the appearance");
} }
} }
} }

View File

@ -2236,8 +2236,6 @@ namespace OpenSim.Region.Environment.Scenes
protected virtual void SubscribeToClientEvents(IClientAPI client) protected virtual void SubscribeToClientEvents(IClientAPI client)
{ {
client.OnRegionHandShakeReply += SendLayerData; client.OnRegionHandShakeReply += SendLayerData;
//remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims);
// client.OnRequestWearables += InformClientOfNeighbours;
client.OnAddPrim += AddNewPrim; client.OnAddPrim += AddNewPrim;
client.OnUpdatePrimGroupPosition += m_innerScene.UpdatePrimPosition; client.OnUpdatePrimGroupPosition += m_innerScene.UpdatePrimPosition;
client.OnUpdatePrimSinglePosition += m_innerScene.UpdatePrimSinglePosition; client.OnUpdatePrimSinglePosition += m_innerScene.UpdatePrimSinglePosition;

View File

@ -527,7 +527,7 @@ namespace OpenSim.Region.Environment.Scenes
public void RegisterToEvents() public void RegisterToEvents()
{ {
m_controllingClient.OnRequestWearables += SendOwnAppearance; m_controllingClient.OnRequestWearables += SendWearables;
m_controllingClient.OnSetAppearance += SetAppearance; m_controllingClient.OnSetAppearance += SetAppearance;
m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
m_controllingClient.OnCompleteMovementToRegion += SendInitialData; m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
@ -1843,12 +1843,13 @@ namespace OpenSim.Region.Environment.Scenes
} }
/// <summary> /// <summary>
/// /// Tell the client for this scene presence what items it should be wearing now
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client"></param>
public void SendOwnAppearance() public void SendWearables()
{ {
m_log.Info("[APPEARANCE]: Sending Own Appearance"); m_log.DebugFormat("[APPEARANCE]: Sending wearables to {0}", Name);
ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
// ControllingClient.SendAppearance( // ControllingClient.SendAppearance(
// m_appearance.Owner, // m_appearance.Owner,
@ -1862,8 +1863,9 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendAppearanceToAllOtherAgents() public void SendAppearanceToAllOtherAgents()
{ {
m_log.Info("[APPEARANCE]: Sending Appearance to All Other Agents"); m_log.DebugFormat("[APPEARANCE]: Sending appearance to all other agents for {0}", Name);
m_perfMonMS=System.Environment.TickCount;
m_perfMonMS = System.Environment.TickCount;
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{ {
@ -1872,6 +1874,7 @@ namespace OpenSim.Region.Environment.Scenes
SendAppearanceToOtherAgent(scenePresence); SendAppearanceToOtherAgent(scenePresence);
} }
}); });
m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS);
} }
@ -1886,18 +1889,20 @@ namespace OpenSim.Region.Environment.Scenes
public void SetAppearance(byte[] texture, List<byte> visualParam) public void SetAppearance(byte[] texture, List<byte> visualParam)
{ {
m_log.Info("[APPEARANCE]: Setting Appearance"); m_log.DebugFormat("[APPEARANCE]: Setting appearance for {0}", Name);
m_appearance.SetAppearance(texture, visualParam); m_appearance.SetAppearance(texture, visualParam);
SetHeight(m_appearance.AvatarHeight); SetHeight(m_appearance.AvatarHeight);
m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
SendAppearanceToAllOtherAgents(); SendAppearanceToAllOtherAgents();
SendOwnAppearance(); SendWearables();
} }
public void SetWearable(int wearableId, AvatarWearable wearable) public void SetWearable(int wearableId, AvatarWearable wearable)
{ {
m_log.Info("[APPEARANCE]: Setting Wearable"); m_log.DebugFormat("[APPEARANCE]: Setting wearable for {0}", Name);
m_appearance.SetWearable(wearableId, wearable); m_appearance.SetWearable(wearableId, wearable);
m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);