Fixed issues with save and retrieve appearance from grid.

dsg
Dan Lake 2010-12-14 15:06:31 -08:00
parent c7923338bc
commit 2b390f2436
8 changed files with 71 additions and 38 deletions

View File

@ -284,16 +284,19 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
m_log.WarnFormat("[AVFACTORY]: RefreshAppearance unable to find presence for {0}", agentid);
return;
}
m_log.DebugFormat("[AVFACTORY]: FireAndForget called for RefreshAppearance on agentid {0}", agentid);
Util.FireAndForget(delegate(object o)
{
AvatarAppearance appearance = m_scene.AvatarService.GetAppearance(agentid);
if (appearance.Texture != null && appearance.VisualParams != null)
{
sp.Appearance.SetTextureEntries(appearance.Texture);
sp.Appearance.SetVisualParams(appearance.VisualParams);
sp.SetHeight(appearance.AvatarHeight);
QueueAppearanceSend(agentid);
sp.Appearance = appearance;
if (sp.Appearance.AvatarHeight > 0)
sp.SetHeight(sp.Appearance.AvatarHeight);
// Send the appearance to everyone in the scene
sp.SendAppearanceToAllOtherAgents();
// Send animations back to the avatar as well
sp.Animator.SendAnimPack();
}
else
{
@ -430,6 +433,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// since the "iswearing" will trigger a new set of visual param and baked texture changes
// when those complete, the new appearance will be sent
sp.Appearance = avatAppearance;
if (sp.Appearance.AvatarHeight > 0)
sp.SetHeight(sp.Appearance.AvatarHeight);
QueueAppearanceSave(client.AgentId);
}

View File

@ -330,7 +330,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_startPos = startPos;
m_clientView = null;
m_log.Debug("[REGION SYNC AVATAR] instance");
m_log.DebugFormat("[REGION SYNC AVATAR] instance: uuid={0}, first={1}, last={2}, startPos={3}", agentID, first, last, startPos.ToString());
//m_scene.EventManager.OnFrame += Update;
}
@ -345,7 +345,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_startPos = startPos;
m_clientView = view;
m_log.Debug("[REGION SYNC AVATAR] instance");
m_log.Debug("[REGION SYNC AVATAR] instance: uuid={0}, first={1}, last={2}, startPos={3}, RSCV", agentID, first, last, startPos.ToString());
//m_scene.EventManager.OnFrame += Update;
}

View File

@ -269,7 +269,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void SendAppearanceToScene(UUID agentID)
{
OSDMap data = new OSDMap();
data["agentID"] = OSD.FromUUID(agentID);
data["id"] = OSD.FromUUID(agentID);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AvatarAppearance, OSDParser.SerializeJsonString(data)));
}
@ -512,7 +512,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{
if (doFullUpdate)
{
presence.SendFullUpdateToAllClients();
presence.SendAvatarDataToAllAgents();
}
else
{
@ -808,7 +808,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{
m_scene.DeleteAllSceneObjects();
//KittyL: added to distinguish different actors
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.ActorType, m_actorType.ToString()));
//Send(new RegionSyncMessage(RegionSyncMessage.MsgType.ActorType, m_actorType.ToString()));
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.RegionName, m_scene.RegionInfo.RegionName));
m_log.WarnFormat("Sending region name: \"{0}\"", m_scene.RegionInfo.RegionName);

View File

@ -747,7 +747,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
default:
{
m_log.WarnFormat("{0} Unable to handle unsupported message type", LogHeader);
m_log.WarnFormat("{0} Unable to handle unsupported message type: {1}", LogHeader, msg.ToString());
return;
}
}

View File

@ -1411,10 +1411,10 @@ namespace OpenSim.Region.Framework.Scenes
// Run through all ScenePresences looking for updates
// Presence updates and queued object updates for each presence are sent to clients
// If it's a synced client, just send prim updates
// If it's a client manager, just send prim updates
// This will get fixed later to only send to locally logged in presences rather than all presences
// but requires pulling apart the concept of a client from the concept of a presence/avatar
if (IsSyncedClient())
if (IsSyncedClient() || !RegionSyncEnabled)
{
ForEachScenePresence(delegate(ScenePresence sp) { sp.SendPrimUpdates(); });
@ -1448,6 +1448,7 @@ namespace OpenSim.Region.Framework.Scenes
m_regionSyncServerModule.SendUpdates();
}
/*
// The authoritative sim should not try to send coarse locations
// Leave this up to the client managers
if (!IsSyncedServer())
@ -1464,6 +1465,7 @@ namespace OpenSim.Region.Framework.Scenes
});
}
}
* */
int tmpPhysicsMS2 = Util.EnvironmentTickCount();
// Do not simulate physics locally if this is a synced client
@ -2753,11 +2755,15 @@ namespace OpenSim.Region.Framework.Scenes
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
bool vialogin = false;
if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
return;
// REGION SYNC
if (!RegionSyncEnabled)
{
if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
return;
vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
(aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
(aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
}
CheckHeartbeat();
ScenePresence presence;

View File

@ -2405,10 +2405,6 @@ namespace OpenSim.Region.Framework.Scenes
{
SendTerseUpdateToAllClients();
// REGION SYNC
if(m_scene.IsSyncedServer())
m_scene.RegionSyncServerModule.QueuePresenceForTerseUpdate(this);
// Update the "last" values
m_lastPosition = m_pos;
m_lastRotation = m_bodyRot;
@ -2460,9 +2456,12 @@ namespace OpenSim.Region.Framework.Scenes
public void SendTerseUpdateToAllClients()
{
// REGION SYNC
// The server should not be doing anything via the ForEachScenePresence method
if (m_scene.IsSyncedServer())
{
m_scene.RegionSyncServerModule.QueuePresenceForTerseUpdate(this);
return;
}
m_perfMonMS = Util.EnvironmentTickCount();
m_scene.ForEachClient(SendTerseUpdateToClient);
@ -2548,6 +2547,14 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SendAvatarDataToAllAgents()
{
// REGION SYNC
// The server sends appearance to all client managers since there are no local clients
if (m_scene.IsSyncedServer())
{
m_scene.RegionSyncServerModule.SendAppearance(UUID);
return;
}
// only send update from root agents to other clients; children are only "listening posts"
if (IsChildAgent)
{
@ -2621,7 +2628,7 @@ namespace OpenSim.Region.Framework.Scenes
// The server should not be doing anything via the ForEachScenePresence method
if (m_scene.IsSyncedServer())
{
m_scene.RegionSyncServerModule.QueuePresenceForTerseUpdate(this);
m_scene.RegionSyncServerModule.SendAppearance(UUID);
return;
}
// only send update from root agents to other clients; children are only "listening posts"
@ -2679,7 +2686,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="avatar"></param>
public void SendAppearanceToAgent(ScenePresence avatar)
{
// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
m_log.DebugFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
avatar.ControllingClient.SendAppearance(
m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());

View File

@ -116,6 +116,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
// <param name="userID"></param>
public AvatarAppearance GetAppearance(UUID userID)
{
m_log.DebugFormat("[SIMIAN AVATAR CONNECTOR] Start of GetAppearance for {0}", userID);
NameValueCollection requestArgs = new NameValueCollection
{
{ "RequestMethod", "GetUser" },
@ -125,25 +126,39 @@ namespace OpenSim.Services.Connectors.SimianGrid
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
if (response["Success"].AsBoolean())
{
OSDMap map = null;
try { map = OSDParser.DeserializeJson(response["LLPackedAppearance"].AsString()) as OSDMap; }
catch { }
if (map != null)
OSDMap usermap = null;
try
{
AvatarAppearance appearance = new AvatarAppearance(map);
// DEBUG ON
m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR] retrieved appearance for {0}:\n{1}",userID,appearance.ToString());
// DEBUG OFF
return appearance;
usermap = OSDParser.DeserializeJson(response["User"].ToString()) as OSDMap;
}
catch (Exception e)
{
m_log.ErrorFormat("[SIMIAN AVATAR CONNECTOR] Caught exception deserializing \"User\" in GetAppearance for {0}: {1}", userID, e.Message);
}
if (usermap != null)
{
OSDMap appearancemap = null;
try
{
appearancemap = OSDParser.DeserializeJson(usermap["LLPackedAppearance"].ToString()) as OSDMap;
}
catch (Exception e)
{
m_log.ErrorFormat("[SIMIAN AVATAR CONNECTOR] Caught exception deserializing \"LLPackedAppearance\" in GetAppearance for {0}: {1}", userID, e.Message);
}
if (appearancemap != null)
{
AvatarAppearance appearance = new AvatarAppearance(userID, appearancemap);
m_log.DebugFormat("[SIMIAN AVATAR CONNECTOR] Retrieved appearance for {0}:\n{1}", userID, appearance.ToString());
return appearance;
}
}
m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to decode appearance for {0}",userID);
m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to decode appearance for {0}", userID);
return null;
}
m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to get appearance for {0}: {1}",
userID,response["Message"].AsString());
m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to get appearance for {0}: {1}", userID, response["Message"].AsString());
return null;
}

View File

@ -24,7 +24,7 @@
</appender>
<root>
<level value="WARN" />
<level value="DEBUG" />
<appender-ref ref="Console" />
<appender-ref ref="LogFileAppender" />
</root>