From 66920a9047b54db947d02f252e17409b7fc32ef0 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 12 Jan 2010 09:22:58 -0800 Subject: Fixed more appearance woes that showed up using remote connectors. Appearance is now being passed with AgentCircuitData, as it should be. --- OpenSim/Framework/AgentCircuitData.cs | 54 +++++++++++++++++++++- OpenSim/Framework/AvatarAppearance.cs | 15 ++++++ OpenSim/Framework/ChildAgentDataUpdate.cs | 7 ++- .../Inventory/RemoteInventoryServiceConnector.cs | 8 ---- .../Simulation/LocalSimulationConnector.cs | 10 ++-- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 +-- .../Simulation/SimulationServiceConnector.cs | 14 +++--- OpenSim/Services/Interfaces/IAvatarService.cs | 2 +- .../Services/InventoryService/InventoryService.cs | 1 + 10 files changed, 93 insertions(+), 28 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index c0168e2..ad29950 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -155,6 +155,31 @@ namespace OpenSim.Framework args["secure_session_id"] = OSD.FromUUID(SecureSessionID); args["session_id"] = OSD.FromUUID(SessionID); args["start_pos"] = OSD.FromString(startpos.ToString()); + args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); + + // We might not pass this in all cases... + if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) + { + OSDArray wears = new OSDArray(Appearance.Wearables.Length); + foreach (AvatarWearable awear in Appearance.Wearables) + { + wears.Add(OSD.FromUUID(awear.ItemID)); + wears.Add(OSD.FromUUID(awear.AssetID)); + } + args["wearables"] = wears; + } + + Dictionary attachments = Appearance.GetAttachmentDictionary(); + if ((attachments != null) && (attachments.Count > 0)) + { + OSDArray attachs = new OSDArray(attachments.Count); + foreach (KeyValuePair kvp in attachments) + { + AttachmentData adata = new AttachmentData(kvp.Key, kvp.Value[0], kvp.Value[1]); + attachs.Add(adata.PackUpdateMessage()); + } + args["attachments"] = attachs; + } return args; } @@ -209,8 +234,35 @@ namespace OpenSim.Framework if (args["session_id"] != null) SessionID = args["session_id"].AsUUID(); if (args["start_pos"] != null) - Vector3.TryParse(args["start_pos"].AsString(), out startpos); + Vector3.TryParse(args["start_pos"].AsString(), out startpos); + Appearance = new AvatarAppearance(AgentID); + if (args["appearance_serial"] != null) + Appearance.Serial = args["appearance_serial"].AsInteger(); + if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) + { + OSDArray wears = (OSDArray)(args["wearables"]); + for (int i = 0; i < wears.Count / 2; i++) + { + Appearance.Wearables[i].ItemID = wears[i*2].AsUUID(); + Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID(); + } + } + + if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) + { + OSDArray attachs = (OSDArray)(args["attachments"]); + AttachmentData[] attachments = new AttachmentData[attachs.Count]; + int i = 0; + foreach (OSD o in attachs) + { + if (o.Type == OSDType.Map) + { + attachments[i++] = new AttachmentData((OSDMap)o); + } + } + Appearance.SetAttachments(attachments); + } } } diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 56fcc15..5ec9283 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -566,6 +566,16 @@ namespace OpenSim.Framework private Dictionary m_attachments = new Dictionary(); + public void SetAttachments(AttachmentData[] data) + { + foreach (AttachmentData a in data) + { + m_attachments[a.AttachPoint] = new UUID[2]; + m_attachments[a.AttachPoint][0] = a.ItemID; + m_attachments[a.AttachPoint][1] = a.AssetID; + } + } + public void SetAttachments(Hashtable data) { m_attachments.Clear(); @@ -595,6 +605,11 @@ namespace OpenSim.Framework } } + public Dictionary GetAttachmentDictionary() + { + return m_attachments; + } + public Hashtable GetAttachments() { if (m_attachments.Count == 0) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index b6b7996..fee71f0 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -334,6 +334,7 @@ namespace OpenSim.Framework args["left_axis"] = OSD.FromString(LeftAxis.ToString()); args["up_axis"] = OSD.FromString(UpAxis.ToString()); + args["changed_grid"] = OSD.FromBoolean(ChangedGrid); args["far"] = OSD.FromReal(Far); args["aspect"] = OSD.FromReal(Aspect); @@ -353,7 +354,7 @@ namespace OpenSim.Framework args["agent_access"] = OSD.FromString(AgentAccess.ToString()); args["active_group_id"] = OSD.FromUUID(ActiveGroupID); - + if ((Groups != null) && (Groups.Length > 0)) { OSDArray groups = new OSDArray(Groups.Length); @@ -378,6 +379,7 @@ namespace OpenSim.Framework // args["agent_textures"] = textures; //} + if ((AgentTextures != null) && (AgentTextures.Length > 0)) args["texture_entry"] = OSD.FromBinary(AgentTextures); @@ -393,6 +395,7 @@ namespace OpenSim.Framework args["wearables"] = wears; } + if ((Attachments != null) && (Attachments.Length > 0)) { OSDArray attachs = new OSDArray(Attachments.Length); @@ -401,9 +404,11 @@ namespace OpenSim.Framework args["attachments"] = attachs; } + if ((CallbackURI != null) && (!CallbackURI.Equals(""))) args["callback_uri"] = OSD.FromString(CallbackURI); + return args; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index f20a2a9..aa3b30d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -337,15 +337,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory private UUID GetSessionID(UUID userID) { - ScenePresence sp = null; - if (m_Scene.TryGetAvatar(userID, out sp)) - { - return sp.ControllingClient.SessionId; - } - - m_log.DebugFormat("[INVENTORY CONNECTOR]: scene presence for {0} not found", userID); return UUID.Zero; - } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index c6c6af0..723973c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -172,12 +172,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation { if (s.RegionInfo.RegionHandle == destination.RegionHandle) { - m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", destination.RegionName); + m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName); return s.NewUserConnection(aCircuit, teleportFlags, out reason); } } - m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", destination.RegionName); + m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Did not find region {0} for SendCreateChildAgent", destination.RegionName); reason = "Did not find region " + destination.RegionName; return false; } @@ -191,9 +191,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation { if (s.RegionInfo.RegionHandle == destination.RegionHandle) { - //m_log.DebugFormat( - // "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate", - // s.RegionInfo.RegionName, regionHandle); + m_log.DebugFormat( + "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", + s.RegionInfo.RegionName, destination.RegionHandle); s.IncomingChildAgentDataUpdate(cAgentData); return true; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index db7b3ff..6c8068c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3708,8 +3708,8 @@ namespace OpenSim.Region.Framework.Scenes /// true if we handled it. public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) { -// m_log.DebugFormat( -// "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); + m_log.DebugFormat( + "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); // We have to wait until the viewer contacts this region after receiving EAC. // That calls AddNewClient, which finally creates the ScenePresence diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ae586a1..c7a457e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2575,9 +2575,9 @@ namespace OpenSim.Region.Framework.Scenes if (m_appearance.AvatarHeight > 0) SetHeight(m_appearance.AvatarHeight); - AvatarData adata = new AvatarData(m_appearance); - - m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); + // This is not needed, because only the transient data changed + //AvatarData adata = new AvatarData(m_appearance); + //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); SendAppearanceToAllOtherAgents(); if (!m_startAnimationSet) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 76558aa..bd72570 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -210,12 +210,12 @@ namespace OpenSim.Services.Connectors.Simulation public bool UpdateAgent(GridRegion destination, AgentData data) { - return UpdateAgent(destination, data); + return UpdateAgent(destination, (IAgentData)data); } public bool UpdateAgent(GridRegion destination, AgentPosition data) { - return UpdateAgent(destination, data); + return UpdateAgent(destination, (IAgentData)data); } private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) @@ -231,7 +231,7 @@ namespace OpenSim.Services.Connectors.Simulation m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); return false; } - //Console.WriteLine(" >>> DoChildAgentUpdateCall <<< " + uri); + Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); ChildUpdateRequest.Method = "PUT"; @@ -276,12 +276,12 @@ namespace OpenSim.Services.Connectors.Simulation ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send os = ChildUpdateRequest.GetRequestStream(); os.Write(buffer, 0, strBuffer.Length); //Send it - //m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted ChildAgentUpdate request to remote sim {0}", uri); + m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted AgentUpdate request to remote sim {0}", uri); } - //catch (WebException ex) - catch + catch (WebException ex) + //catch { - //m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on ChildAgentUpdate {0}", ex.Message); + m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on AgentUpdate {0}", ex.Message); return false; } diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs index 564c406..de3bcf9 100644 --- a/OpenSim/Services/Interfaces/IAvatarService.cs +++ b/OpenSim/Services/Interfaces/IAvatarService.cs @@ -123,7 +123,7 @@ namespace OpenSim.Services.Interfaces if (_kvp.Value != null) result[_kvp.Key] = _kvp.Value; } - return null; + return result; } public AvatarData(AvatarAppearance appearance) diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 95007f1..781b89b 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs @@ -298,6 +298,7 @@ namespace OpenSim.Services.InventoryService if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) folders[(AssetType)folder.Type] = folder; } + m_log.DebugFormat("[INVENTORY SERVICE]: Got {0} system folders for {1}", folders.Count, userID); return folders; } } -- cgit v1.1