Fixing up Appearance handling in Region Sync modules and connectors.

dsg
Dan Lake 2010-12-09 15:07:42 -08:00
parent 681190f682
commit dc86adbd17
10 changed files with 130 additions and 169 deletions

View File

@ -261,6 +261,32 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
}
}
public void RefreshAppearance(UUID agentid)
{
ScenePresence sp;
if(!m_scene.TryGetScenePresence(agentid, out sp))
{
m_log.WarnFormat("[AVFACTORY]: RefreshAppearance unable to find presence for {0}", agentid);
return;
}
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);
}
else
{
m_log.WarnFormat("[AVFACTORY]: RefreshAppearance received null appearance data from grid for {0}", agentid);
}
}, null);
}
private void HandleAppearanceSend(UUID agentid)
{
ScenePresence sp = m_scene.GetScenePresence(agentid);
@ -303,6 +329,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// m_log.WarnFormat("[AVFACTORY] avatar {0} save appearance",agentid);
m_scene.AvatarService.SetAppearance(agentid, sp.Appearance);
// REGION SYNC
// If this is a client manager, we have received new appearance from a client and saved
// it to the avatar service. Now let's tell the parent scene about it.
if (m_scene.IsSyncedClient())
m_scene.RegionSyncClientModule.SendAppearanceToScene(agentid);
}
private void HandleAppearanceUpdateTimer(object sender, EventArgs ea)

View File

@ -266,6 +266,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
}
public void SendAppearanceToScene(UUID agentID)
{
OSDMap data = new OSDMap();
data["agentID"] = OSD.FromUUID(agentID);
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AvatarAppearance, OSDParser.SerializeJsonString(data)));
}
// Handle an incoming message
// TODO: This should not be synchronous with the receive!
// Instead, handle messages from an incoming Queue so server doesn't block sending
@ -654,7 +661,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
case RegionSyncMessage.MsgType.AvatarAppearance:
{
//m_log.WarnFormat("{0} START of AvatarAppearance handler", LogHeader);
m_log.DebugFormat("{0} START of AvatarAppearance handler", LogHeader);
// Get the data from message and error check
OSDMap data = DeserializeMessage(msg);
if (data == null)
@ -671,23 +678,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
return;
}
// Find the presence in the scene
ScenePresence presence;
if (m_scene.TryGetScenePresence(agentID, out presence))
{
string name = presence.Name;
Primitive.TextureEntry te = Primitive.TextureEntry.FromOSD(data["te"]);
byte[] vp = data["vp"].AsBinary();
// Tells the avatar factory to pull an updated appearance from the avatar service
m_scene.AvatarFactory.RefreshAppearance(agentID);
m_log.WarnFormat("{0} Calling presence.SetAppearance for {1} (\"{2}\")", LogHeader, agentID, presence.Name);
m_scene.AvatarFactory.SetAppearance(presence.ControllingClient, te, vp);
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Set appearance for {0}", name));
}
else
{
RegionSyncMessage.HandleWarning(LogHeader, msg, String.Format("Agent {0} not found in the scene.", agentID));
}
//m_log.WarnFormat("{0} END of AvatarAppearance handler", LogHeader);
m_log.DebugFormat("{0} END of AvatarAppearance handler", LogHeader);
return;
}
case RegionSyncMessage.MsgType.SitResponse:
@ -961,21 +955,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
name = sp.Name;
m_log.WarnFormat("{0} Received LLClientView.SetAppearance ({1,3},{2,2}) for {3} (\"{4}\")", LogHeader, vp.Length.ToString(), (te == null) ? "" : "te", agentID.ToString(), sp.Name);
if (sp == null)
{
m_log.WarnFormat("{0} Scene presence could not be found to set appearance.", LogHeader);
return;
}
// Set the appearance on the presence. This will generate the needed exchange with the client if rebakes need to take place.
m_log.WarnFormat("{0} Setting appearance on ScenePresence {1} \"{2}\"", LogHeader, sp.UUID, sp.Name);
m_scene.AvatarFactory.SetAppearance(sp.ControllingClient, te, vp);
if (te != null)
{
//m_log.WarnFormat("{0} Sending appearance to server for {1} \"{2}\"", LogHeader, sp.UUID, sp.Name);
OSDMap data = new OSDMap(3);
data["id"] = OSDUUID.FromUUID(sp.UUID);
data["vp"] = new OSDBinary(sp.Appearance.VisualParams);
data["te"] = te.GetOSD();
Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AvatarAppearance, OSDParser.SerializeJsonString(data)));
}
}
public void HandleAgentRequestSit(object sender, UUID agentID, UUID targetID, Vector3 offset)

View File

@ -120,6 +120,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_client.SendCoarseLocations();
}
public void SendAppearanceToScene(UUID agentID)
{
m_client.SendAppearanceToScene(agentID);
}
public void IncomingLoadBalanceConnection(ScenePresence presence)
{
m_client.IncomingLoadBalanceConnection(presence);

View File

@ -286,8 +286,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
return data;
}
private Dictionary<UUID, System.Threading.Timer> m_appearanceTimers = new Dictionary<UUID, Timer>();
// Handle an incoming message
// *** Perhaps this should not be synchronous with the receive
// We could handle messages from an incoming Queue
@ -463,8 +461,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
case RegionSyncMessage.MsgType.AvatarAppearance:
{
int msgID = msgCount;
m_log.DebugFormat("{0} START of AvatarAppearance handler <{1}>", LogHeader, msgID);
m_log.DebugFormat("{0} START of AvatarAppearance handler", LogHeader);
// Get the data from message and error check
OSDMap data = DeserializeMessage(msg);
if (data == null)
@ -481,41 +478,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
return;
}
ScenePresence presence;
if (m_scene.TryGetScenePresence(agentID, out presence))
{
int delay = 5000;
string name = presence.Name;
m_log.WarnFormat("{0} Waiting {1}ms before setting appearance on presence {2} <{3}>", LogHeader, delay, name, msgID);
Timer appearanceSetter = new Timer(delegate(object obj)
{
//m_log.WarnFormat("{0} Ready to set appearance on presence {1} <{2}>", LogHeader, name, msgID);
Primitive.TextureEntry te = Primitive.TextureEntry.FromOSD(data["te"]);
byte[] vp = data["vp"].AsBinary();
// Tells the avatar factory to pull an updated appearance from the avatar service
m_scene.AvatarFactory.RefreshAppearance(agentID);
m_log.DebugFormat("{0} {1} Calling presence.SetAppearance <{2}>", LogHeader, name, msgID);
try
{
m_scene.AvatarFactory.SetAppearance(presence.ControllingClient, te, vp);
}
catch (Exception e)
{
m_log.WarnFormat("{0} Caught exception setting appearance for {1} (probably was removed from scene): {2}", LogHeader, name, e.Message);
}
RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Set appearance for {0} <{1}>", name, msgID));
m_log.DebugFormat("{0} Calling RegionsSyncServerModule.SendAppearance for {1} <{2}>", LogHeader, name, msgID);
m_scene.RegionSyncServerModule.SendAppearance(presence.UUID, presence.Appearance.VisualParams, presence.Appearance.Texture);
lock (m_appearanceTimers)
m_appearanceTimers.Remove(agentID);
}, null, delay, Timeout.Infinite);
lock (m_appearanceTimers)
m_appearanceTimers[agentID] = appearanceSetter;
}
else
{
RegionSyncMessage.HandleWarning(LogHeader, msg, String.Format("Presence not found in the scene: {0} <{1}>", agentID, msgID));
}
//m_log.WarnFormat("{0} END of AvatarAppearance handler <{1}>", LogHeader, msgID);
m_log.DebugFormat("{0} END of AvatarAppearance handler", LogHeader);
return;
}
case RegionSyncMessage.MsgType.AgentRequestSit:

View File

@ -324,33 +324,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private Dictionary<UUID, System.Threading.Timer> m_appearanceTimers = new Dictionary<UUID, Timer>();
public void SendAppearance(UUID agentID, byte[] vp, Primitive.TextureEntry te)
public void SendAppearance(UUID agentID)
{
ScenePresence sp;
if (!m_scene.TryGetScenePresence(agentID, out sp))
{
m_log.WarnFormat("[REGION SYNC SERVER MODULE] <{0}> {1} SendAppearance could not locate presence!", " ", agentID);
return;
}
m_log.DebugFormat("[REGION SYNC SERVER MODULE] <{0}> {1} ScenePresence called SendAppearance ({2})", sp.Name, agentID, te == null ? " " : "te");
if(te == null)
return;
int delay = 1000;
//m_log.WarnFormat("[REGION SYNC SERVER MODULE] <{0}> {1} Waiting {2}ms before sending appearance to all client managers", sp.Name, agentID, delay);
OSDMap data = new OSDMap(3);
OSDMap data = new OSDMap(1);
data["id"] = OSDUUID.FromUUID(agentID);
data["vp"] = new OSDBinary(vp);
data["te"] = te.GetOSD();
Timer appearanceSetter = new Timer(delegate(object obj)
{
m_log.DebugFormat("[REGION SYNC SERVER MODULE] <{0}> {1} Broadcasting appearance to all client managers", sp.Name, agentID);
m_server.Broadcast(new RegionSyncMessage(RegionSyncMessage.MsgType.AvatarAppearance, OSDParser.SerializeJsonString(data)));
lock (m_appearanceTimers)
m_appearanceTimers.Remove(agentID);
}, null, delay, Timeout.Infinite);
// Just keeps a reference to this timer
lock (m_appearanceTimers)
m_appearanceTimers[agentID] = appearanceSetter;
m_server.Broadcast(new RegionSyncMessage(RegionSyncMessage.MsgType.AvatarAppearance, OSDParser.SerializeJsonString(data)));
}
public void SendAnimations(UUID agentID, UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)

View File

@ -35,6 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
bool ValidateBakedTextureCache(IClientAPI client);
void QueueAppearanceSend(UUID agentid);
void QueueAppearanceSave(UUID agentid);
void RefreshAppearance(UUID agentid);
void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams);
}
}

View File

@ -36,6 +36,7 @@ namespace OpenSim.Region.Framework.Interfaces
bool Active { get; }
bool Synced { get; }
void SendCoarseLocations();
void SendAppearanceToScene(UUID agentID);
void IncomingLoadBalanceConnection(ScenePresence presence);
}
}

View File

@ -43,7 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces
void SendUpdates();
//void DeleteObject(ulong regionHandle, uint localID);
void DeleteObject(ulong regionHandle, uint localID, SceneObjectPart part);
void SendAppearance(UUID agentID, byte[] vp, Primitive.TextureEntry te);
void SendAppearance(UUID agentID);
void SendAnimations(UUID agentID, UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
//KittyL: added to support remote script engine actor

View File

@ -2606,10 +2606,10 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.WarnFormat("[SCENEPRESENCE]: Send appearance from {0} to all other agents", m_uuid);
// DEBUG OFF
// REGION SYNC
// The server should not be doing anything via the ForEachScenePresence method
// The server sends appearance to all client managers since there are no local clients
if (m_scene.IsSyncedServer())
{
m_scene.RegionSyncServerModule.SendAppearance(UUID, Appearance.Texture, Appearance.VisualParams);
m_scene.RegionSyncServerModule.SendAppearance(UUID);
return;
}
if (Appearance.Texture == null)

View File

@ -1,85 +1,77 @@
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;; Start IntSim Service Configuration
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;;
;; Please don't change this file.
;; All optional settings are in GridCommon.ini.example,
;; which you can copy and change.
;;
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Friends]
Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector"
;;
;; In GridCommon.ini, these are the URLs you would use if SimianGrid is
;; installed at http://www.mygrid.com/Grid/
;;
; AssetServerURI = "http://www.mygrid.com/Grid/?id="
; InventoryServerURI = "http://www.mygrid.com/Grid/"
; AvatarServerURI = "http://www.mygrid.com/Grid/"
; PresenceServerURI = "http://www.mygrid.com/Grid/"
; UserAccountServerURI = "http://www.mygrid.com/Grid/"
; AuthenticationServerURI = "http://www.mygrid.com/Grid/"
; FriendsServerURI = "http://www.mygrid.com/Grid/"
; GroupsServerURI = "http://www.mygrid.com/Grid/"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
GridServerURI = "http://grid.beta.sciencesim.com/Grid/"
[Includes]
Include-Common = "config-include/GridCommon.ini"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[LibraryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"
LibraryName = "OpenSim Library"
DefaultLibrary = "./inventory/Libraries.xml"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[AssetService]
DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"
AssetLoaderArgs = "assets/AssetSets.xml"
AssetServerURI = "http://grid.beta.sciencesim.com/Grid/?id="
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[InventoryService]
InventoryServerURI = "http://grid.beta.sciencesim.com/Grid/"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[AvatarService]
AvatarServerURI = "http://grid.beta.sciencesim.com/Grid/"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[PresenceService]
PresenceServerURI = "http://grid.beta.sciencesim.com/Grid/"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[UserAccountService]
UserAccountServerURI = "http://grid.beta.sciencesim.com/Grid/"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[AuthenticationService]
AuthenticationServerURI = "http://grid.beta.sciencesim.com/Grid/"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[FriendsService]
FriendsServerURI = "http://grid.beta.sciencesim.com/Grid/"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Groups]
ServicesConnectorModule = SimianGroupsServicesConnector
GroupsServerURI = "http://grid.beta.sciencesim.com/Grid/"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Modules]
GridServices = "OpenSim.Services.Connectors.dll:SimianGridServiceConnector"
PresenceServices = "OpenSim.Services.Connectors.dll:SimianPresenceServiceConnector"
UserAccountServices = "OpenSim.Services.Connectors.dll:SimianUserAccountServiceConnector"
AuthenticationServices = "OpenSim.Services.Connectors.dll:SimianAuthenticationServiceConnector"
AssetServices = "OpenSim.Services.Connectors.dll:SimianAssetServiceConnector"
InventoryServices = "OpenSim.Services.Connectors.dll:SimianInventoryServiceConnector"
AvatarServices = "OpenSim.Services.Connectors.dll:SimianAvatarServiceConnector"
GridServices = "SimianGridServiceConnector"
PresenceServices = "SimianPresenceServiceConnector"
UserAccountServices = "SimianUserAccountServiceConnector"
AuthenticationServices = "SimianAuthenticationServiceConnector"
AssetServices = "SimianAssetServiceConnector"
InventoryServices = "SimianInventoryServiceConnector"
AvatarServices = "SimianAvatarServiceConnector"
NeighbourServices = "RemoteNeighbourServicesConnector"
SimulationServices = "RemoteSimulationConnectorModule"
EntityTransferModule = "BasicEntityTransferModule"
InventoryAccessModule = "BasicInventoryAccessModule"
NeighbourServices = "RemoteNeighbourServicesConnector"
SimulationServices = "RemoteSimulationConnectorModule"
EntityTransferModule = "BasicEntityTransferModule"
InventoryAccessModule = "BasicInventoryAccessModule"
LandServiceInConnector = true
NeighbourServiceInConnector = true
SimulationServiceInConnector = true
LibraryModule = false
LandServiceInConnector = true
NeighbourServiceInConnector = true
SimulationServiceInConnector = true
LibraryModule = false
AssetCaching = "FlotsamAssetCache"
Include-FlotsamCache = "config-include/FlotsamCache.ini"
AssetCaching = "FlotsamAssetCache"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Architecture@replace]
;; This eliminates the existing Architecture section
[SimulationDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:SimulationDataService"
[EstateDataStore]
LocalServiceModule = "OpenSim.Services.Connectors.dll:EstateDataService"
[Friends]
Connector = "OpenSim.Services.Connectors.dll:SimianFriendsServiceConnector"
[GridService]
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
[LibraryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"
LibraryName = "OpenSim Library"
DefaultLibrary = "./inventory/Libraries.xml"
[AssetService]
DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"
AssetLoaderArgs = "assets/AssetSets.xml"
[Groups]
Enabled = true
Module = GroupsModule
DebugEnabled = false
NoticesEnabled = true
MessagingModule = GroupsMessagingModule
MessagingEnabled = true
ServicesConnectorModule = SimianGroupsServicesConnector
[Profiles]
Module = "SimianProfiles"
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;; Finish ScienceSim Service Configuration
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX