diff options
Diffstat (limited to '')
53 files changed, 1412 insertions, 1059 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index aeed467..1829c8d 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -1472,12 +1472,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1472 | { | 1472 | { |
1473 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", destination, source); | 1473 | m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", destination, source); |
1474 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; | 1474 | Scene scene = m_application.SceneManager.CurrentOrFirstScene; |
1475 | AvatarAppearance avatarAppearance = null; | ||
1476 | AvatarData avatar = scene.AvatarService.GetAvatar(source); | ||
1477 | if (avatar != null) | ||
1478 | avatarAppearance = avatar.ToAvatarAppearance(source); | ||
1479 | 1475 | ||
1480 | // If the model has no associated appearance we're done. | 1476 | // If the model has no associated appearance we're done. |
1477 | AvatarAppearance avatarAppearance = scene.AvatarService.GetAppearance(source); | ||
1481 | if (avatarAppearance == null) | 1478 | if (avatarAppearance == null) |
1482 | return; | 1479 | return; |
1483 | 1480 | ||
@@ -1491,8 +1488,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1491 | { | 1488 | { |
1492 | CopyWearablesAndAttachments(destination, source, avatarAppearance); | 1489 | CopyWearablesAndAttachments(destination, source, avatarAppearance); |
1493 | 1490 | ||
1494 | AvatarData avatarData = new AvatarData(avatarAppearance); | 1491 | scene.AvatarService.SetAppearance(destination, avatarAppearance); |
1495 | scene.AvatarService.SetAvatar(destination, avatarData); | ||
1496 | } | 1492 | } |
1497 | catch (Exception e) | 1493 | catch (Exception e) |
1498 | { | 1494 | { |
@@ -1523,8 +1519,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1523 | } | 1519 | } |
1524 | } | 1520 | } |
1525 | 1521 | ||
1526 | AvatarData avatarData = new AvatarData(avatarAppearance); | 1522 | scene.AvatarService.SetAppearance(destination, avatarAppearance); |
1527 | scene.AvatarService.SetAvatar(destination, avatarData); | ||
1528 | } | 1523 | } |
1529 | catch (Exception e) | 1524 | catch (Exception e) |
1530 | { | 1525 | { |
@@ -1619,12 +1614,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1619 | } | 1614 | } |
1620 | 1615 | ||
1621 | // Attachments | 1616 | // Attachments |
1622 | Dictionary<int, UUID[]> attachments = avatarAppearance.GetAttachmentDictionary(); | 1617 | List<AvatarAttachment> attachments = avatarAppearance.GetAttachments(); |
1623 | 1618 | ||
1624 | foreach (KeyValuePair<int, UUID[]> attachment in attachments) | 1619 | foreach (AvatarAttachment attachment in attachments) |
1625 | { | 1620 | { |
1626 | int attachpoint = attachment.Key; | 1621 | int attachpoint = attachment.AttachPoint; |
1627 | UUID itemID = attachment.Value[0]; | 1622 | UUID itemID = attachment.ItemID; |
1628 | 1623 | ||
1629 | if (itemID != UUID.Zero) | 1624 | if (itemID != UUID.Zero) |
1630 | { | 1625 | { |
@@ -1908,10 +1903,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1908 | if (include) | 1903 | if (include) |
1909 | { | 1904 | { |
1910 | // Setup for appearance processing | 1905 | // Setup for appearance processing |
1911 | AvatarData avatarData = scene.AvatarService.GetAvatar(ID); | 1906 | avatarAppearance = scene.AvatarService.GetAppearance(ID); |
1912 | if (avatarData != null) | 1907 | if (avatarAppearance == null) |
1913 | avatarAppearance = avatarData.ToAvatarAppearance(ID); | ||
1914 | else | ||
1915 | avatarAppearance = new AvatarAppearance(); | 1908 | avatarAppearance = new AvatarAppearance(); |
1916 | 1909 | ||
1917 | AvatarWearable[] wearables = avatarAppearance.Wearables; | 1910 | AvatarWearable[] wearables = avatarAppearance.Wearables; |
@@ -2076,8 +2069,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
2076 | m_log.DebugFormat("[RADMIN] Outfit {0} load completed", outfitName); | 2069 | m_log.DebugFormat("[RADMIN] Outfit {0} load completed", outfitName); |
2077 | } // foreach outfit | 2070 | } // foreach outfit |
2078 | m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); | 2071 | m_log.DebugFormat("[RADMIN] Inventory update complete for {0}", name); |
2079 | AvatarData avatarData2 = new AvatarData(avatarAppearance); | 2072 | scene.AvatarService.SetAppearance(ID, avatarAppearance); |
2080 | scene.AvatarService.SetAvatar(ID, avatarData2); | ||
2081 | } | 2073 | } |
2082 | catch (Exception e) | 2074 | catch (Exception e) |
2083 | { | 2075 | { |
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs index 8271d76..3f6d4d6 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | ||
30 | using System.Xml; | 31 | using System.Xml; |
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
@@ -765,25 +766,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
765 | FormatPart(rdata, "UnderShirt", rdata.userAppearance.UnderShirtItem, rdata.userAppearance.UnderShirtAsset); | 766 | FormatPart(rdata, "UnderShirt", rdata.userAppearance.UnderShirtItem, rdata.userAppearance.UnderShirtAsset); |
766 | FormatPart(rdata, "UnderPants", rdata.userAppearance.UnderPantsItem, rdata.userAppearance.UnderPantsAsset); | 767 | FormatPart(rdata, "UnderPants", rdata.userAppearance.UnderPantsItem, rdata.userAppearance.UnderPantsAsset); |
767 | 768 | ||
768 | Hashtable attachments = rdata.userAppearance.GetAttachments(); | 769 | Rest.Log.DebugFormat("{0} FormatUserAppearance: Formatting attachments", MsgId); |
769 | 770 | ||
770 | if (attachments != null) | 771 | rdata.writer.WriteStartElement("Attachments"); |
772 | List<AvatarAttachment> attachments = rdata.userAppearance.GetAttachments(); | ||
773 | foreach (AvatarAttachment attach in attachments) | ||
771 | { | 774 | { |
772 | 775 | rdata.writer.WriteStartElement("Attachment"); | |
773 | Rest.Log.DebugFormat("{0} FormatUserAppearance: Formatting attachments", MsgId); | 776 | rdata.writer.WriteAttributeString("AtPoint", attach.AttachPoint.ToString()); |
774 | 777 | rdata.writer.WriteAttributeString("Item", attach.ItemID.ToString()); | |
775 | rdata.writer.WriteStartElement("Attachments"); | 778 | rdata.writer.WriteAttributeString("Asset", attach.AssetID.ToString()); |
776 | for (int i = 0; i < attachments.Count; i++) | ||
777 | { | ||
778 | Hashtable attachment = attachments[i] as Hashtable; | ||
779 | rdata.writer.WriteStartElement("Attachment"); | ||
780 | rdata.writer.WriteAttributeString("AtPoint", i.ToString()); | ||
781 | rdata.writer.WriteAttributeString("Item", (string) attachment["item"]); | ||
782 | rdata.writer.WriteAttributeString("Asset", (string) attachment["asset"]); | ||
783 | rdata.writer.WriteEndElement(); | ||
784 | } | ||
785 | rdata.writer.WriteEndElement(); | 779 | rdata.writer.WriteEndElement(); |
786 | } | 780 | } |
781 | rdata.writer.WriteEndElement(); | ||
787 | 782 | ||
788 | Primitive.TextureEntry texture = rdata.userAppearance.Texture; | 783 | Primitive.TextureEntry texture = rdata.userAppearance.Texture; |
789 | 784 | ||
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index af9478e..19331c6 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs | |||
@@ -596,7 +596,7 @@ namespace OpenSim.Client.MXP.ClientStack | |||
596 | public event TeleportLandmarkRequest OnTeleportLandmarkRequest; | 596 | public event TeleportLandmarkRequest OnTeleportLandmarkRequest; |
597 | public event DeRezObject OnDeRezObject; | 597 | public event DeRezObject OnDeRezObject; |
598 | public event Action<IClientAPI> OnRegionHandShakeReply; | 598 | public event Action<IClientAPI> OnRegionHandShakeReply; |
599 | public event GenericCall2 OnRequestWearables; | 599 | public event GenericCall1 OnRequestWearables; |
600 | public event GenericCall1 OnCompleteMovementToRegion; | 600 | public event GenericCall1 OnCompleteMovementToRegion; |
601 | public event UpdateAgent OnPreAgentUpdate; | 601 | public event UpdateAgent OnPreAgentUpdate; |
602 | public event UpdateAgent OnAgentUpdate; | 602 | public event UpdateAgent OnAgentUpdate; |
@@ -861,7 +861,7 @@ namespace OpenSim.Client.MXP.ClientStack | |||
861 | OpenSim.Region.Framework.Scenes.Scene scene=(OpenSim.Region.Framework.Scenes.Scene)Scene; | 861 | OpenSim.Region.Framework.Scenes.Scene scene=(OpenSim.Region.Framework.Scenes.Scene)Scene; |
862 | AvatarAppearance appearance; | 862 | AvatarAppearance appearance; |
863 | scene.GetAvatarAppearance(this,out appearance); | 863 | scene.GetAvatarAppearance(this,out appearance); |
864 | OnSetAppearance(appearance.Texture, (byte[])appearance.VisualParams.Clone()); | 864 | OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone()); |
865 | } | 865 | } |
866 | 866 | ||
867 | public void Stop() | 867 | public void Stop() |
diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs index 7056e01..dcecb8b 100644 --- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs +++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs | |||
@@ -533,9 +533,7 @@ namespace OpenSim.Client.MXP.PacketHandler | |||
533 | agent.InventoryFolder = UUID.Zero; | 533 | agent.InventoryFolder = UUID.Zero; |
534 | agent.startpos = new Vector3(0, 0, 0); // TODO Fill in region start position | 534 | agent.startpos = new Vector3(0, 0, 0); // TODO Fill in region start position |
535 | agent.CapsPath = "http://localhost/"; | 535 | agent.CapsPath = "http://localhost/"; |
536 | AvatarData avatar = scene.AvatarService.GetAvatar(account.PrincipalID); | 536 | agent.Appearance = scene.AvatarService.GetAppearance(account.PrincipalID); |
537 | if (avatar != null) | ||
538 | agent.Appearance = avatar.ToAvatarAppearance(account.PrincipalID); //userService.GetUserAppearance(userProfile.ID); | ||
539 | 537 | ||
540 | if (agent.Appearance == null) | 538 | if (agent.Appearance == null) |
541 | { | 539 | { |
diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 99a46dc..0d23232 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs | |||
@@ -245,7 +245,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack | |||
245 | public event TeleportLandmarkRequest OnTeleportLandmarkRequest = delegate { }; | 245 | public event TeleportLandmarkRequest OnTeleportLandmarkRequest = delegate { }; |
246 | public event DeRezObject OnDeRezObject = delegate { }; | 246 | public event DeRezObject OnDeRezObject = delegate { }; |
247 | public event Action<IClientAPI> OnRegionHandShakeReply = delegate { }; | 247 | public event Action<IClientAPI> OnRegionHandShakeReply = delegate { }; |
248 | public event GenericCall2 OnRequestWearables = delegate { }; | 248 | public event GenericCall1 OnRequestWearables = delegate { }; |
249 | public event GenericCall1 OnCompleteMovementToRegion = delegate { }; | 249 | public event GenericCall1 OnCompleteMovementToRegion = delegate { }; |
250 | public event UpdateAgent OnPreAgentUpdate; | 250 | public event UpdateAgent OnPreAgentUpdate; |
251 | public event UpdateAgent OnAgentUpdate = delegate { }; | 251 | public event UpdateAgent OnAgentUpdate = delegate { }; |
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 4f89d78..640a646 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -26,7 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | ||
30 | using OpenMetaverse; | 32 | using OpenMetaverse; |
31 | using OpenMetaverse.StructuredData; | 33 | using OpenMetaverse.StructuredData; |
32 | 34 | ||
@@ -38,6 +40,12 @@ namespace OpenSim.Framework | |||
38 | /// </summary> | 40 | /// </summary> |
39 | public class AgentCircuitData | 41 | public class AgentCircuitData |
40 | { | 42 | { |
43 | // DEBUG ON | ||
44 | private static readonly ILog m_log = | ||
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | // DEBUG OFF | ||
48 | |||
41 | /// <summary> | 49 | /// <summary> |
42 | /// Avatar Unique Agent Identifier | 50 | /// Avatar Unique Agent Identifier |
43 | /// </summary> | 51 | /// </summary> |
@@ -198,15 +206,18 @@ namespace OpenSim.Framework | |||
198 | 206 | ||
199 | args["service_session_id"] = OSD.FromString(ServiceSessionID); | 207 | args["service_session_id"] = OSD.FromString(ServiceSessionID); |
200 | args["start_pos"] = OSD.FromString(startpos.ToString()); | 208 | args["start_pos"] = OSD.FromString(startpos.ToString()); |
201 | args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); | ||
202 | args["client_ip"] = OSD.FromString(IPAddress); | 209 | args["client_ip"] = OSD.FromString(IPAddress); |
203 | args["viewer"] = OSD.FromString(Viewer); | 210 | args["viewer"] = OSD.FromString(Viewer); |
204 | args["channel"] = OSD.FromString(Channel); | 211 | args["channel"] = OSD.FromString(Channel); |
205 | args["mac"] = OSD.FromString(Mac); | 212 | args["mac"] = OSD.FromString(Mac); |
206 | args["id0"] = OSD.FromString(Id0); | 213 | args["id0"] = OSD.FromString(Id0); |
207 | 214 | ||
215 | // Eventually this code should be deprecated, use full appearance | ||
216 | // packing in packed_appearance | ||
208 | if (Appearance != null) | 217 | if (Appearance != null) |
209 | { | 218 | { |
219 | args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); | ||
220 | |||
210 | //System.Console.WriteLine("XXX Before packing Wearables"); | 221 | //System.Console.WriteLine("XXX Before packing Wearables"); |
211 | if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) | 222 | if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) |
212 | { | 223 | { |
@@ -221,20 +232,25 @@ namespace OpenSim.Framework | |||
221 | } | 232 | } |
222 | 233 | ||
223 | //System.Console.WriteLine("XXX Before packing Attachments"); | 234 | //System.Console.WriteLine("XXX Before packing Attachments"); |
224 | Dictionary<int, UUID[]> attachments = Appearance.GetAttachmentDictionary(); | 235 | List<AvatarAttachment> attachments = Appearance.GetAttachments(); |
225 | if ((attachments != null) && (attachments.Count > 0)) | 236 | if ((attachments != null) && (attachments.Count > 0)) |
226 | { | 237 | { |
227 | OSDArray attachs = new OSDArray(attachments.Count); | 238 | OSDArray attachs = new OSDArray(attachments.Count); |
228 | foreach (KeyValuePair<int, UUID[]> kvp in attachments) | 239 | foreach (AvatarAttachment attach in attachments) |
229 | { | 240 | { |
230 | AttachmentData adata = new AttachmentData(kvp.Key, kvp.Value[0], kvp.Value[1]); | 241 | attachs.Add(attach.Pack()); |
231 | attachs.Add(adata.PackUpdateMessage()); | ||
232 | //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]); | 242 | //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]); |
233 | } | 243 | } |
234 | args["attachments"] = attachs; | 244 | args["attachments"] = attachs; |
235 | } | 245 | } |
236 | } | 246 | } |
237 | 247 | ||
248 | if (Appearance != null) | ||
249 | { | ||
250 | OSDMap appmap = Appearance.Pack(); | ||
251 | args["packed_appearance"] = appmap; | ||
252 | } | ||
253 | |||
238 | if (ServiceURLs != null && ServiceURLs.Count > 0) | 254 | if (ServiceURLs != null && ServiceURLs.Count > 0) |
239 | { | 255 | { |
240 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); | 256 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); |
@@ -317,34 +333,57 @@ namespace OpenSim.Framework | |||
317 | if (args["start_pos"] != null) | 333 | if (args["start_pos"] != null) |
318 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); | 334 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); |
319 | 335 | ||
336 | // DEBUG ON | ||
337 | m_log.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString()); | ||
338 | // DEBUG OFF | ||
339 | |||
340 | try { | ||
341 | // Unpack various appearance elements | ||
320 | Appearance = new AvatarAppearance(AgentID); | 342 | Appearance = new AvatarAppearance(AgentID); |
343 | |||
344 | // Eventually this code should be deprecated, use full appearance | ||
345 | // packing in packed_appearance | ||
321 | if (args["appearance_serial"] != null) | 346 | if (args["appearance_serial"] != null) |
322 | Appearance.Serial = args["appearance_serial"].AsInteger(); | 347 | Appearance.Serial = args["appearance_serial"].AsInteger(); |
348 | |||
323 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) | 349 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) |
324 | { | 350 | { |
325 | OSDArray wears = (OSDArray)(args["wearables"]); | 351 | OSDArray wears = (OSDArray)(args["wearables"]); |
326 | for (int i = 0; i < wears.Count / 2; i++) | 352 | for (int i = 0; i < wears.Count / 2; i++) |
327 | { | 353 | { |
328 | Appearance.Wearables[i].ItemID = wears[i*2].AsUUID(); | 354 | AvatarWearable awear = new AvatarWearable(wears[i*2].AsUUID(),wears[(i*2)+1].AsUUID()); |
329 | Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID(); | 355 | Appearance.SetWearable(i,awear); |
330 | } | 356 | } |
331 | } | 357 | } |
332 | 358 | ||
333 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) | 359 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) |
334 | { | 360 | { |
335 | OSDArray attachs = (OSDArray)(args["attachments"]); | 361 | OSDArray attachs = (OSDArray)(args["attachments"]); |
336 | AttachmentData[] attachments = new AttachmentData[attachs.Count]; | ||
337 | int i = 0; | ||
338 | foreach (OSD o in attachs) | 362 | foreach (OSD o in attachs) |
339 | { | 363 | { |
340 | if (o.Type == OSDType.Map) | 364 | if (o.Type == OSDType.Map) |
341 | { | 365 | { |
342 | attachments[i++] = new AttachmentData((OSDMap)o); | 366 | Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); |
343 | } | 367 | } |
344 | } | 368 | } |
345 | Appearance.SetAttachments(attachments); | ||
346 | } | 369 | } |
347 | 370 | ||
371 | if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) | ||
372 | { | ||
373 | Appearance.Unpack((OSDMap)args["packed_appearance"]); | ||
374 | // DEBUG ON | ||
375 | m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance"); | ||
376 | // DEBUG OFF | ||
377 | } | ||
378 | // DEBUG ON | ||
379 | else | ||
380 | m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance"); | ||
381 | // DEBUG OFF | ||
382 | } catch (Exception e) | ||
383 | { | ||
384 | m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message); | ||
385 | } | ||
386 | |||
348 | ServiceURLs = new Dictionary<string, object>(); | 387 | ServiceURLs = new Dictionary<string, object>(); |
349 | if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) | 388 | if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) |
350 | { | 389 | { |
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 5da8ba1..e66a1e7 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -26,9 +26,12 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | ||
29 | using System.Collections; | 30 | using System.Collections; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenMetaverse.StructuredData; | ||
34 | using log4net; | ||
32 | 35 | ||
33 | namespace OpenSim.Framework | 36 | namespace OpenSim.Framework |
34 | { | 37 | { |
@@ -37,48 +40,26 @@ namespace OpenSim.Framework | |||
37 | /// </summary> | 40 | /// </summary> |
38 | public class AvatarAppearance | 41 | public class AvatarAppearance |
39 | { | 42 | { |
40 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | |||
42 | // these are guessed at by the list here - | ||
43 | // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll | ||
44 | // correct them over time for when were are wrong. | ||
45 | public readonly static int BODY = 0; | ||
46 | public readonly static int SKIN = 1; | ||
47 | public readonly static int HAIR = 2; | ||
48 | public readonly static int EYES = 3; | ||
49 | public readonly static int SHIRT = 4; | ||
50 | public readonly static int PANTS = 5; | ||
51 | public readonly static int SHOES = 6; | ||
52 | public readonly static int SOCKS = 7; | ||
53 | public readonly static int JACKET = 8; | ||
54 | public readonly static int GLOVES = 9; | ||
55 | public readonly static int UNDERSHIRT = 10; | ||
56 | public readonly static int UNDERPANTS = 11; | ||
57 | public readonly static int SKIRT = 12; | ||
58 | |||
59 | private readonly static int MAX_WEARABLES = 13; | ||
60 | |||
61 | private static UUID BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
62 | private static UUID BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); | ||
63 | private static UUID SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); | ||
64 | private static UUID SKIN_ITEM = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9"); | ||
65 | private static UUID SHIRT_ASSET = new UUID("00000000-38f9-1111-024e-222222111110"); | ||
66 | private static UUID SHIRT_ITEM = new UUID("77c41e39-38f9-f75a-0000-585989bf0000"); | ||
67 | private static UUID PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120"); | ||
68 | private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); | ||
69 | private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); | ||
70 | private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66"); | ||
71 | 44 | ||
72 | public readonly static int VISUALPARAM_COUNT = 218; | 45 | public readonly static int VISUALPARAM_COUNT = 218; |
73 | 46 | ||
47 | public readonly static int TEXTURE_COUNT = 21; | ||
48 | |||
74 | protected UUID m_owner; | 49 | protected UUID m_owner; |
50 | protected int m_serial = 1; | ||
51 | protected byte[] m_visualparams; | ||
52 | protected Primitive.TextureEntry m_texture; | ||
53 | protected AvatarWearable[] m_wearables; | ||
54 | protected Dictionary<int, List<AvatarAttachment>> m_attachments; | ||
55 | protected float m_avatarHeight = 0; | ||
56 | protected float m_hipOffset = 0; | ||
75 | 57 | ||
76 | public virtual UUID Owner | 58 | public virtual UUID Owner |
77 | { | 59 | { |
78 | get { return m_owner; } | 60 | get { return m_owner; } |
79 | set { m_owner = value; } | 61 | set { m_owner = value; } |
80 | } | 62 | } |
81 | protected int m_serial = 1; | ||
82 | 63 | ||
83 | public virtual int Serial | 64 | public virtual int Serial |
84 | { | 65 | { |
@@ -86,15 +67,17 @@ namespace OpenSim.Framework | |||
86 | set { m_serial = value; } | 67 | set { m_serial = value; } |
87 | } | 68 | } |
88 | 69 | ||
89 | protected byte[] m_visualparams; | ||
90 | |||
91 | public virtual byte[] VisualParams | 70 | public virtual byte[] VisualParams |
92 | { | 71 | { |
93 | get { return m_visualparams; } | 72 | get { return m_visualparams; } |
94 | set { m_visualparams = value; } | 73 | set { m_visualparams = value; } |
95 | } | 74 | } |
96 | 75 | ||
97 | protected AvatarWearable[] m_wearables; | 76 | public virtual Primitive.TextureEntry Texture |
77 | { | ||
78 | get { return m_texture; } | ||
79 | set { m_texture = value; } | ||
80 | } | ||
98 | 81 | ||
99 | public virtual AvatarWearable[] Wearables | 82 | public virtual AvatarWearable[] Wearables |
100 | { | 83 | { |
@@ -103,178 +86,135 @@ namespace OpenSim.Framework | |||
103 | } | 86 | } |
104 | 87 | ||
105 | public virtual UUID BodyItem { | 88 | public virtual UUID BodyItem { |
106 | get { return m_wearables[BODY].ItemID; } | 89 | get { return m_wearables[AvatarWearable.BODY].ItemID; } |
107 | set { m_wearables[BODY].ItemID = value; } | 90 | set { m_wearables[AvatarWearable.BODY].ItemID = value; } |
108 | } | 91 | } |
109 | 92 | ||
110 | public virtual UUID BodyAsset { | 93 | public virtual UUID BodyAsset { |
111 | get { return m_wearables[BODY].AssetID; } | 94 | get { return m_wearables[AvatarWearable.BODY].AssetID; } |
112 | set { m_wearables[BODY].AssetID = value; } | 95 | set { m_wearables[AvatarWearable.BODY].AssetID = value; } |
113 | } | 96 | } |
114 | 97 | ||
115 | public virtual UUID SkinItem { | 98 | public virtual UUID SkinItem { |
116 | get { return m_wearables[SKIN].ItemID; } | 99 | get { return m_wearables[AvatarWearable.SKIN].ItemID; } |
117 | set { m_wearables[SKIN].ItemID = value; } | 100 | set { m_wearables[AvatarWearable.SKIN].ItemID = value; } |
118 | } | 101 | } |
119 | 102 | ||
120 | public virtual UUID SkinAsset { | 103 | public virtual UUID SkinAsset { |
121 | get { return m_wearables[SKIN].AssetID; } | 104 | get { return m_wearables[AvatarWearable.SKIN].AssetID; } |
122 | set { m_wearables[SKIN].AssetID = value; } | 105 | set { m_wearables[AvatarWearable.SKIN].AssetID = value; } |
123 | } | 106 | } |
124 | 107 | ||
125 | public virtual UUID HairItem { | 108 | public virtual UUID HairItem { |
126 | get { return m_wearables[HAIR].ItemID; } | 109 | get { return m_wearables[AvatarWearable.HAIR].ItemID; } |
127 | set { m_wearables[HAIR].ItemID = value; } | 110 | set { m_wearables[AvatarWearable.HAIR].ItemID = value; } |
128 | } | 111 | } |
129 | 112 | ||
130 | public virtual UUID HairAsset { | 113 | public virtual UUID HairAsset { |
131 | get { return m_wearables[HAIR].AssetID; } | 114 | get { return m_wearables[AvatarWearable.HAIR].AssetID; } |
132 | set { m_wearables[HAIR].AssetID = value; } | 115 | set { m_wearables[AvatarWearable.HAIR].AssetID = value; } |
133 | } | 116 | } |
134 | 117 | ||
135 | public virtual UUID EyesItem { | 118 | public virtual UUID EyesItem { |
136 | get { return m_wearables[EYES].ItemID; } | 119 | get { return m_wearables[AvatarWearable.EYES].ItemID; } |
137 | set { m_wearables[EYES].ItemID = value; } | 120 | set { m_wearables[AvatarWearable.EYES].ItemID = value; } |
138 | } | 121 | } |
139 | 122 | ||
140 | public virtual UUID EyesAsset { | 123 | public virtual UUID EyesAsset { |
141 | get { return m_wearables[EYES].AssetID; } | 124 | get { return m_wearables[AvatarWearable.EYES].AssetID; } |
142 | set { m_wearables[EYES].AssetID = value; } | 125 | set { m_wearables[AvatarWearable.EYES].AssetID = value; } |
143 | } | 126 | } |
144 | 127 | ||
145 | public virtual UUID ShirtItem { | 128 | public virtual UUID ShirtItem { |
146 | get { return m_wearables[SHIRT].ItemID; } | 129 | get { return m_wearables[AvatarWearable.SHIRT].ItemID; } |
147 | set { m_wearables[SHIRT].ItemID = value; } | 130 | set { m_wearables[AvatarWearable.SHIRT].ItemID = value; } |
148 | } | 131 | } |
149 | 132 | ||
150 | public virtual UUID ShirtAsset { | 133 | public virtual UUID ShirtAsset { |
151 | get { return m_wearables[SHIRT].AssetID; } | 134 | get { return m_wearables[AvatarWearable.SHIRT].AssetID; } |
152 | set { m_wearables[SHIRT].AssetID = value; } | 135 | set { m_wearables[AvatarWearable.SHIRT].AssetID = value; } |
153 | } | 136 | } |
154 | 137 | ||
155 | public virtual UUID PantsItem { | 138 | public virtual UUID PantsItem { |
156 | get { return m_wearables[PANTS].ItemID; } | 139 | get { return m_wearables[AvatarWearable.PANTS].ItemID; } |
157 | set { m_wearables[PANTS].ItemID = value; } | 140 | set { m_wearables[AvatarWearable.PANTS].ItemID = value; } |
158 | } | 141 | } |
159 | 142 | ||
160 | public virtual UUID PantsAsset { | 143 | public virtual UUID PantsAsset { |
161 | get { return m_wearables[PANTS].AssetID; } | 144 | get { return m_wearables[AvatarWearable.PANTS].AssetID; } |
162 | set { m_wearables[PANTS].AssetID = value; } | 145 | set { m_wearables[AvatarWearable.PANTS].AssetID = value; } |
163 | } | 146 | } |
164 | 147 | ||
165 | public virtual UUID ShoesItem { | 148 | public virtual UUID ShoesItem { |
166 | get { return m_wearables[SHOES].ItemID; } | 149 | get { return m_wearables[AvatarWearable.SHOES].ItemID; } |
167 | set { m_wearables[SHOES].ItemID = value; } | 150 | set { m_wearables[AvatarWearable.SHOES].ItemID = value; } |
168 | } | 151 | } |
169 | 152 | ||
170 | public virtual UUID ShoesAsset { | 153 | public virtual UUID ShoesAsset { |
171 | get { return m_wearables[SHOES].AssetID; } | 154 | get { return m_wearables[AvatarWearable.SHOES].AssetID; } |
172 | set { m_wearables[SHOES].AssetID = value; } | 155 | set { m_wearables[AvatarWearable.SHOES].AssetID = value; } |
173 | } | 156 | } |
174 | 157 | ||
175 | public virtual UUID SocksItem { | 158 | public virtual UUID SocksItem { |
176 | get { return m_wearables[SOCKS].ItemID; } | 159 | get { return m_wearables[AvatarWearable.SOCKS].ItemID; } |
177 | set { m_wearables[SOCKS].ItemID = value; } | 160 | set { m_wearables[AvatarWearable.SOCKS].ItemID = value; } |
178 | } | 161 | } |
179 | 162 | ||
180 | public virtual UUID SocksAsset { | 163 | public virtual UUID SocksAsset { |
181 | get { return m_wearables[SOCKS].AssetID; } | 164 | get { return m_wearables[AvatarWearable.SOCKS].AssetID; } |
182 | set { m_wearables[SOCKS].AssetID = value; } | 165 | set { m_wearables[AvatarWearable.SOCKS].AssetID = value; } |
183 | } | 166 | } |
184 | 167 | ||
185 | public virtual UUID JacketItem { | 168 | public virtual UUID JacketItem { |
186 | get { return m_wearables[JACKET].ItemID; } | 169 | get { return m_wearables[AvatarWearable.JACKET].ItemID; } |
187 | set { m_wearables[JACKET].ItemID = value; } | 170 | set { m_wearables[AvatarWearable.JACKET].ItemID = value; } |
188 | } | 171 | } |
189 | 172 | ||
190 | public virtual UUID JacketAsset { | 173 | public virtual UUID JacketAsset { |
191 | get { return m_wearables[JACKET].AssetID; } | 174 | get { return m_wearables[AvatarWearable.JACKET].AssetID; } |
192 | set { m_wearables[JACKET].AssetID = value; } | 175 | set { m_wearables[AvatarWearable.JACKET].AssetID = value; } |
193 | } | 176 | } |
194 | 177 | ||
195 | public virtual UUID GlovesItem { | 178 | public virtual UUID GlovesItem { |
196 | get { return m_wearables[GLOVES].ItemID; } | 179 | get { return m_wearables[AvatarWearable.GLOVES].ItemID; } |
197 | set { m_wearables[GLOVES].ItemID = value; } | 180 | set { m_wearables[AvatarWearable.GLOVES].ItemID = value; } |
198 | } | 181 | } |
199 | 182 | ||
200 | public virtual UUID GlovesAsset { | 183 | public virtual UUID GlovesAsset { |
201 | get { return m_wearables[GLOVES].AssetID; } | 184 | get { return m_wearables[AvatarWearable.GLOVES].AssetID; } |
202 | set { m_wearables[GLOVES].AssetID = value; } | 185 | set { m_wearables[AvatarWearable.GLOVES].AssetID = value; } |
203 | } | 186 | } |
204 | 187 | ||
205 | public virtual UUID UnderShirtItem { | 188 | public virtual UUID UnderShirtItem { |
206 | get { return m_wearables[UNDERSHIRT].ItemID; } | 189 | get { return m_wearables[AvatarWearable.UNDERSHIRT].ItemID; } |
207 | set { m_wearables[UNDERSHIRT].ItemID = value; } | 190 | set { m_wearables[AvatarWearable.UNDERSHIRT].ItemID = value; } |
208 | } | 191 | } |
209 | 192 | ||
210 | public virtual UUID UnderShirtAsset { | 193 | public virtual UUID UnderShirtAsset { |
211 | get { return m_wearables[UNDERSHIRT].AssetID; } | 194 | get { return m_wearables[AvatarWearable.UNDERSHIRT].AssetID; } |
212 | set { m_wearables[UNDERSHIRT].AssetID = value; } | 195 | set { m_wearables[AvatarWearable.UNDERSHIRT].AssetID = value; } |
213 | } | 196 | } |
214 | 197 | ||
215 | public virtual UUID UnderPantsItem { | 198 | public virtual UUID UnderPantsItem { |
216 | get { return m_wearables[UNDERPANTS].ItemID; } | 199 | get { return m_wearables[AvatarWearable.UNDERPANTS].ItemID; } |
217 | set { m_wearables[UNDERPANTS].ItemID = value; } | 200 | set { m_wearables[AvatarWearable.UNDERPANTS].ItemID = value; } |
218 | } | 201 | } |
219 | 202 | ||
220 | public virtual UUID UnderPantsAsset { | 203 | public virtual UUID UnderPantsAsset { |
221 | get { return m_wearables[UNDERPANTS].AssetID; } | 204 | get { return m_wearables[AvatarWearable.UNDERPANTS].AssetID; } |
222 | set { m_wearables[UNDERPANTS].AssetID = value; } | 205 | set { m_wearables[AvatarWearable.UNDERPANTS].AssetID = value; } |
223 | } | 206 | } |
224 | 207 | ||
225 | public virtual UUID SkirtItem { | 208 | public virtual UUID SkirtItem { |
226 | get { return m_wearables[SKIRT].ItemID; } | 209 | get { return m_wearables[AvatarWearable.SKIRT].ItemID; } |
227 | set { m_wearables[SKIRT].ItemID = value; } | 210 | set { m_wearables[AvatarWearable.SKIRT].ItemID = value; } |
228 | } | 211 | } |
229 | 212 | ||
230 | public virtual UUID SkirtAsset { | 213 | public virtual UUID SkirtAsset { |
231 | get { return m_wearables[SKIRT].AssetID; } | 214 | get { return m_wearables[AvatarWearable.SKIRT].AssetID; } |
232 | set { m_wearables[SKIRT].AssetID = value; } | 215 | set { m_wearables[AvatarWearable.SKIRT].AssetID = value; } |
233 | } | ||
234 | |||
235 | public virtual void SetDefaultWearables() | ||
236 | { | ||
237 | m_wearables[BODY].AssetID = BODY_ASSET; | ||
238 | m_wearables[BODY].ItemID = BODY_ITEM; | ||
239 | m_wearables[SKIN].AssetID = SKIN_ASSET; | ||
240 | m_wearables[SKIN].ItemID = SKIN_ITEM; | ||
241 | m_wearables[HAIR].AssetID = HAIR_ASSET; | ||
242 | m_wearables[HAIR].ItemID = HAIR_ITEM; | ||
243 | m_wearables[SHIRT].AssetID = SHIRT_ASSET; | ||
244 | m_wearables[SHIRT].ItemID = SHIRT_ITEM; | ||
245 | m_wearables[PANTS].AssetID = PANTS_ASSET; | ||
246 | m_wearables[PANTS].ItemID = PANTS_ITEM; | ||
247 | } | ||
248 | |||
249 | public virtual void ClearWearables() | ||
250 | { | ||
251 | for (int i = 0; i < 13; i++) | ||
252 | { | ||
253 | m_wearables[i].AssetID = UUID.Zero; | ||
254 | m_wearables[i].ItemID = UUID.Zero; | ||
255 | } | ||
256 | } | ||
257 | |||
258 | public virtual void SetDefaultParams(byte[] vparams) | ||
259 | { | ||
260 | // TODO: Figure out better values then 'fat scientist 150' or 'alien 0' | ||
261 | for (int i = 0; i < VISUALPARAM_COUNT; i++) | ||
262 | { | ||
263 | vparams[i] = 150; | ||
264 | } | ||
265 | } | ||
266 | |||
267 | protected Primitive.TextureEntry m_texture; | ||
268 | |||
269 | public virtual Primitive.TextureEntry Texture | ||
270 | { | ||
271 | get { return m_texture; } | ||
272 | set { m_texture = value; } | ||
273 | } | 216 | } |
274 | 217 | ||
275 | protected float m_avatarHeight = 0; | ||
276 | protected float m_hipOffset = 0; | ||
277 | |||
278 | public virtual float AvatarHeight | 218 | public virtual float AvatarHeight |
279 | { | 219 | { |
280 | get { return m_avatarHeight; } | 220 | get { return m_avatarHeight; } |
@@ -286,366 +226,301 @@ namespace OpenSim.Framework | |||
286 | get { return m_hipOffset; } | 226 | get { return m_hipOffset; } |
287 | } | 227 | } |
288 | 228 | ||
289 | //Builds the VisualParam Enum using LIBOMV's Visual Param NameValues | ||
290 | /* | ||
291 | public void BuildVisualParamEnum() | ||
292 | { | ||
293 | Dictionary<string, int> IndexedParams = new Dictionary<string, int>(); | ||
294 | int vpIndex = 0; | ||
295 | IndexedParams = new Dictionary<string, int>(); | ||
296 | |||
297 | System.Text.StringBuilder sb = new System.Text.StringBuilder(); | ||
298 | |||
299 | sb.Append("public enum VPElement: int\n"); | ||
300 | sb.Append("{\n"); | ||
301 | foreach (KeyValuePair<int, VisualParam> kvp in OpenMetaverse.VisualParams.Params) | ||
302 | { | ||
303 | VisualParam vp = kvp.Value; | ||
304 | |||
305 | // Only Group-0 parameters are sent in AgentSetAppearance packets | ||
306 | if (kvp.Value.Group == 0) | ||
307 | { | ||
308 | |||
309 | if (!IndexedParams.ContainsKey(vp.Name)) | ||
310 | { | ||
311 | |||
312 | if (vp.Label.Length > 0 || vp.LabelMin.Length > 0 || vp.LabelMax.Length > 0) | ||
313 | { | ||
314 | |||
315 | sb.Append("/// <summary>\n"); | ||
316 | if (vp.LabelMin.Length > 0 && vp.LabelMax.Length > 0) | ||
317 | sb.Append(string.Format("/// {0} - {1} 0--+255 {2}\n", vp.Label, vp.LabelMin, | ||
318 | vp.LabelMax)); | ||
319 | |||
320 | else | ||
321 | sb.Append(string.Format("/// {0}\n", vp.Label)); | ||
322 | |||
323 | sb.Append("/// </summary>\n"); | ||
324 | } | ||
325 | sb.Append(string.Format(" {0}_{1} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"),vpIndex)); | ||
326 | |||
327 | IndexedParams.Add(vp.Name, vpIndex++); | ||
328 | } | ||
329 | else | ||
330 | { | ||
331 | sb.Append(string.Format(" {0}_{1}_{2} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"), vpIndex)); | ||
332 | vpIndex++; | ||
333 | //int i = 0; | ||
334 | } | ||
335 | } | ||
336 | if (vpIndex < 217) | ||
337 | sb.Append(",\n"); | ||
338 | else | ||
339 | sb.Append("\n"); | ||
340 | |||
341 | } | ||
342 | sb.Append("}\n"); | ||
343 | |||
344 | } | ||
345 | */ | ||
346 | |||
347 | public AvatarAppearance() : this(UUID.Zero) {} | 229 | public AvatarAppearance() : this(UUID.Zero) {} |
348 | 230 | ||
349 | public AvatarAppearance(UUID owner) | 231 | public AvatarAppearance(UUID owner) |
350 | { | 232 | { |
351 | m_wearables = new AvatarWearable[MAX_WEARABLES]; | 233 | // DEBUG ON |
352 | for (int i = 0; i < MAX_WEARABLES; i++) | 234 | m_log.WarnFormat("[AVATAR APPEARANCE] create empty appearance for {0}",owner); |
353 | { | 235 | // DEBUG OFF |
354 | // this makes them all null | 236 | m_serial = 1; |
355 | m_wearables[i] = new AvatarWearable(); | ||
356 | } | ||
357 | m_serial = 0; | ||
358 | m_owner = owner; | 237 | m_owner = owner; |
359 | //BuildVisualParamEnum() | 238 | |
360 | m_visualparams = new byte[VISUALPARAM_COUNT]; | ||
361 | // This sets Visual Params with *less* weirder values then default. Instead of a ugly alien, it looks like a fat scientist | ||
362 | SetDefaultParams(m_visualparams); | ||
363 | SetDefaultWearables(); | 239 | SetDefaultWearables(); |
364 | m_texture = GetDefaultTexture(); | 240 | SetDefaultTexture(); |
241 | SetDefaultParams(); | ||
242 | SetHeight(); | ||
243 | |||
244 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | ||
365 | } | 245 | } |
366 | 246 | ||
367 | public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, byte[] visualParams) | 247 | public AvatarAppearance(UUID avatarID, OSDMap map) |
368 | { | 248 | { |
249 | // DEBUG ON | ||
250 | m_log.WarnFormat("[AVATAR APPEARANCE] create appearance for {0} from OSDMap",avatarID); | ||
251 | // DEBUG OFF | ||
369 | m_owner = avatarID; | 252 | m_owner = avatarID; |
370 | m_serial = 1; | 253 | Unpack(map); |
371 | m_wearables = wearables; | 254 | SetHeight(); |
372 | m_visualparams = visualParams; | ||
373 | m_texture = GetDefaultTexture(); | ||
374 | } | 255 | } |
375 | 256 | ||
376 | /// <summary> | 257 | public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) |
377 | /// Set up appearance textures and avatar parameters, including a height calculation | ||
378 | /// </summary> | ||
379 | public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) | ||
380 | { | 258 | { |
259 | // DEBUG ON | ||
260 | m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); | ||
261 | // DEBUG OFF | ||
262 | m_serial = 1; | ||
263 | m_owner = avatarID; | ||
264 | |||
265 | if (wearables != null) | ||
266 | m_wearables = wearables; | ||
267 | else | ||
268 | SetDefaultWearables(); | ||
269 | |||
381 | if (textureEntry != null) | 270 | if (textureEntry != null) |
382 | m_texture = textureEntry; | 271 | m_texture = textureEntry; |
272 | else | ||
273 | SetDefaultTexture(); | ||
274 | |||
383 | if (visualParams != null) | 275 | if (visualParams != null) |
384 | m_visualparams = visualParams; | 276 | m_visualparams = visualParams; |
277 | else | ||
278 | SetDefaultParams(); | ||
385 | 279 | ||
386 | m_avatarHeight = 1.23077f // Shortest possible avatar height | 280 | SetHeight(); |
387 | + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height | ||
388 | + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size | ||
389 | + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length | ||
390 | + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height | ||
391 | + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height | ||
392 | + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length | ||
393 | m_hipOffset = (((1.23077f // Half of avatar | ||
394 | + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height | ||
395 | + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length | ||
396 | + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height | ||
397 | + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height | ||
398 | ) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f; | ||
399 | |||
400 | |||
401 | |||
402 | //System.Console.WriteLine(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}" + m_avatarHeight + " " + m_hipOffset); | ||
403 | //m_log.Debug("------------- Set Appearance Texture ---------------"); | ||
404 | //Primitive.TextureEntryFace[] faces = Texture.FaceTextures; | ||
405 | //foreach (Primitive.TextureEntryFace face in faces) | ||
406 | //{ | ||
407 | // if (face != null) | ||
408 | // m_log.Debug(" ++ " + face.TextureID); | ||
409 | // else | ||
410 | // m_log.Debug(" ++ NULL "); | ||
411 | //} | ||
412 | //m_log.Debug("----------------------------"); | ||
413 | |||
414 | } | ||
415 | |||
416 | public virtual void SetWearable(int wearableId, AvatarWearable wearable) | ||
417 | { | ||
418 | m_wearables[wearableId] = wearable; | ||
419 | } | ||
420 | 281 | ||
421 | public static Primitive.TextureEntry GetDefaultTexture() | 282 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
422 | { | ||
423 | Primitive.TextureEntry textu = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); | ||
424 | textu.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012"); | ||
425 | textu.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID; | ||
426 | textu.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID; | ||
427 | textu.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); | ||
428 | textu.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); | ||
429 | textu.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010"); | ||
430 | textu.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011"); | ||
431 | return textu; | ||
432 | } | 283 | } |
433 | 284 | ||
434 | public static byte[] GetDefaultVisualParams() | 285 | public AvatarAppearance(AvatarAppearance appearance) |
435 | { | 286 | { |
436 | byte[] visualParams; | 287 | // DEBUG ON |
437 | visualParams = new byte[VISUALPARAM_COUNT]; | 288 | m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); |
438 | for (int i = 0; i < VISUALPARAM_COUNT; i++) | 289 | // DEBUG OFF |
290 | if (appearance == null) | ||
439 | { | 291 | { |
440 | visualParams[i] = 100; | 292 | m_serial = 1; |
441 | } | 293 | m_owner = UUID.Zero; |
442 | return visualParams; | ||
443 | } | ||
444 | 294 | ||
445 | public override String ToString() | 295 | SetDefaultWearables(); |
446 | { | 296 | SetDefaultTexture(); |
447 | String s = "[Wearables] =>"; | 297 | SetDefaultParams(); |
448 | s += " Body Item: " + BodyItem.ToString() + ";"; | 298 | SetHeight(); |
449 | s += " Skin Item: " + SkinItem.ToString() + ";"; | ||
450 | s += " Shirt Item: " + ShirtItem.ToString() + ";"; | ||
451 | s += " Pants Item: " + PantsItem.ToString() + ";"; | ||
452 | return s; | ||
453 | } | ||
454 | 299 | ||
455 | // this is used for OGS1 | 300 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
456 | public virtual Hashtable ToHashTable() | ||
457 | { | ||
458 | Hashtable h = new Hashtable(); | ||
459 | h["owner"] = Owner.ToString(); | ||
460 | h["serial"] = Serial.ToString(); | ||
461 | h["visual_params"] = VisualParams; | ||
462 | h["texture"] = Texture.GetBytes(); | ||
463 | h["avatar_height"] = AvatarHeight.ToString(); | ||
464 | h["body_item"] = BodyItem.ToString(); | ||
465 | h["body_asset"] = BodyAsset.ToString(); | ||
466 | h["skin_item"] = SkinItem.ToString(); | ||
467 | h["skin_asset"] = SkinAsset.ToString(); | ||
468 | h["hair_item"] = HairItem.ToString(); | ||
469 | h["hair_asset"] = HairAsset.ToString(); | ||
470 | h["eyes_item"] = EyesItem.ToString(); | ||
471 | h["eyes_asset"] = EyesAsset.ToString(); | ||
472 | h["shirt_item"] = ShirtItem.ToString(); | ||
473 | h["shirt_asset"] = ShirtAsset.ToString(); | ||
474 | h["pants_item"] = PantsItem.ToString(); | ||
475 | h["pants_asset"] = PantsAsset.ToString(); | ||
476 | h["shoes_item"] = ShoesItem.ToString(); | ||
477 | h["shoes_asset"] = ShoesAsset.ToString(); | ||
478 | h["socks_item"] = SocksItem.ToString(); | ||
479 | h["socks_asset"] = SocksAsset.ToString(); | ||
480 | h["jacket_item"] = JacketItem.ToString(); | ||
481 | h["jacket_asset"] = JacketAsset.ToString(); | ||
482 | h["gloves_item"] = GlovesItem.ToString(); | ||
483 | h["gloves_asset"] = GlovesAsset.ToString(); | ||
484 | h["undershirt_item"] = UnderShirtItem.ToString(); | ||
485 | h["undershirt_asset"] = UnderShirtAsset.ToString(); | ||
486 | h["underpants_item"] = UnderPantsItem.ToString(); | ||
487 | h["underpants_asset"] = UnderPantsAsset.ToString(); | ||
488 | h["skirt_item"] = SkirtItem.ToString(); | ||
489 | h["skirt_asset"] = SkirtAsset.ToString(); | ||
490 | |||
491 | string attachments = GetAttachmentsString(); | ||
492 | if (attachments != String.Empty) | ||
493 | h["attachments"] = attachments; | ||
494 | |||
495 | return h; | ||
496 | } | ||
497 | |||
498 | public AvatarAppearance(Hashtable h) | ||
499 | { | ||
500 | Owner = new UUID((string)h["owner"]); | ||
501 | Serial = Convert.ToInt32((string)h["serial"]); | ||
502 | VisualParams = (byte[])h["visual_params"]; | ||
503 | 301 | ||
504 | if (h.Contains("texture")) | 302 | return; |
505 | { | ||
506 | byte[] te = h["texture"] as byte[]; | ||
507 | if (te != null && te.Length > 0) | ||
508 | Texture = new Primitive.TextureEntry(te, 0, te.Length); | ||
509 | } | ||
510 | else | ||
511 | { | ||
512 | // We shouldn't be receiving appearance hashtables without a TextureEntry, | ||
513 | // but in case we do this will prevent a failure when saving to the database | ||
514 | Texture = GetDefaultTexture(); | ||
515 | } | 303 | } |
516 | |||
517 | 304 | ||
518 | AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); | 305 | m_serial = appearance.Serial; |
306 | m_owner = appearance.Owner; | ||
519 | 307 | ||
520 | m_wearables = new AvatarWearable[MAX_WEARABLES]; | 308 | m_wearables = null; |
521 | for (int i = 0; i < MAX_WEARABLES; i++) | 309 | if (appearance.Wearables != null) |
522 | { | 310 | { |
523 | // this makes them all null | 311 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 13 of these |
524 | m_wearables[i] = new AvatarWearable(); | 312 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) |
313 | SetWearable(i,appearance.Wearables[i]); | ||
525 | } | 314 | } |
526 | 315 | ||
527 | BodyItem = new UUID((string)h["body_item"]); | 316 | m_texture = null; |
528 | BodyAsset = new UUID((string)h["body_asset"]); | 317 | if (appearance.Texture != null) |
529 | SkinItem = new UUID((string)h["skin_item"]); | ||
530 | SkinAsset = new UUID((string)h["skin_asset"]); | ||
531 | HairItem = new UUID((string)h["hair_item"]); | ||
532 | HairAsset = new UUID((string)h["hair_asset"]); | ||
533 | EyesItem = new UUID((string)h["eyes_item"]); | ||
534 | EyesAsset = new UUID((string)h["eyes_asset"]); | ||
535 | ShirtItem = new UUID((string)h["shirt_item"]); | ||
536 | ShirtAsset = new UUID((string)h["shirt_asset"]); | ||
537 | PantsItem = new UUID((string)h["pants_item"]); | ||
538 | PantsAsset = new UUID((string)h["pants_asset"]); | ||
539 | ShoesItem = new UUID((string)h["shoes_item"]); | ||
540 | ShoesAsset = new UUID((string)h["shoes_asset"]); | ||
541 | SocksItem = new UUID((string)h["socks_item"]); | ||
542 | SocksAsset = new UUID((string)h["socks_asset"]); | ||
543 | JacketItem = new UUID((string)h["jacket_item"]); | ||
544 | JacketAsset = new UUID((string)h["jacket_asset"]); | ||
545 | GlovesItem = new UUID((string)h["gloves_item"]); | ||
546 | GlovesAsset = new UUID((string)h["gloves_asset"]); | ||
547 | UnderShirtItem = new UUID((string)h["undershirt_item"]); | ||
548 | UnderShirtAsset = new UUID((string)h["undershirt_asset"]); | ||
549 | UnderPantsItem = new UUID((string)h["underpants_item"]); | ||
550 | UnderPantsAsset = new UUID((string)h["underpants_asset"]); | ||
551 | SkirtItem = new UUID((string)h["skirt_item"]); | ||
552 | SkirtAsset = new UUID((string)h["skirt_asset"]); | ||
553 | |||
554 | if (h.ContainsKey("attachments")) | ||
555 | { | 318 | { |
556 | SetAttachmentsString(h["attachments"].ToString()); | 319 | byte[] tbytes = appearance.Texture.GetBytes(); |
320 | m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length); | ||
557 | } | 321 | } |
322 | |||
323 | m_visualparams = null; | ||
324 | if (appearance.VisualParams != null) | ||
325 | m_visualparams = (byte[])appearance.VisualParams.Clone(); | ||
326 | |||
327 | // Copy the attachment, force append mode since that ensures consistency | ||
328 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | ||
329 | foreach (AvatarAttachment attachment in appearance.GetAttachments()) | ||
330 | AppendAttachment(new AvatarAttachment(attachment)); | ||
331 | } | ||
332 | |||
333 | protected virtual void SetDefaultWearables() | ||
334 | { | ||
335 | m_wearables = AvatarWearable.DefaultWearables; | ||
558 | } | 336 | } |
559 | 337 | ||
560 | private Dictionary<int, UUID[]> m_attachments = new Dictionary<int, UUID[]>(); | 338 | protected virtual void SetDefaultParams() |
561 | |||
562 | public void SetAttachments(AttachmentData[] data) | ||
563 | { | 339 | { |
564 | foreach (AttachmentData a in data) | 340 | m_visualparams = new byte[VISUALPARAM_COUNT]; |
341 | for (int i = 0; i < VISUALPARAM_COUNT; i++) | ||
565 | { | 342 | { |
566 | m_attachments[a.AttachPoint] = new UUID[2]; | 343 | m_visualparams[i] = 150; |
567 | m_attachments[a.AttachPoint][0] = a.ItemID; | ||
568 | m_attachments[a.AttachPoint][1] = a.AssetID; | ||
569 | } | 344 | } |
570 | } | 345 | } |
571 | 346 | ||
572 | public void SetAttachments(Hashtable data) | 347 | protected virtual void SetDefaultTexture() |
573 | { | 348 | { |
574 | m_attachments.Clear(); | 349 | m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); |
575 | 350 | // The initialization of these seems to force a rebake regardless of whether it is needed | |
576 | if (data == null) | 351 | // m_textures.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012"); |
577 | return; | 352 | // m_textures.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID; |
353 | // m_textures.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID; | ||
354 | // m_textures.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); | ||
355 | // m_textures.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); | ||
356 | // m_textures.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010"); | ||
357 | // m_textures.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011"); | ||
358 | } | ||
578 | 359 | ||
579 | foreach (DictionaryEntry e in data) | 360 | /// <summary> |
361 | /// Set up appearance textures. | ||
362 | /// Returns boolean that indicates whether the new entries actually change the | ||
363 | /// existing values. | ||
364 | /// </summary> | ||
365 | public virtual bool SetTextureEntries(Primitive.TextureEntry textureEntry) | ||
366 | { | ||
367 | if (textureEntry == null) | ||
368 | return false; | ||
369 | |||
370 | // There are much simpler versions of this copy that could be | ||
371 | // made. We determine if any of the textures actually | ||
372 | // changed to know if the appearance should be saved later | ||
373 | bool changed = false; | ||
374 | for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) | ||
580 | { | 375 | { |
581 | int attachpoint = Convert.ToInt32(e.Key); | 376 | Primitive.TextureEntryFace newface = textureEntry.FaceTextures[i]; |
582 | 377 | Primitive.TextureEntryFace oldface = m_texture.FaceTextures[i]; | |
583 | if (m_attachments.ContainsKey(attachpoint)) | 378 | |
584 | continue; | 379 | if (newface == null) |
380 | { | ||
381 | if (oldface == null) continue; | ||
382 | } | ||
383 | else | ||
384 | { | ||
385 | if (oldface != null && oldface.TextureID == newface.TextureID) continue; | ||
386 | } | ||
585 | 387 | ||
586 | UUID item; | 388 | m_texture.FaceTextures[i] = (newface != null) ? new Primitive.TextureEntryFace(newface) : null; |
587 | UUID asset; | 389 | changed = true; |
390 | // DEBUG ON | ||
391 | if (newface != null) | ||
392 | m_log.WarnFormat("[AVATAR APPEARANCE] index {0}, new texture id {1}",i,newface.TextureID); | ||
393 | // DEBUG OFF | ||
394 | } | ||
588 | 395 | ||
589 | Hashtable uuids = (Hashtable) e.Value; | 396 | return changed; |
590 | UUID.TryParse(uuids["item"].ToString(), out item); | 397 | } |
591 | UUID.TryParse(uuids["asset"].ToString(), out asset); | 398 | |
399 | /// <summary> | ||
400 | /// Set up visual parameters for the avatar and refresh the avatar height | ||
401 | /// Returns boolean that indicates whether the new entries actually change the | ||
402 | /// existing values. | ||
403 | /// </summary> | ||
404 | public virtual bool SetVisualParams(byte[] visualParams) | ||
405 | { | ||
406 | if (visualParams == null) | ||
407 | return false; | ||
408 | |||
409 | // There are much simpler versions of this copy that could be | ||
410 | // made. We determine if any of the visual parameters actually | ||
411 | // changed to know if the appearance should be saved later | ||
412 | bool changed = false; | ||
413 | for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++) | ||
414 | { | ||
415 | if (visualParams[i] != m_visualparams[i]) | ||
416 | { | ||
417 | // DEBUG ON | ||
418 | m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", | ||
419 | i,m_visualparams[i],visualParams[i]); | ||
420 | // DEBUG OFF | ||
421 | m_visualparams[i] = visualParams[i]; | ||
422 | changed = true; | ||
423 | } | ||
424 | } | ||
592 | 425 | ||
593 | UUID[] attachment = new UUID[2]; | 426 | // Reset the height if the visual parameters actually changed |
594 | attachment[0] = item; | 427 | if (changed) |
595 | attachment[1] = asset; | 428 | SetHeight(); |
596 | 429 | ||
597 | m_attachments[attachpoint] = attachment; | 430 | return changed; |
598 | } | ||
599 | } | 431 | } |
600 | 432 | ||
601 | public Dictionary<int, UUID[]> GetAttachmentDictionary() | 433 | public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) |
602 | { | 434 | { |
603 | return m_attachments; | 435 | SetTextureEntries(textureEntry); |
436 | SetVisualParams(visualParams); | ||
604 | } | 437 | } |
438 | |||
439 | public virtual void SetHeight() | ||
440 | { | ||
441 | m_avatarHeight = 1.23077f // Shortest possible avatar height | ||
442 | + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height | ||
443 | + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size | ||
444 | + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length | ||
445 | + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height | ||
446 | + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height | ||
447 | + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length | ||
605 | 448 | ||
606 | public Hashtable GetAttachments() | 449 | m_hipOffset = (((1.23077f // Half of avatar |
450 | + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height | ||
451 | + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length | ||
452 | + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height | ||
453 | + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height | ||
454 | ) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f; | ||
455 | } | ||
456 | |||
457 | public virtual void SetWearable(int wearableId, AvatarWearable wearable) | ||
607 | { | 458 | { |
608 | if (m_attachments.Count == 0) | 459 | // DEBUG ON |
609 | return null; | 460 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); |
461 | // DEBUG OFF | ||
462 | m_wearables[wearableId] = new AvatarWearable(wearable.ItemID,wearable.AssetID); | ||
463 | } | ||
610 | 464 | ||
611 | Hashtable ret = new Hashtable(); | ||
612 | 465 | ||
613 | foreach (KeyValuePair<int, UUID[]> kvp in m_attachments) | 466 | // DEBUG ON |
614 | { | 467 | public override String ToString() |
615 | int attachpoint = kvp.Key; | 468 | { |
616 | UUID[] uuids = kvp.Value; | 469 | String s = ""; |
617 | 470 | ||
618 | Hashtable data = new Hashtable(); | 471 | s += String.Format("Serial: {0}\n",m_serial); |
619 | data["item"] = uuids[0].ToString(); | 472 | |
620 | data["asset"] = uuids[1].ToString(); | 473 | for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) |
474 | if (m_texture.FaceTextures[i] != null) | ||
475 | s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID); | ||
621 | 476 | ||
622 | ret[attachpoint] = data; | 477 | foreach (AvatarWearable awear in m_wearables) |
623 | } | 478 | s += String.Format("Wearable: item={0}, asset={1}\n",awear.ItemID,awear.AssetID); |
624 | 479 | ||
625 | return ret; | 480 | s += "Visual Params: "; |
481 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) | ||
482 | s += String.Format("{0},",m_visualparams[j]); | ||
483 | s += "\n"; | ||
484 | |||
485 | return s; | ||
626 | } | 486 | } |
487 | // DEBUG OFF | ||
627 | 488 | ||
628 | public List<int> GetAttachedPoints() | 489 | /// <summary> |
490 | /// Get a list of the attachments, note that there may be | ||
491 | /// duplicate attachpoints | ||
492 | /// </summary> | ||
493 | public List<AvatarAttachment> GetAttachments() | ||
629 | { | 494 | { |
630 | return new List<int>(m_attachments.Keys); | 495 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); |
496 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | ||
497 | { | ||
498 | foreach (AvatarAttachment attach in kvp.Value) | ||
499 | alist.Add(new AvatarAttachment(attach)); | ||
500 | } | ||
501 | |||
502 | return alist; | ||
631 | } | 503 | } |
632 | 504 | ||
633 | public UUID GetAttachedItem(int attachpoint) | 505 | internal void AppendAttachment(AvatarAttachment attach) |
634 | { | 506 | { |
635 | if (!m_attachments.ContainsKey(attachpoint)) | 507 | if (! m_attachments.ContainsKey(attach.AttachPoint)) |
636 | return UUID.Zero; | 508 | m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); |
637 | 509 | m_attachments[attach.AttachPoint].Add(attach); | |
638 | return m_attachments[attachpoint][0]; | ||
639 | } | 510 | } |
640 | 511 | ||
641 | public UUID GetAttachedAsset(int attachpoint) | 512 | internal void ReplaceAttachment(AvatarAttachment attach) |
642 | { | 513 | { |
643 | if (!m_attachments.ContainsKey(attachpoint)) | 514 | m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); |
644 | return UUID.Zero; | 515 | m_attachments[attach.AttachPoint].Add(attach); |
645 | |||
646 | return m_attachments[attachpoint][1]; | ||
647 | } | 516 | } |
648 | 517 | ||
518 | /// <summary> | ||
519 | /// Add an attachment, if the attachpoint has the | ||
520 | /// 0x80 bit set then we assume this is an append | ||
521 | /// operation otherwise we replace whatever is | ||
522 | /// currently attached at the attachpoint | ||
523 | /// </summary> | ||
649 | public void SetAttachment(int attachpoint, UUID item, UUID asset) | 524 | public void SetAttachment(int attachpoint, UUID item, UUID asset) |
650 | { | 525 | { |
651 | if (attachpoint == 0) | 526 | if (attachpoint == 0) |
@@ -658,31 +533,47 @@ namespace OpenSim.Framework | |||
658 | return; | 533 | return; |
659 | } | 534 | } |
660 | 535 | ||
661 | if (!m_attachments.ContainsKey(attachpoint)) | 536 | // check if this is an append or a replace, 0x80 marks it as an append |
662 | m_attachments[attachpoint] = new UUID[2]; | 537 | if ((attachpoint & 0x80) > 0) |
663 | 538 | { | |
664 | m_attachments[attachpoint][0] = item; | 539 | // strip the append bit |
665 | m_attachments[attachpoint][1] = asset; | 540 | int point = attachpoint & 0x7F; |
541 | AppendAttachment(new AvatarAttachment(point, item, asset)); | ||
542 | } | ||
543 | else | ||
544 | { | ||
545 | ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); | ||
546 | } | ||
666 | } | 547 | } |
667 | 548 | ||
668 | public int GetAttachpoint(UUID itemID) | 549 | public int GetAttachpoint(UUID itemID) |
669 | { | 550 | { |
670 | foreach (KeyValuePair<int, UUID[]> kvp in m_attachments) | 551 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
671 | { | 552 | { |
672 | if (kvp.Value[0] == itemID) | 553 | int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); |
673 | { | 554 | if (index >= 0) |
674 | return kvp.Key; | 555 | return kvp.Key; |
675 | } | ||
676 | } | 556 | } |
557 | |||
677 | return 0; | 558 | return 0; |
678 | } | 559 | } |
679 | 560 | ||
680 | public void DetachAttachment(UUID itemID) | 561 | public void DetachAttachment(UUID itemID) |
681 | { | 562 | { |
682 | int attachpoint = GetAttachpoint(itemID); | 563 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
564 | { | ||
565 | int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); | ||
566 | if (index >= 0) | ||
567 | { | ||
568 | // Remove it from the list of attachments at that attach point | ||
569 | m_attachments[kvp.Key].RemoveAt(index); | ||
683 | 570 | ||
684 | if (attachpoint > 0) | 571 | // And remove the list if there are no more attachments here |
685 | m_attachments.Remove(attachpoint); | 572 | if (m_attachments[kvp.Key].Count == 0) |
573 | m_attachments.Remove(kvp.Key); | ||
574 | return; | ||
575 | } | ||
576 | } | ||
686 | } | 577 | } |
687 | 578 | ||
688 | public void ClearAttachments() | 579 | public void ClearAttachments() |
@@ -690,42 +581,123 @@ namespace OpenSim.Framework | |||
690 | m_attachments.Clear(); | 581 | m_attachments.Clear(); |
691 | } | 582 | } |
692 | 583 | ||
693 | string GetAttachmentsString() | 584 | /// <summary> |
585 | /// Create an OSDMap from the appearance data | ||
586 | /// </summary> | ||
587 | public OSDMap Pack() | ||
694 | { | 588 | { |
695 | List<string> strings = new List<string>(); | 589 | OSDMap data = new OSDMap(); |
696 | 590 | ||
697 | foreach (KeyValuePair<int, UUID[]> e in m_attachments) | 591 | data["serial"] = OSD.FromInteger(m_serial); |
592 | data["height"] = OSD.FromReal(m_avatarHeight); | ||
593 | data["hipoffset"] = OSD.FromReal(m_hipOffset); | ||
594 | |||
595 | // Wearables | ||
596 | OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); | ||
597 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | ||
598 | wears.Add(m_wearables[i].Pack()); | ||
599 | data["wearables"] = wears; | ||
600 | |||
601 | // Avatar Textures | ||
602 | OSDArray textures = new OSDArray(AvatarAppearance.TEXTURE_COUNT); | ||
603 | for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) | ||
698 | { | 604 | { |
699 | strings.Add(e.Key.ToString()); | 605 | if (m_texture.FaceTextures[i] != null) |
700 | strings.Add(e.Value[0].ToString()); | 606 | textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID)); |
701 | strings.Add(e.Value[1].ToString()); | 607 | else |
608 | textures.Add(OSD.FromUUID(UUID.Zero)); | ||
702 | } | 609 | } |
610 | data["textures"] = textures; | ||
703 | 611 | ||
704 | return String.Join(",", strings.ToArray()); | 612 | // Visual Parameters |
613 | OSDBinary visualparams = new OSDBinary(m_visualparams); | ||
614 | data["visualparams"] = visualparams; | ||
615 | |||
616 | // Attachments | ||
617 | OSDArray attachs = new OSDArray(m_attachments.Count); | ||
618 | foreach (AvatarAttachment attach in GetAttachments()) | ||
619 | attachs.Add(attach.Pack()); | ||
620 | data["attachments"] = attachs; | ||
621 | |||
622 | return data; | ||
705 | } | 623 | } |
706 | 624 | ||
707 | void SetAttachmentsString(string data) | 625 | /// <summary> |
626 | /// Unpack and OSDMap and initialize the appearance | ||
627 | /// from it | ||
628 | /// </summary> | ||
629 | public void Unpack(OSDMap data) | ||
708 | { | 630 | { |
709 | string[] strings = data.Split(new char[] {','}); | 631 | if ((data != null) && (data["serial"] != null)) |
710 | int i = 0; | 632 | m_serial = data["serial"].AsInteger(); |
633 | if ((data != null) && (data["height"] != null)) | ||
634 | m_avatarHeight = (float)data["height"].AsReal(); | ||
635 | if ((data != null) && (data["hipoffset"] != null)) | ||
636 | m_hipOffset = (float)data["hipoffset"].AsReal(); | ||
637 | |||
638 | try | ||
639 | { | ||
640 | // Wearables | ||
641 | SetDefaultWearables(); | ||
642 | if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) | ||
643 | { | ||
644 | OSDArray wears = (OSDArray)(data["wearables"]); | ||
645 | for (int i = 0; i < wears.Count; i++) | ||
646 | m_wearables[i] = new AvatarWearable((OSDMap)wears[i]); | ||
647 | } | ||
648 | else | ||
649 | { | ||
650 | m_log.Warn("[AVATARAPPEARANCE] failed to unpack wearables"); | ||
651 | } | ||
711 | 652 | ||
712 | m_attachments.Clear(); | 653 | // Avatar Textures |
654 | SetDefaultTexture(); | ||
655 | if ((data != null) && (data["textures"] != null) && (data["textures"]).Type == OSDType.Array) | ||
656 | { | ||
657 | OSDArray textures = (OSDArray)(data["textures"]); | ||
658 | for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++) | ||
659 | { | ||
660 | if (textures[i] != null) | ||
661 | { | ||
662 | UUID textureID = textures[i].AsUUID(); | ||
663 | if (textureID != UUID.Zero) | ||
664 | m_texture.CreateFace((uint)i).TextureID = textureID; | ||
665 | } | ||
666 | } | ||
667 | } | ||
668 | else | ||
669 | { | ||
670 | m_log.Warn("[AVATARAPPEARANCE] failed to unpack textures"); | ||
671 | } | ||
713 | 672 | ||
714 | while (strings.Length - i > 2) | 673 | // Visual Parameters |
715 | { | 674 | SetDefaultParams(); |
716 | int attachpoint = Int32.Parse(strings[i]); | 675 | if ((data != null) && (data["visualparams"] != null)) |
717 | UUID item = new UUID(strings[i+1]); | 676 | { |
718 | UUID asset = new UUID(strings[i+2]); | 677 | if ((data["visualparams"].Type == OSDType.Binary) || (data["visualparams"].Type == OSDType.Array)) |
719 | i += 3; | 678 | m_visualparams = data["visualparams"].AsBinary(); |
679 | } | ||
680 | else | ||
681 | { | ||
682 | m_log.Warn("[AVATARAPPEARANCE] failed to unpack visual parameters"); | ||
683 | } | ||
720 | 684 | ||
721 | if (!m_attachments.ContainsKey(attachpoint)) | 685 | // Attachments |
686 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | ||
687 | if ((data != null) && (data["attachments"] != null) && (data["attachments"]).Type == OSDType.Array) | ||
722 | { | 688 | { |
723 | m_attachments[attachpoint] = new UUID[2]; | 689 | OSDArray attachs = (OSDArray)(data["attachments"]); |
724 | m_attachments[attachpoint][0] = item; | 690 | for (int i = 0; i < attachs.Count; i++) |
725 | m_attachments[attachpoint][1] = asset; | 691 | AppendAttachment(new AvatarAttachment((OSDMap)attachs[i])); |
726 | } | 692 | } |
727 | } | 693 | } |
694 | catch (Exception e) | ||
695 | { | ||
696 | m_log.ErrorFormat("[AVATARAPPEARANCE] unpack failed badly: {0}",e.Message); | ||
697 | } | ||
728 | } | 698 | } |
699 | |||
700 | |||
729 | /// <summary> | 701 | /// <summary> |
730 | /// Viewer Params Array Element for AgentSetAppearance | 702 | /// Viewer Params Array Element for AgentSetAppearance |
731 | /// Generated from LibOMV's Visual Params list | 703 | /// Generated from LibOMV's Visual Params list |
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Framework/AvatarAttachment.cs index c967f30..c68d78d 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs +++ b/OpenSim/Framework/AvatarAttachment.cs | |||
@@ -25,14 +25,54 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using OpenMetaverse; | 29 | using OpenMetaverse; |
29 | using OpenSim.Framework; | 30 | using OpenMetaverse.StructuredData; |
30 | 31 | ||
31 | namespace OpenSim.Region.Framework.Interfaces | 32 | namespace OpenSim.Framework |
32 | { | 33 | { |
33 | public interface IAvatarFactory | 34 | public class AvatarAttachment |
34 | { | 35 | { |
35 | bool TryGetAvatarAppearance(UUID avatarId, out AvatarAppearance appearance); | 36 | public int AttachPoint; |
36 | void UpdateDatabase(UUID userID, AvatarAppearance avatAppearance); | 37 | public UUID ItemID; |
38 | public UUID AssetID; | ||
39 | |||
40 | public AvatarAttachment(AvatarAttachment attach) | ||
41 | { | ||
42 | AttachPoint = attach.AttachPoint; | ||
43 | ItemID = attach.ItemID; | ||
44 | AssetID = attach.AssetID; | ||
45 | } | ||
46 | |||
47 | public AvatarAttachment(int point, UUID item, UUID asset) | ||
48 | { | ||
49 | AttachPoint = point; | ||
50 | ItemID = item; | ||
51 | AssetID = asset; | ||
52 | } | ||
53 | |||
54 | public AvatarAttachment(OSDMap args) | ||
55 | { | ||
56 | Unpack(args); | ||
57 | } | ||
58 | |||
59 | public OSDMap Pack() | ||
60 | { | ||
61 | OSDMap attachdata = new OSDMap(); | ||
62 | attachdata["point"] = OSD.FromInteger(AttachPoint); | ||
63 | attachdata["item"] = OSD.FromUUID(ItemID); | ||
64 | attachdata["asset"] = OSD.FromUUID(AssetID); | ||
65 | |||
66 | return attachdata; | ||
67 | } | ||
68 | |||
69 | |||
70 | public void Unpack(OSDMap args) | ||
71 | { | ||
72 | if (args["point"] != null) | ||
73 | AttachPoint = args["point"].AsInteger(); | ||
74 | ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero; | ||
75 | AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero; | ||
76 | } | ||
37 | } | 77 | } |
38 | } | 78 | } |
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 30c5172..87098bf 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs | |||
@@ -26,14 +26,32 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Runtime.Serialization; | ||
30 | using System.Security.Permissions; | ||
31 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | using OpenMetaverse.StructuredData; | ||
32 | 31 | ||
33 | namespace OpenSim.Framework | 32 | namespace OpenSim.Framework |
34 | { | 33 | { |
35 | public class AvatarWearable | 34 | public class AvatarWearable |
36 | { | 35 | { |
36 | // these are guessed at by the list here - | ||
37 | // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll | ||
38 | // correct them over time for when were are wrong. | ||
39 | public static readonly int BODY = 0; | ||
40 | public static readonly int SKIN = 1; | ||
41 | public static readonly int HAIR = 2; | ||
42 | public static readonly int EYES = 3; | ||
43 | public static readonly int SHIRT = 4; | ||
44 | public static readonly int PANTS = 5; | ||
45 | public static readonly int SHOES = 6; | ||
46 | public static readonly int SOCKS = 7; | ||
47 | public static readonly int JACKET = 8; | ||
48 | public static readonly int GLOVES = 9; | ||
49 | public static readonly int UNDERSHIRT = 10; | ||
50 | public static readonly int UNDERPANTS = 11; | ||
51 | public static readonly int SKIRT = 12; | ||
52 | |||
53 | public static readonly int MAX_WEARABLES = 13; | ||
54 | |||
37 | public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); | 55 | public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); |
38 | public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 56 | public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); |
39 | 57 | ||
@@ -62,12 +80,32 @@ namespace OpenSim.Framework | |||
62 | ItemID = itemId; | 80 | ItemID = itemId; |
63 | } | 81 | } |
64 | 82 | ||
83 | public AvatarWearable(OSDMap args) | ||
84 | { | ||
85 | Unpack(args); | ||
86 | } | ||
87 | |||
88 | public OSDMap Pack() | ||
89 | { | ||
90 | OSDMap weardata = new OSDMap(); | ||
91 | weardata["item"] = OSD.FromUUID(ItemID); | ||
92 | weardata["asset"] = OSD.FromUUID(AssetID); | ||
93 | |||
94 | return weardata; | ||
95 | } | ||
96 | |||
97 | public void Unpack(OSDMap args) | ||
98 | { | ||
99 | ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero; | ||
100 | AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero; | ||
101 | } | ||
102 | |||
65 | public static AvatarWearable[] DefaultWearables | 103 | public static AvatarWearable[] DefaultWearables |
66 | { | 104 | { |
67 | get | 105 | get |
68 | { | 106 | { |
69 | AvatarWearable[] defaultWearables = new AvatarWearable[13]; //should be 13 of these | 107 | AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 13 of these |
70 | for (int i = 0; i < 13; i++) | 108 | for (int i = 0; i < MAX_WEARABLES; i++) |
71 | { | 109 | { |
72 | defaultWearables[i] = new AvatarWearable(); | 110 | defaultWearables[i] = new AvatarWearable(); |
73 | } | 111 | } |
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 72283de..872de9a 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using log4net; | 33 | using log4net; |
34 | using Nini.Config; | ||
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenSim.Framework.Servers; | 36 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework.Servers.HttpServer; | 37 | using OpenSim.Framework.Servers.HttpServer; |
@@ -112,6 +113,8 @@ namespace OpenSim.Framework.Capabilities | |||
112 | private string m_regionName; | 113 | private string m_regionName; |
113 | private object m_fetchLock = new Object(); | 114 | private object m_fetchLock = new Object(); |
114 | 115 | ||
116 | private bool m_persistBakedTextures = false; | ||
117 | |||
115 | public bool SSLCaps | 118 | public bool SSLCaps |
116 | { | 119 | { |
117 | get { return m_httpListener.UseSSL; } | 120 | get { return m_httpListener.UseSSL; } |
@@ -145,6 +148,15 @@ namespace OpenSim.Framework.Capabilities | |||
145 | 148 | ||
146 | m_httpListenPort = httpPort; | 149 | m_httpListenPort = httpPort; |
147 | 150 | ||
151 | m_persistBakedTextures = false; | ||
152 | IConfigSource config = m_Scene.Config; | ||
153 | if (config != null) | ||
154 | { | ||
155 | IConfig sconfig = config.Configs["Startup"]; | ||
156 | if (sconfig != null) | ||
157 | m_persistBakedTextures = sconfig.GetBoolean("PersistBakedTextures",m_persistBakedTextures); | ||
158 | } | ||
159 | |||
148 | if (httpServer != null && httpServer.UseSSL) | 160 | if (httpServer != null && httpServer.UseSSL) |
149 | { | 161 | { |
150 | m_httpListenPort = httpServer.SSLPort; | 162 | m_httpListenPort = httpServer.SSLPort; |
@@ -976,12 +988,14 @@ namespace OpenSim.Framework.Capabilities | |||
976 | 988 | ||
977 | public void BakedTextureUploaded(UUID assetID, byte[] data) | 989 | public void BakedTextureUploaded(UUID assetID, byte[] data) |
978 | { | 990 | { |
979 | m_log.DebugFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); | 991 | // DEBUG ON |
992 | m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); | ||
993 | // DEBUG OFF | ||
980 | AssetBase asset; | 994 | AssetBase asset; |
981 | asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString()); | 995 | asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString()); |
982 | asset.Data = data; | 996 | asset.Data = data; |
983 | asset.Temporary = true; | 997 | asset.Temporary = true; |
984 | asset.Local = true; | 998 | asset.Local = ! m_persistBakedTextures; // Local assets aren't persisted, non-local are |
985 | m_assetCache.Store(asset); | 999 | m_assetCache.Store(asset); |
986 | } | 1000 | } |
987 | 1001 | ||
diff --git a/OpenSim/Framework/Capabilities/CapsUtil.cs b/OpenSim/Framework/Capabilities/CapsUtil.cs index 0334e4b..faf2708 100644 --- a/OpenSim/Framework/Capabilities/CapsUtil.cs +++ b/OpenSim/Framework/Capabilities/CapsUtil.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Framework.Capabilities | |||
41 | /// <returns></returns> | 41 | /// <returns></returns> |
42 | public static string GetCapsSeedPath(string capsObjectPath) | 42 | public static string GetCapsSeedPath(string capsObjectPath) |
43 | { | 43 | { |
44 | return "/CAPS/" + capsObjectPath + "0000/"; | 44 | return "CAPS/" + capsObjectPath + "0000/"; |
45 | } | 45 | } |
46 | 46 | ||
47 | /// <summary> | 47 | /// <summary> |
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 0dc5dbc..66487f7 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -28,6 +28,8 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | ||
32 | using log4net; | ||
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | using OpenMetaverse.StructuredData; | 34 | using OpenMetaverse.StructuredData; |
33 | 35 | ||
@@ -225,46 +227,6 @@ namespace OpenSim.Framework | |||
225 | } | 227 | } |
226 | } | 228 | } |
227 | 229 | ||
228 | public class AttachmentData | ||
229 | { | ||
230 | public int AttachPoint; | ||
231 | public UUID ItemID; | ||
232 | public UUID AssetID; | ||
233 | |||
234 | public AttachmentData(int point, UUID item, UUID asset) | ||
235 | { | ||
236 | AttachPoint = point; | ||
237 | ItemID = item; | ||
238 | AssetID = asset; | ||
239 | } | ||
240 | |||
241 | public AttachmentData(OSDMap args) | ||
242 | { | ||
243 | UnpackUpdateMessage(args); | ||
244 | } | ||
245 | |||
246 | public OSDMap PackUpdateMessage() | ||
247 | { | ||
248 | OSDMap attachdata = new OSDMap(); | ||
249 | attachdata["point"] = OSD.FromInteger(AttachPoint); | ||
250 | attachdata["item"] = OSD.FromUUID(ItemID); | ||
251 | attachdata["asset"] = OSD.FromUUID(AssetID); | ||
252 | |||
253 | return attachdata; | ||
254 | } | ||
255 | |||
256 | |||
257 | public void UnpackUpdateMessage(OSDMap args) | ||
258 | { | ||
259 | if (args["point"] != null) | ||
260 | AttachPoint = args["point"].AsInteger(); | ||
261 | if (args["item"] != null) | ||
262 | ItemID = args["item"].AsUUID(); | ||
263 | if (args["asset"] != null) | ||
264 | AssetID = args["asset"].AsUUID(); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | public class ControllerData | 230 | public class ControllerData |
269 | { | 231 | { |
270 | public UUID ItemID; | 232 | public UUID ItemID; |
@@ -348,11 +310,20 @@ namespace OpenSim.Framework | |||
348 | public UUID GranterID; | 310 | public UUID GranterID; |
349 | 311 | ||
350 | // Appearance | 312 | // Appearance |
313 | public AvatarAppearance Appearance; | ||
314 | |||
315 | // DEBUG ON | ||
316 | private static readonly ILog m_log = | ||
317 | LogManager.GetLogger( | ||
318 | MethodBase.GetCurrentMethod().DeclaringType); | ||
319 | // DEBUG OFF | ||
320 | |||
321 | /* | ||
351 | public byte[] AgentTextures; | 322 | public byte[] AgentTextures; |
352 | public byte[] VisualParams; | 323 | public byte[] VisualParams; |
353 | public UUID[] Wearables; | 324 | public UUID[] Wearables; |
354 | public AttachmentData[] Attachments; | 325 | public AvatarAttachment[] Attachments; |
355 | 326 | */ | |
356 | // Scripted | 327 | // Scripted |
357 | public ControllerData[] Controllers; | 328 | public ControllerData[] Controllers; |
358 | 329 | ||
@@ -360,6 +331,10 @@ namespace OpenSim.Framework | |||
360 | 331 | ||
361 | public virtual OSDMap Pack() | 332 | public virtual OSDMap Pack() |
362 | { | 333 | { |
334 | // DEBUG ON | ||
335 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Pack data"); | ||
336 | // DEBUG OFF | ||
337 | |||
363 | OSDMap args = new OSDMap(); | 338 | OSDMap args = new OSDMap(); |
364 | args["message_type"] = OSD.FromString("AgentData"); | 339 | args["message_type"] = OSD.FromString("AgentData"); |
365 | 340 | ||
@@ -413,6 +388,9 @@ namespace OpenSim.Framework | |||
413 | args["animations"] = anims; | 388 | args["animations"] = anims; |
414 | } | 389 | } |
415 | 390 | ||
391 | if (Appearance != null) | ||
392 | args["packed_appearance"] = Appearance.Pack(); | ||
393 | |||
416 | //if ((AgentTextures != null) && (AgentTextures.Length > 0)) | 394 | //if ((AgentTextures != null) && (AgentTextures.Length > 0)) |
417 | //{ | 395 | //{ |
418 | // OSDArray textures = new OSDArray(AgentTextures.Length); | 396 | // OSDArray textures = new OSDArray(AgentTextures.Length); |
@@ -421,30 +399,39 @@ namespace OpenSim.Framework | |||
421 | // args["agent_textures"] = textures; | 399 | // args["agent_textures"] = textures; |
422 | //} | 400 | //} |
423 | 401 | ||
424 | 402 | // The code to pack textures, visuals, wearables and attachments | |
425 | if ((AgentTextures != null) && (AgentTextures.Length > 0)) | 403 | // should be removed; packed appearance contains the full appearance |
426 | args["texture_entry"] = OSD.FromBinary(AgentTextures); | 404 | // This is retained for backward compatibility only |
405 | if (Appearance.Texture != null) | ||
406 | { | ||
407 | byte[] rawtextures = Appearance.Texture.GetBytes(); | ||
408 | args["texture_entry"] = OSD.FromBinary(rawtextures); | ||
409 | } | ||
427 | 410 | ||
428 | if ((VisualParams != null) && (VisualParams.Length > 0)) | 411 | if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 0)) |
429 | args["visual_params"] = OSD.FromBinary(VisualParams); | 412 | args["visual_params"] = OSD.FromBinary(Appearance.VisualParams); |
430 | 413 | ||
431 | // We might not pass this in all cases... | 414 | // We might not pass this in all cases... |
432 | if ((Wearables != null) && (Wearables.Length > 0)) | 415 | if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) |
433 | { | 416 | { |
434 | OSDArray wears = new OSDArray(Wearables.Length); | 417 | OSDArray wears = new OSDArray(Appearance.Wearables.Length * 2); |
435 | foreach (UUID uuid in Wearables) | 418 | foreach (AvatarWearable awear in Appearance.Wearables) |
436 | wears.Add(OSD.FromUUID(uuid)); | 419 | { |
420 | wears.Add(OSD.FromUUID(awear.ItemID)); | ||
421 | wears.Add(OSD.FromUUID(awear.AssetID)); | ||
422 | } | ||
437 | args["wearables"] = wears; | 423 | args["wearables"] = wears; |
438 | } | 424 | } |
439 | 425 | ||
440 | 426 | List<AvatarAttachment> attachments = Appearance.GetAttachments(); | |
441 | if ((Attachments != null) && (Attachments.Length > 0)) | 427 | if ((attachments != null) && (attachments.Count > 0)) |
442 | { | 428 | { |
443 | OSDArray attachs = new OSDArray(Attachments.Length); | 429 | OSDArray attachs = new OSDArray(attachments.Count); |
444 | foreach (AttachmentData att in Attachments) | 430 | foreach (AvatarAttachment att in attachments) |
445 | attachs.Add(att.PackUpdateMessage()); | 431 | attachs.Add(att.Pack()); |
446 | args["attachments"] = attachs; | 432 | args["attachments"] = attachs; |
447 | } | 433 | } |
434 | // End of code to remove | ||
448 | 435 | ||
449 | if ((Controllers != null) && (Controllers.Length > 0)) | 436 | if ((Controllers != null) && (Controllers.Length > 0)) |
450 | { | 437 | { |
@@ -469,6 +456,10 @@ namespace OpenSim.Framework | |||
469 | /// <param name="hash"></param> | 456 | /// <param name="hash"></param> |
470 | public virtual void Unpack(OSDMap args) | 457 | public virtual void Unpack(OSDMap args) |
471 | { | 458 | { |
459 | // DEBUG ON | ||
460 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Unpack data"); | ||
461 | // DEBUG OFF | ||
462 | |||
472 | if (args.ContainsKey("region_id")) | 463 | if (args.ContainsKey("region_id")) |
473 | UUID.TryParse(args["region_id"].AsString(), out RegionID); | 464 | UUID.TryParse(args["region_id"].AsString(), out RegionID); |
474 | 465 | ||
@@ -581,34 +572,53 @@ namespace OpenSim.Framework | |||
581 | // AgentTextures[i++] = o.AsUUID(); | 572 | // AgentTextures[i++] = o.AsUUID(); |
582 | //} | 573 | //} |
583 | 574 | ||
575 | Appearance = new AvatarAppearance(AgentID); | ||
576 | |||
577 | // The code to unpack textures, visuals, wearables and attachments | ||
578 | // should be removed; packed appearance contains the full appearance | ||
579 | // This is retained for backward compatibility only | ||
584 | if (args["texture_entry"] != null) | 580 | if (args["texture_entry"] != null) |
585 | AgentTextures = args["texture_entry"].AsBinary(); | 581 | { |
582 | byte[] rawtextures = args["texture_entry"].AsBinary(); | ||
583 | Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length); | ||
584 | Appearance.SetTextureEntries(textures); | ||
585 | } | ||
586 | 586 | ||
587 | if (args["visual_params"] != null) | 587 | if (args["visual_params"] != null) |
588 | VisualParams = args["visual_params"].AsBinary(); | 588 | Appearance.SetVisualParams(args["visual_params"].AsBinary()); |
589 | 589 | ||
590 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) | 590 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) |
591 | { | 591 | { |
592 | OSDArray wears = (OSDArray)(args["wearables"]); | 592 | OSDArray wears = (OSDArray)(args["wearables"]); |
593 | Wearables = new UUID[wears.Count]; | 593 | for (int i = 0; i < wears.Count / 2; i++) |
594 | int i = 0; | 594 | { |
595 | foreach (OSD o in wears) | 595 | AvatarWearable awear = new AvatarWearable(wears[i*2].AsUUID(),wears[(i*2)+1].AsUUID()); |
596 | Wearables[i++] = o.AsUUID(); | 596 | Appearance.SetWearable(i,awear); |
597 | } | ||
597 | } | 598 | } |
598 | 599 | ||
599 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) | 600 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) |
600 | { | 601 | { |
601 | OSDArray attachs = (OSDArray)(args["attachments"]); | 602 | OSDArray attachs = (OSDArray)(args["attachments"]); |
602 | Attachments = new AttachmentData[attachs.Count]; | ||
603 | int i = 0; | ||
604 | foreach (OSD o in attachs) | 603 | foreach (OSD o in attachs) |
605 | { | 604 | { |
606 | if (o.Type == OSDType.Map) | 605 | if (o.Type == OSDType.Map) |
607 | { | 606 | { |
608 | Attachments[i++] = new AttachmentData((OSDMap)o); | 607 | // We know all of these must end up as attachments so we |
608 | // append rather than replace to ensure multiple attachments | ||
609 | // per point continues to work | ||
610 | Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); | ||
609 | } | 611 | } |
610 | } | 612 | } |
611 | } | 613 | } |
614 | // end of code to remove | ||
615 | |||
616 | if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) | ||
617 | Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]); | ||
618 | // DEBUG ON | ||
619 | else | ||
620 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); | ||
621 | // DEBUG OFF | ||
612 | 622 | ||
613 | if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) | 623 | if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) |
614 | { | 624 | { |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 94815cd..027f9c5 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Framework | |||
43 | 43 | ||
44 | public delegate void TextureRequest(Object sender, TextureRequestArgs e); | 44 | public delegate void TextureRequest(Object sender, TextureRequestArgs e); |
45 | 45 | ||
46 | public delegate void AvatarNowWearing(Object sender, AvatarWearingArgs e); | 46 | public delegate void AvatarNowWearing(IClientAPI sender, AvatarWearingArgs e); |
47 | 47 | ||
48 | public delegate void ImprovedInstantMessage(IClientAPI remoteclient, GridInstantMessage im); | 48 | public delegate void ImprovedInstantMessage(IClientAPI remoteclient, GridInstantMessage im); |
49 | 49 | ||
@@ -65,7 +65,7 @@ namespace OpenSim.Framework | |||
65 | 65 | ||
66 | public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes); | 66 | public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes); |
67 | 67 | ||
68 | public delegate void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams); | 68 | public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams); |
69 | 69 | ||
70 | public delegate void StartAnim(IClientAPI remoteClient, UUID animID); | 70 | public delegate void StartAnim(IClientAPI remoteClient, UUID animID); |
71 | 71 | ||
@@ -711,7 +711,7 @@ namespace OpenSim.Framework | |||
711 | event TeleportLandmarkRequest OnTeleportLandmarkRequest; | 711 | event TeleportLandmarkRequest OnTeleportLandmarkRequest; |
712 | event DeRezObject OnDeRezObject; | 712 | event DeRezObject OnDeRezObject; |
713 | event Action<IClientAPI> OnRegionHandShakeReply; | 713 | event Action<IClientAPI> OnRegionHandShakeReply; |
714 | event GenericCall2 OnRequestWearables; | 714 | event GenericCall1 OnRequestWearables; |
715 | event GenericCall1 OnCompleteMovementToRegion; | 715 | event GenericCall1 OnCompleteMovementToRegion; |
716 | event UpdateAgent OnPreAgentUpdate; | 716 | event UpdateAgent OnPreAgentUpdate; |
717 | event UpdateAgent OnAgentUpdate; | 717 | event UpdateAgent OnAgentUpdate; |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 08d5398..73b8bd0 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -115,8 +115,20 @@ namespace OpenSim.Framework | |||
115 | /// </summary> | 115 | /// </summary> |
116 | public string ServerURI | 116 | public string ServerURI |
117 | { | 117 | { |
118 | get { return m_serverURI; } | 118 | get { |
119 | set { m_serverURI = value; } | 119 | if ( m_serverURI != string.Empty ) { |
120 | return m_serverURI; | ||
121 | } else { | ||
122 | return "http://" + m_externalHostName + ":" + m_httpPort + "/"; | ||
123 | } | ||
124 | } | ||
125 | set { | ||
126 | if ( value.EndsWith("/") ) { | ||
127 | m_serverURI = value; | ||
128 | } else { | ||
129 | m_serverURI = value + '/'; | ||
130 | } | ||
131 | } | ||
120 | } | 132 | } |
121 | protected string m_serverURI; | 133 | protected string m_serverURI; |
122 | 134 | ||
@@ -141,6 +153,7 @@ namespace OpenSim.Framework | |||
141 | 153 | ||
142 | public SimpleRegionInfo() | 154 | public SimpleRegionInfo() |
143 | { | 155 | { |
156 | m_serverURI = string.Empty; | ||
144 | } | 157 | } |
145 | 158 | ||
146 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | 159 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) |
@@ -150,6 +163,7 @@ namespace OpenSim.Framework | |||
150 | 163 | ||
151 | m_internalEndPoint = internalEndPoint; | 164 | m_internalEndPoint = internalEndPoint; |
152 | m_externalHostName = externalUri; | 165 | m_externalHostName = externalUri; |
166 | m_serverURI = string.Empty; | ||
153 | } | 167 | } |
154 | 168 | ||
155 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) | 169 | public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port) |
@@ -160,6 +174,7 @@ namespace OpenSim.Framework | |||
160 | m_externalHostName = externalUri; | 174 | m_externalHostName = externalUri; |
161 | 175 | ||
162 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); | 176 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); |
177 | m_serverURI = string.Empty; | ||
163 | } | 178 | } |
164 | 179 | ||
165 | public SimpleRegionInfo(RegionInfo ConvertFrom) | 180 | public SimpleRegionInfo(RegionInfo ConvertFrom) |
@@ -449,6 +464,7 @@ namespace OpenSim.Framework | |||
449 | configMember = | 464 | configMember = |
450 | new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); | 465 | new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); |
451 | configMember.performConfigurationRetrieve(); | 466 | configMember.performConfigurationRetrieve(); |
467 | m_serverURI = string.Empty; | ||
452 | } | 468 | } |
453 | 469 | ||
454 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | 470 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) |
@@ -458,10 +474,12 @@ namespace OpenSim.Framework | |||
458 | 474 | ||
459 | m_internalEndPoint = internalEndPoint; | 475 | m_internalEndPoint = internalEndPoint; |
460 | m_externalHostName = externalUri; | 476 | m_externalHostName = externalUri; |
477 | m_serverURI = string.Empty; | ||
461 | } | 478 | } |
462 | 479 | ||
463 | public RegionInfo() | 480 | public RegionInfo() |
464 | { | 481 | { |
482 | m_serverURI = string.Empty; | ||
465 | } | 483 | } |
466 | 484 | ||
467 | public EstateSettings EstateSettings | 485 | public EstateSettings EstateSettings |
@@ -551,10 +569,23 @@ namespace OpenSim.Framework | |||
551 | /// <summary> | 569 | /// <summary> |
552 | /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) | 570 | /// A well-formed URI for the host region server (namely "http://" + ExternalHostName) |
553 | /// </summary> | 571 | /// </summary> |
572 | |||
554 | public string ServerURI | 573 | public string ServerURI |
555 | { | 574 | { |
556 | get { return m_serverURI; } | 575 | get { |
557 | set { m_serverURI = value; } | 576 | if ( m_serverURI != string.Empty ) { |
577 | return m_serverURI; | ||
578 | } else { | ||
579 | return "http://" + m_externalHostName + ":" + m_httpPort + "/"; | ||
580 | } | ||
581 | } | ||
582 | set { | ||
583 | if ( value.EndsWith("/") ) { | ||
584 | m_serverURI = value; | ||
585 | } else { | ||
586 | m_serverURI = value + '/'; | ||
587 | } | ||
588 | } | ||
558 | } | 589 | } |
559 | 590 | ||
560 | public string RegionName | 591 | public string RegionName |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ba8c194..0c1e5e0 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -348,7 +348,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
348 | { | 348 | { |
349 | try | 349 | try |
350 | { | 350 | { |
351 | // m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); | 351 | //m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); |
352 | 352 | ||
353 | Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); | 353 | Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); |
354 | 354 | ||
@@ -376,7 +376,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
376 | string path = request.RawUrl; | 376 | string path = request.RawUrl; |
377 | string handlerKey = GetHandlerKey(request.HttpMethod, path); | 377 | string handlerKey = GetHandlerKey(request.HttpMethod, path); |
378 | 378 | ||
379 | // m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); | 379 | //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); |
380 | 380 | ||
381 | if (TryGetStreamHandler(handlerKey, out requestHandler)) | 381 | if (TryGetStreamHandler(handlerKey, out requestHandler)) |
382 | { | 382 | { |
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs index 2fda6f3..05d8469 100644 --- a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs +++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs | |||
@@ -65,9 +65,7 @@ namespace OpenSim.Framework.Tests | |||
65 | SessionId = UUID.Random(); | 65 | SessionId = UUID.Random(); |
66 | 66 | ||
67 | AvAppearance = new AvatarAppearance(AgentId); | 67 | AvAppearance = new AvatarAppearance(AgentId); |
68 | AvAppearance.SetDefaultWearables(); | ||
69 | VisualParams = new byte[218]; | 68 | VisualParams = new byte[218]; |
70 | AvAppearance.SetDefaultParams(VisualParams); | ||
71 | 69 | ||
72 | //body | 70 | //body |
73 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEIGHT] = 155; | 71 | VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEIGHT] = 155; |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 74ad168..904a50c 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -327,8 +327,8 @@ namespace OpenSim | |||
327 | //regionInfo.originRegionID = regionInfo.RegionID; | 327 | //regionInfo.originRegionID = regionInfo.RegionID; |
328 | 328 | ||
329 | // set initial ServerURI | 329 | // set initial ServerURI |
330 | regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.InternalEndPoint.Port; | ||
331 | regionInfo.HttpPort = m_httpServerPort; | 330 | regionInfo.HttpPort = m_httpServerPort; |
331 | regionInfo.ServerURI = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort.ToString() + "/"; | ||
332 | 332 | ||
333 | regionInfo.osSecret = m_osSecret; | 333 | regionInfo.osSecret = m_osSecret; |
334 | 334 | ||
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 74ad485..14f923d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -79,7 +79,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
79 | public event DeRezObject OnDeRezObject; | 79 | public event DeRezObject OnDeRezObject; |
80 | public event ModifyTerrain OnModifyTerrain; | 80 | public event ModifyTerrain OnModifyTerrain; |
81 | public event Action<IClientAPI> OnRegionHandShakeReply; | 81 | public event Action<IClientAPI> OnRegionHandShakeReply; |
82 | public event GenericCall2 OnRequestWearables; | 82 | public event GenericCall1 OnRequestWearables; |
83 | public event SetAppearance OnSetAppearance; | 83 | public event SetAppearance OnSetAppearance; |
84 | public event AvatarNowWearing OnAvatarNowWearing; | 84 | public event AvatarNowWearing OnAvatarNowWearing; |
85 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | 85 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; |
@@ -5647,11 +5647,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5647 | 5647 | ||
5648 | private bool HandlerAgentWearablesRequest(IClientAPI sender, Packet Pack) | 5648 | private bool HandlerAgentWearablesRequest(IClientAPI sender, Packet Pack) |
5649 | { | 5649 | { |
5650 | GenericCall2 handlerRequestWearables = OnRequestWearables; | 5650 | GenericCall1 handlerRequestWearables = OnRequestWearables; |
5651 | 5651 | ||
5652 | if (handlerRequestWearables != null) | 5652 | if (handlerRequestWearables != null) |
5653 | { | 5653 | { |
5654 | handlerRequestWearables(); | 5654 | handlerRequestWearables(sender); |
5655 | } | 5655 | } |
5656 | 5656 | ||
5657 | Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData; | 5657 | Action<IClientAPI> handlerRequestAvatarsData = OnRequestAvatarsData; |
@@ -5694,7 +5694,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5694 | if (appear.ObjectData.TextureEntry.Length > 1) | 5694 | if (appear.ObjectData.TextureEntry.Length > 1) |
5695 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); | 5695 | te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); |
5696 | 5696 | ||
5697 | handlerSetAppearance(te, visualparams); | 5697 | handlerSetAppearance(sender, te, visualparams); |
5698 | } | 5698 | } |
5699 | catch (Exception e) | 5699 | catch (Exception e) |
5700 | { | 5700 | { |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index cb298fd..624814a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -631,7 +631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
631 | IClientAPI client; | 631 | IClientAPI client; |
632 | if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) | 632 | if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) |
633 | { | 633 | { |
634 | //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); | 634 | m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); |
635 | return; | 635 | return; |
636 | } | 636 | } |
637 | 637 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2a0c0b1..ad6b1de 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -124,13 +124,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
124 | 124 | ||
125 | // Save avatar attachment information | 125 | // Save avatar attachment information |
126 | ScenePresence presence; | 126 | ScenePresence presence; |
127 | if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 127 | if (m_scene.AvatarService != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
128 | { | 128 | { |
129 | m_log.Info( | 129 | m_log.Info( |
130 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId | 130 | "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId |
131 | + ", AttachmentPoint: " + AttachmentPt); | 131 | + ", AttachmentPoint: " + AttachmentPt); |
132 | 132 | ||
133 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 133 | m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
@@ -382,8 +382,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
382 | item = m_scene.InventoryService.GetItem(item); | 382 | item = m_scene.InventoryService.GetItem(item); |
383 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | 383 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); |
384 | 384 | ||
385 | if (m_scene.AvatarFactory != null) | 385 | if (m_scene.AvatarService != null) |
386 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 386 | m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance); |
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
@@ -405,10 +405,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
405 | presence.Appearance.DetachAttachment(itemID); | 405 | presence.Appearance.DetachAttachment(itemID); |
406 | 406 | ||
407 | // Save avatar attachment information | 407 | // Save avatar attachment information |
408 | if (m_scene.AvatarFactory != null) | 408 | if (m_scene.AvatarService != null) |
409 | { | 409 | { |
410 | m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); | 410 | m_log.Debug("[ATTACHMENTS MODULE]: Detaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); |
411 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 411 | m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance); |
412 | } | 412 | } |
413 | } | 413 | } |
414 | 414 | ||
@@ -435,9 +435,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
435 | 435 | ||
436 | presence.Appearance.DetachAttachment(itemID); | 436 | presence.Appearance.DetachAttachment(itemID); |
437 | 437 | ||
438 | if (m_scene.AvatarFactory != null) | 438 | if (m_scene.AvatarService != null) |
439 | { | 439 | { |
440 | m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 440 | m_scene.AvatarService.SetAppearance(remoteClient.AgentId, presence.Appearance); |
441 | } | 441 | } |
442 | part.ParentGroup.DetachToGround(); | 442 | part.ParentGroup.DetachToGround(); |
443 | 443 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 22c8937..5f8b4f6 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -32,58 +32,56 @@ using Nini.Config; | |||
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | 34 | ||
35 | using System.Threading; | ||
36 | using System.Timers; | ||
37 | using System.Collections.Generic; | ||
38 | |||
35 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
38 | 42 | ||
39 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | 43 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory |
40 | { | 44 | { |
41 | public class AvatarFactoryModule : IAvatarFactory, IRegionModule | 45 | public class AvatarFactoryModule : IRegionModule |
42 | { | 46 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; | ||
44 | private Scene m_scene = null; | 49 | private Scene m_scene = null; |
45 | private static readonly AvatarAppearance def = new AvatarAppearance(); | ||
46 | 50 | ||
47 | public bool TryGetAvatarAppearance(UUID avatarId, out AvatarAppearance appearance) | 51 | private int m_savetime = 5; // seconds to wait before saving changed appearance |
48 | { | 52 | private int m_sendtime = 2; // seconds to wait before sending changed appearance |
49 | AvatarData avatar = m_scene.AvatarService.GetAvatar(avatarId); | ||
50 | //if ((profile != null) && (profile.RootFolder != null)) | ||
51 | if (avatar != null) | ||
52 | { | ||
53 | appearance = avatar.ToAvatarAppearance(avatarId); | ||
54 | return true; | ||
55 | } | ||
56 | 53 | ||
57 | m_log.ErrorFormat("[APPEARANCE]: Appearance not found for {0}, creating default", avatarId); | 54 | private int m_checkTime = 500; // milliseconds to wait between checks for appearance updates |
58 | appearance = CreateDefault(avatarId); | 55 | private System.Timers.Timer m_updateTimer = new System.Timers.Timer(); |
59 | return false; | 56 | private Dictionary<UUID,long> m_savequeue = new Dictionary<UUID,long>(); |
60 | } | 57 | private Dictionary<UUID,long> m_sendqueue = new Dictionary<UUID,long>(); |
61 | 58 | ||
62 | private AvatarAppearance CreateDefault(UUID avatarId) | 59 | #region RegionModule Members |
63 | { | ||
64 | AvatarAppearance appearance = null; | ||
65 | AvatarWearable[] wearables; | ||
66 | byte[] visualParams; | ||
67 | GetDefaultAvatarAppearance(out wearables, out visualParams); | ||
68 | appearance = new AvatarAppearance(avatarId, wearables, visualParams); | ||
69 | |||
70 | return appearance; | ||
71 | } | ||
72 | 60 | ||
73 | public void Initialise(Scene scene, IConfigSource source) | 61 | public void Initialise(Scene scene, IConfigSource config) |
74 | { | 62 | { |
75 | scene.RegisterModuleInterface<IAvatarFactory>(this); | ||
76 | scene.EventManager.OnNewClient += NewClient; | 63 | scene.EventManager.OnNewClient += NewClient; |
77 | 64 | ||
78 | if (m_scene == null) | 65 | if (config != null) |
79 | { | 66 | { |
80 | m_scene = scene; | 67 | IConfig sconfig = config.Configs["Startup"]; |
68 | if (sconfig != null) | ||
69 | { | ||
70 | m_savetime = Convert.ToInt32(sconfig.GetString("DelayBeforeAppearanceSave",Convert.ToString(m_savetime))); | ||
71 | m_sendtime = Convert.ToInt32(sconfig.GetString("DelayBeforeAppearanceSend",Convert.ToString(m_sendtime))); | ||
72 | } | ||
81 | } | 73 | } |
82 | 74 | ||
75 | if (m_scene == null) | ||
76 | m_scene = scene; | ||
83 | } | 77 | } |
84 | 78 | ||
85 | public void PostInitialise() | 79 | public void PostInitialise() |
86 | { | 80 | { |
81 | m_updateTimer.Enabled = false; | ||
82 | m_updateTimer.AutoReset = true; | ||
83 | m_updateTimer.Interval = m_checkTime; // 500 milliseconds wait to start async ops | ||
84 | m_updateTimer.Elapsed += new ElapsedEventHandler(HandleAppearanceUpdateTimer); | ||
87 | } | 85 | } |
88 | 86 | ||
89 | public void Close() | 87 | public void Close() |
@@ -102,6 +100,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
102 | 100 | ||
103 | public void NewClient(IClientAPI client) | 101 | public void NewClient(IClientAPI client) |
104 | { | 102 | { |
103 | client.OnRequestWearables += SendWearables; | ||
104 | client.OnSetAppearance += SetAppearance; | ||
105 | client.OnAvatarNowWearing += AvatarIsWearing; | 105 | client.OnAvatarNowWearing += AvatarIsWearing; |
106 | } | 106 | } |
107 | 107 | ||
@@ -110,42 +110,211 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
110 | // client.OnAvatarNowWearing -= AvatarIsWearing; | 110 | // client.OnAvatarNowWearing -= AvatarIsWearing; |
111 | } | 111 | } |
112 | 112 | ||
113 | public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) | 113 | #endregion |
114 | |||
115 | /// <summary> | ||
116 | /// Set appearance data (textureentry and slider settings) received from the client | ||
117 | /// </summary> | ||
118 | /// <param name="texture"></param> | ||
119 | /// <param name="visualParam"></param> | ||
120 | public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) | ||
114 | { | 121 | { |
115 | IInventoryService invService = m_scene.InventoryService; | 122 | // DEBUG ON |
123 | m_log.WarnFormat("[AVFACTORY] SetAppearance for {0}",client.AgentId); | ||
124 | // DEBUG OFF | ||
116 | 125 | ||
117 | if (invService.GetRootFolder(userID) != null) | 126 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); |
127 | if (sp == null) | ||
118 | { | 128 | { |
119 | for (int i = 0; i < 13; i++) | 129 | m_log.WarnFormat("[AVFACTORY] SetAppearance unable to find presence for {0}",client.AgentId); |
130 | return; | ||
131 | } | ||
132 | |||
133 | bool changed = false; | ||
134 | |||
135 | // Process the texture entry | ||
136 | if (textureEntry != null) | ||
137 | { | ||
138 | changed = sp.Appearance.SetTextureEntries(textureEntry); | ||
139 | |||
140 | for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
120 | { | 141 | { |
121 | if (appearance.Wearables[i].ItemID == UUID.Zero) | 142 | int idx = BAKE_INDICES[i]; |
143 | Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; | ||
144 | if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) | ||
145 | Util.FireAndForget(delegate(object o) { CheckBakedTextureAssets(client,face.TextureID,idx); }); | ||
146 | } | ||
147 | } | ||
148 | |||
149 | // Process the visual params, this may change height as well | ||
150 | if (visualParams != null) | ||
151 | { | ||
152 | if (sp.Appearance.SetVisualParams(visualParams)) | ||
153 | { | ||
154 | changed = true; | ||
155 | if (sp.Appearance.AvatarHeight > 0) | ||
156 | sp.SetHeight(sp.Appearance.AvatarHeight); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | // If something changed in the appearance then queue an appearance save | ||
161 | if (changed) | ||
162 | QueueAppearanceSave(client.AgentId); | ||
163 | |||
164 | // And always queue up an appearance update to send out | ||
165 | QueueAppearanceSend(client.AgentId); | ||
166 | |||
167 | // Send the appearance back to the avatar | ||
168 | AvatarAppearance avp = sp.Appearance; | ||
169 | sp.ControllingClient.SendAvatarDataImmediate(sp); | ||
170 | sp.ControllingClient.SendAppearance(avp.Owner,avp.VisualParams,avp.Texture.GetBytes()); | ||
171 | } | ||
172 | |||
173 | /// <summary> | ||
174 | /// Checks for the existance of a baked texture asset and | ||
175 | /// requests the viewer rebake if the asset is not found | ||
176 | /// </summary> | ||
177 | /// <param name="client"></param> | ||
178 | /// <param name="textureID"></param> | ||
179 | /// <param name="idx"></param> | ||
180 | private void CheckBakedTextureAssets(IClientAPI client, UUID textureID, int idx) | ||
181 | { | ||
182 | if (m_scene.AssetService.Get(textureID.ToString()) == null) | ||
183 | { | ||
184 | m_log.WarnFormat("[AVFACTORY]: Missing baked texture {0} ({1}) for avatar {2}", | ||
185 | textureID,idx,client.Name); | ||
186 | client.SendRebakeAvatarTextures(textureID); | ||
187 | } | ||
188 | } | ||
189 | |||
190 | #region UpdateAppearanceTimer | ||
191 | |||
192 | public void QueueAppearanceSend(UUID agentid) | ||
193 | { | ||
194 | // DEBUG ON | ||
195 | m_log.WarnFormat("[AVFACTORY] Queue appearance send for {0}",agentid); | ||
196 | // DEBUG OFF | ||
197 | |||
198 | // 100 nanoseconds (ticks) we should wait | ||
199 | long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 10000000); | ||
200 | lock (m_sendqueue) | ||
201 | { | ||
202 | m_sendqueue[agentid] = timestamp; | ||
203 | m_updateTimer.Start(); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | public void QueueAppearanceSave(UUID agentid) | ||
208 | { | ||
209 | // DEBUG ON | ||
210 | m_log.WarnFormat("[AVFACTORY] Queue appearance save for {0}",agentid); | ||
211 | // DEBUG OFF | ||
212 | |||
213 | // 100 nanoseconds (ticks) we should wait | ||
214 | long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_savetime * 10000000); | ||
215 | lock (m_savequeue) | ||
216 | { | ||
217 | m_savequeue[agentid] = timestamp; | ||
218 | m_updateTimer.Start(); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | private void HandleAppearanceSend(UUID agentid) | ||
223 | { | ||
224 | ScenePresence sp = m_scene.GetScenePresence(agentid); | ||
225 | if (sp == null) | ||
226 | { | ||
227 | m_log.WarnFormat("[AVFACTORY] Agent {0} no longer in the scene",agentid); | ||
228 | return; | ||
229 | } | ||
230 | |||
231 | // DEBUG ON | ||
232 | m_log.WarnFormat("[AVFACTORY] Handle appearance send for {0}\n{1}",agentid,sp.Appearance.ToString()); | ||
233 | // DEBUG OFF | ||
234 | |||
235 | // Send the appearance to everyone in the scene | ||
236 | sp.SendAppearanceToAllOtherAgents(); | ||
237 | |||
238 | // Send the appearance back to the avatar | ||
239 | AvatarAppearance avp = sp.Appearance; | ||
240 | sp.ControllingClient.SendAvatarDataImmediate(sp); | ||
241 | sp.ControllingClient.SendAppearance(avp.Owner,avp.VisualParams,avp.Texture.GetBytes()); | ||
242 | |||
243 | /* | ||
244 | // this needs to be fixed, the flag should be on scene presence not the region module | ||
245 | // Start the animations if necessary | ||
246 | if (!m_startAnimationSet) | ||
247 | { | ||
248 | sp.Animator.UpdateMovementAnimations(); | ||
249 | m_startAnimationSet = true; | ||
250 | } | ||
251 | */ | ||
252 | } | ||
253 | |||
254 | private void HandleAppearanceSave(UUID agentid) | ||
255 | { | ||
256 | ScenePresence sp = m_scene.GetScenePresence(agentid); | ||
257 | if (sp == null) | ||
258 | { | ||
259 | m_log.WarnFormat("[AVFACTORY] Agent {0} no longer in the scene",agentid); | ||
260 | return; | ||
261 | } | ||
262 | |||
263 | m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); | ||
264 | } | ||
265 | |||
266 | private void HandleAppearanceUpdateTimer(object sender, EventArgs ea) | ||
267 | { | ||
268 | long now = DateTime.Now.Ticks; | ||
269 | |||
270 | lock (m_sendqueue) | ||
271 | { | ||
272 | Dictionary<UUID,long> sends = new Dictionary<UUID,long>(m_sendqueue); | ||
273 | foreach (KeyValuePair<UUID,long> kvp in sends) | ||
274 | { | ||
275 | if (kvp.Value < now) | ||
122 | { | 276 | { |
123 | appearance.Wearables[i].AssetID = UUID.Zero; | 277 | Util.FireAndForget(delegate(object o) { HandleAppearanceSend(kvp.Key); }); |
278 | m_sendqueue.Remove(kvp.Key); | ||
124 | } | 279 | } |
125 | else | 280 | } |
126 | { | 281 | } |
127 | InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID); | ||
128 | baseItem = invService.GetItem(baseItem); | ||
129 | 282 | ||
130 | if (baseItem != null) | 283 | lock (m_savequeue) |
131 | { | 284 | { |
132 | appearance.Wearables[i].AssetID = baseItem.AssetID; | 285 | Dictionary<UUID,long> saves = new Dictionary<UUID,long>(m_savequeue); |
133 | } | 286 | foreach (KeyValuePair<UUID,long> kvp in saves) |
134 | else | 287 | { |
135 | { | 288 | if (kvp.Value < now) |
136 | m_log.ErrorFormat( | 289 | { |
137 | "[APPEARANCE]: Can't find inventory item {0} for {1}, setting to default", | 290 | Util.FireAndForget(delegate(object o) { HandleAppearanceSave(kvp.Key); }); |
138 | appearance.Wearables[i].ItemID, (WearableType)i); | 291 | m_savequeue.Remove(kvp.Key); |
139 | |||
140 | appearance.Wearables[i].AssetID = def.Wearables[i].AssetID; | ||
141 | } | ||
142 | } | 292 | } |
143 | } | 293 | } |
144 | } | 294 | } |
145 | else | 295 | |
296 | if (m_savequeue.Count == 0 && m_sendqueue.Count == 0) | ||
297 | m_updateTimer.Stop(); | ||
298 | } | ||
299 | |||
300 | #endregion | ||
301 | |||
302 | /// <summary> | ||
303 | /// Tell the client for this scene presence what items it should be wearing now | ||
304 | /// </summary> | ||
305 | public void SendWearables(IClientAPI client) | ||
306 | { | ||
307 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); | ||
308 | if (sp == null) | ||
146 | { | 309 | { |
147 | m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID); | 310 | m_log.WarnFormat("[AVFACTORY] SendWearables unable to find presence for {0}",client.AgentId); |
311 | return; | ||
148 | } | 312 | } |
313 | |||
314 | // DEBUG ON | ||
315 | m_log.WarnFormat("[AVFACTORY]: Received request for wearables of {0}", client.AgentId); | ||
316 | // DEBUG OFF | ||
317 | client.SendWearables(sp.Appearance.Wearables,sp.Appearance.Serial++); | ||
149 | } | 318 | } |
150 | 319 | ||
151 | /// <summary> | 320 | /// <summary> |
@@ -153,65 +322,81 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
153 | /// </summary> | 322 | /// </summary> |
154 | /// <param name="sender"></param> | 323 | /// <param name="sender"></param> |
155 | /// <param name="e"></param> | 324 | /// <param name="e"></param> |
156 | public void AvatarIsWearing(Object sender, AvatarWearingArgs e) | 325 | public void AvatarIsWearing(IClientAPI client, AvatarWearingArgs e) |
157 | { | 326 | { |
158 | m_log.DebugFormat("[APPEARANCE]: AvatarIsWearing"); | 327 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); |
159 | 328 | if (sp == null) | |
160 | IClientAPI clientView = (IClientAPI)sender; | ||
161 | ScenePresence sp = m_scene.GetScenePresence(clientView.AgentId); | ||
162 | |||
163 | if (sp == null) | ||
164 | { | 329 | { |
165 | m_log.Error("[APPEARANCE]: Avatar is child agent, ignoring AvatarIsWearing event"); | 330 | m_log.WarnFormat("[AVFACTORY] AvatarIsWearing unable to find presence for {0}",client.AgentId); |
166 | return; | 331 | return; |
167 | } | 332 | } |
333 | |||
334 | // DEBUG ON | ||
335 | m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}",client.AgentId); | ||
336 | // DEBUG OFF | ||
337 | |||
338 | AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance); | ||
168 | 339 | ||
169 | AvatarAppearance avatAppearance = sp.Appearance; | 340 | //if (!TryGetAvatarAppearance(client.AgentId, out avatAppearance)) |
170 | //if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) | ||
171 | //{ | 341 | //{ |
172 | // m_log.Warn("[APPEARANCE]: We didn't seem to find the appearance, falling back to ScenePresence"); | 342 | // m_log.Warn("[AVFACTORY]: We didn't seem to find the appearance, falling back to ScenePresence"); |
173 | // avatAppearance = sp.Appearance; | 343 | // avatAppearance = sp.Appearance; |
174 | //} | 344 | //} |
175 | 345 | ||
176 | //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); | 346 | //m_log.DebugFormat("[AVFACTORY]: Received wearables for {0}", client.Name); |
177 | 347 | ||
178 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) | 348 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) |
179 | { | 349 | { |
180 | if (wear.Type < 13) | 350 | if (wear.Type < AvatarWearable.MAX_WEARABLES) |
181 | { | 351 | { |
182 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; | 352 | AvatarWearable newWearable = new AvatarWearable(wear.ItemID,UUID.Zero); |
353 | avatAppearance.SetWearable(wear.Type, newWearable); | ||
183 | } | 354 | } |
184 | } | 355 | } |
185 | 356 | ||
186 | SetAppearanceAssets(sp.UUID, ref avatAppearance); | 357 | SetAppearanceAssets(sp.UUID, ref avatAppearance); |
187 | AvatarData adata = new AvatarData(avatAppearance); | ||
188 | m_scene.AvatarService.SetAvatar(clientView.AgentId, adata); | ||
189 | 358 | ||
359 | m_scene.AvatarService.SetAppearance(client.AgentId, avatAppearance); | ||
190 | sp.Appearance = avatAppearance; | 360 | sp.Appearance = avatAppearance; |
191 | } | 361 | } |
192 | 362 | ||
193 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) | 363 | private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) |
194 | { | 364 | { |
195 | visualParams = GetDefaultVisualParams(); | 365 | IInventoryService invService = m_scene.InventoryService; |
196 | wearables = AvatarWearable.DefaultWearables; | ||
197 | } | ||
198 | 366 | ||
199 | public void UpdateDatabase(UUID user, AvatarAppearance appearance) | 367 | if (invService.GetRootFolder(userID) != null) |
200 | { | 368 | { |
201 | //m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); | 369 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) |
202 | AvatarData adata = new AvatarData(appearance); | 370 | { |
203 | m_scene.AvatarService.SetAvatar(user, adata); | 371 | if (appearance.Wearables[i].ItemID == UUID.Zero) |
204 | } | 372 | { |
373 | appearance.Wearables[i].AssetID = UUID.Zero; | ||
374 | } | ||
375 | else | ||
376 | { | ||
377 | InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID); | ||
378 | baseItem = invService.GetItem(baseItem); | ||
205 | 379 | ||
206 | private static byte[] GetDefaultVisualParams() | 380 | if (baseItem != null) |
207 | { | 381 | { |
208 | byte[] visualParams; | 382 | appearance.Wearables[i].AssetID = baseItem.AssetID; |
209 | visualParams = new byte[218]; | 383 | } |
210 | for (int i = 0; i < 218; i++) | 384 | else |
385 | { | ||
386 | m_log.ErrorFormat( | ||
387 | "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", | ||
388 | appearance.Wearables[i].ItemID, (WearableType)i); | ||
389 | |||
390 | appearance.Wearables[i].ItemID = UUID.Zero; | ||
391 | appearance.Wearables[i].AssetID = UUID.Zero; | ||
392 | } | ||
393 | } | ||
394 | } | ||
395 | } | ||
396 | else | ||
211 | { | 397 | { |
212 | visualParams[i] = 100; | 398 | m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); |
213 | } | 399 | } |
214 | return visualParams; | ||
215 | } | 400 | } |
216 | } | 401 | } |
217 | } | 402 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 918fa04..fdc48c6 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -599,7 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
599 | try | 599 | try |
600 | { | 600 | { |
601 | 601 | ||
602 | XmlRpcResponse GridResp = GridReq.Send("http://" + reginfo.ExternalHostName + ":" + reginfo.HttpPort, 3000); | 602 | XmlRpcResponse GridResp = GridReq.Send(reginfo.ServerURI, 3000); |
603 | 603 | ||
604 | Hashtable responseData = (Hashtable)GridResp.Value; | 604 | Hashtable responseData = (Hashtable)GridResp.Value; |
605 | 605 | ||
@@ -621,8 +621,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
621 | } | 621 | } |
622 | catch (WebException e) | 622 | catch (WebException e) |
623 | { | 623 | { |
624 | m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to http://{0}:{1} the host didn't respond ({2})", | 624 | m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0}} the host didn't respond ({2})", |
625 | reginfo.ExternalHostName, reginfo.HttpPort, e.Message); | 625 | reginfo.ServerURI, e.Message); |
626 | } | 626 | } |
627 | 627 | ||
628 | return false; | 628 | return false; |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 38fff1c..925af3f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -197,8 +197,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
197 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); | 197 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); |
198 | return; | 198 | return; |
199 | } | 199 | } |
200 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", | 200 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}", |
201 | finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); | 201 | finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); |
202 | 202 | ||
203 | // Check that these are not the same coordinates | 203 | // Check that these are not the same coordinates |
204 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && | 204 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && |
@@ -254,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
254 | } | 254 | } |
255 | 255 | ||
256 | m_log.DebugFormat( | 256 | m_log.DebugFormat( |
257 | "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3}", | 257 | "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", |
258 | reg.ExternalHostName, reg.HttpPort, finalDestination.RegionName, position); | 258 | reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); |
259 | 259 | ||
260 | uint newRegionX = (uint)(reg.RegionHandle >> 40); | 260 | uint newRegionX = (uint)(reg.RegionHandle >> 40); |
261 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); | 261 | uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); |
@@ -327,43 +327,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
327 | 327 | ||
328 | // OK, it got this agent. Let's close some child agents | 328 | // OK, it got this agent. Let's close some child agents |
329 | sp.CloseChildAgents(newRegionX, newRegionY); | 329 | sp.CloseChildAgents(newRegionX, newRegionY); |
330 | 330 | IClientIPEndpoint ipepClient; | |
331 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) | 331 | if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) |
332 | { | 332 | { |
333 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); | 333 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); |
334 | |||
335 | #region IP Translation for NAT | 334 | #region IP Translation for NAT |
336 | IClientIPEndpoint ipepClient; | 335 | // Uses ipepClient above |
337 | if (sp.ClientView.TryGet(out ipepClient)) | 336 | if (sp.ClientView.TryGet(out ipepClient)) |
338 | { | 337 | { |
339 | capsPath | 338 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); |
340 | = "http://" | ||
341 | + NetworkUtil.GetHostFor(ipepClient.EndPoint, finalDestination.ExternalHostName) | ||
342 | + ":" | ||
343 | + finalDestination.HttpPort | ||
344 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
345 | } | ||
346 | else | ||
347 | { | ||
348 | capsPath | ||
349 | = "http://" | ||
350 | + finalDestination.ExternalHostName | ||
351 | + ":" | ||
352 | + finalDestination.HttpPort | ||
353 | + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
354 | } | 339 | } |
355 | #endregion | 340 | #endregion |
341 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
356 | 342 | ||
357 | if (eq != null) | 343 | if (eq != null) |
358 | { | 344 | { |
359 | #region IP Translation for NAT | ||
360 | // Uses ipepClient above | ||
361 | if (sp.ClientView.TryGet(out ipepClient)) | ||
362 | { | ||
363 | endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address); | ||
364 | } | ||
365 | #endregion | ||
366 | |||
367 | eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); | 345 | eq.EnableSimulator(destinationHandle, endPoint, sp.UUID); |
368 | 346 | ||
369 | // ES makes the client send a UseCircuitCode message to the destination, | 347 | // ES makes the client send a UseCircuitCode message to the destination, |
@@ -382,8 +360,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
382 | else | 360 | else |
383 | { | 361 | { |
384 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); | 362 | agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle); |
385 | capsPath = "http://" + finalDestination.ExternalHostName + ":" + finalDestination.HttpPort | 363 | capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); |
386 | + "/CAPS/" + agentCircuit.CapsPath + "0000/"; | ||
387 | } | 364 | } |
388 | 365 | ||
389 | // Expect avatar crossing is a heavy-duty function at the destination. | 366 | // Expect avatar crossing is a heavy-duty function at the destination. |
@@ -516,8 +493,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
516 | 493 | ||
517 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) | 494 | protected virtual void SetCallbackURL(AgentData agent, RegionInfo region) |
518 | { | 495 | { |
519 | agent.CallbackURI = "http://" + region.ExternalHostName + ":" + region.HttpPort + | 496 | agent.CallbackURI = region.ServerURI + "agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; |
520 | "/agent/" + agent.AgentID.ToString() + "/" + region.RegionID.ToString() + "/release/"; | 497 | m_log.Debug("Set callback URL to " + agent.CallbackURI); |
521 | 498 | ||
522 | } | 499 | } |
523 | 500 | ||
@@ -842,8 +819,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
842 | cAgent.Position = pos; | 819 | cAgent.Position = pos; |
843 | if (isFlying) | 820 | if (isFlying) |
844 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 821 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
845 | cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + | 822 | cAgent.CallbackURI = m_scene.RegionInfo.ServerURI + |
846 | "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; | 823 | "agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; |
847 | 824 | ||
848 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) | 825 | if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) |
849 | { | 826 | { |
@@ -868,10 +845,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
868 | neighbourRegion.RegionHandle); | 845 | neighbourRegion.RegionHandle); |
869 | return agent; | 846 | return agent; |
870 | } | 847 | } |
871 | // TODO Should construct this behind a method | 848 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); |
872 | string capsPath = | ||
873 | "http://" + neighbourRegion.ExternalHostName + ":" + neighbourRegion.HttpPort | ||
874 | + "/CAPS/" + agentcaps /*circuitdata.CapsPath*/ + "0000/"; | ||
875 | 849 | ||
876 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 850 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
877 | 851 | ||
@@ -1190,8 +1164,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1190 | y = y / Constants.RegionSize; | 1164 | y = y / Constants.RegionSize; |
1191 | m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); | 1165 | m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); |
1192 | 1166 | ||
1193 | string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort | 1167 | string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); |
1194 | + "/CAPS/" + a.CapsPath + "0000/"; | ||
1195 | 1168 | ||
1196 | string reason = String.Empty; | 1169 | string reason = String.Empty; |
1197 | 1170 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 1ac7508..7796a08 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -123,7 +123,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
123 | if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) | 123 | if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) |
124 | { | 124 | { |
125 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); | 125 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); |
126 | return m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); | 126 | GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); |
127 | m_log.Debug("GetfinalDestination serveruri -> " + real_destination.ServerURI); | ||
128 | return real_destination; | ||
127 | } | 129 | } |
128 | return region; | 130 | return region; |
129 | } | 131 | } |
@@ -149,6 +151,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
149 | 151 | ||
150 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) | 152 | protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) |
151 | { | 153 | { |
154 | m_log.Debug("CreateAgent " + reg.ServerURI + " " + finalDestination.ServerURI); | ||
152 | reason = string.Empty; | 155 | reason = string.Empty; |
153 | logout = false; | 156 | logout = false; |
154 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); | 157 | int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); |
@@ -235,6 +238,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
235 | string url = aCircuit.ServiceURLs["HomeURI"].ToString(); | 238 | string url = aCircuit.ServiceURLs["HomeURI"].ToString(); |
236 | IUserAgentService security = new UserAgentServiceConnector(url); | 239 | IUserAgentService security = new UserAgentServiceConnector(url); |
237 | return security.VerifyClient(aCircuit.SessionID, token); | 240 | return security.VerifyClient(aCircuit.SessionID, token); |
241 | } else { | ||
242 | m_log.Debug("this gent does not have a HomeURI OH NO"); | ||
238 | } | 243 | } |
239 | 244 | ||
240 | return false; | 245 | return false; |
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index fd0e879..2dd7767 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | |||
@@ -595,12 +595,12 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
595 | // DEPRECATED | 595 | // DEPRECATED |
596 | responseMap["seed_capability"] | 596 | responseMap["seed_capability"] |
597 | = OSD.FromString( | 597 | = OSD.FromString( |
598 | regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); | 598 | regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); |
599 | 599 | ||
600 | // REPLACEMENT | 600 | // REPLACEMENT |
601 | responseMap["region_seed_capability"] | 601 | responseMap["region_seed_capability"] |
602 | = OSD.FromString( | 602 | = OSD.FromString( |
603 | regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); | 603 | regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); |
604 | 604 | ||
605 | responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); | 605 | responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); |
606 | responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); | 606 | responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs index 47f19a3..9ee19f8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Server.Base; | 36 | using OpenSim.Server.Base; |
@@ -137,6 +138,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar | |||
137 | 138 | ||
138 | #region IAvatarService | 139 | #region IAvatarService |
139 | 140 | ||
141 | public AvatarAppearance GetAppearance(UUID userID) | ||
142 | { | ||
143 | return m_AvatarService.GetAppearance(userID); | ||
144 | } | ||
145 | |||
146 | public bool SetAppearance(UUID userID, AvatarAppearance appearance) | ||
147 | { | ||
148 | return m_AvatarService.SetAppearance(userID,appearance); | ||
149 | } | ||
150 | |||
140 | public AvatarData GetAvatar(UUID userID) | 151 | public AvatarData GetAvatar(UUID userID) |
141 | { | 152 | { |
142 | return m_AvatarService.GetAvatar(userID); | 153 | return m_AvatarService.GetAvatar(userID); |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index a182eea..fdbbccf 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
147 | 147 | ||
148 | string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); | 148 | string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString(); |
149 | regionimage = regionimage.Replace("-", ""); | 149 | regionimage = regionimage.Replace("-", ""); |
150 | m_log.Info("[WORLD MAP]: JPEG Map location: http://" + m_scene.RegionInfo.ExternalEndPoint.Address.ToString() + ":" + m_scene.RegionInfo.HttpPort.ToString() + "/index.php?method=" + regionimage); | 150 | m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "/index.php?method=" + regionimage); |
151 | 151 | ||
152 | MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); | 152 | MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); |
153 | MainServer.Instance.AddLLSDHandler( | 153 | MainServer.Instance.AddLLSDHandler( |
@@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
579 | 579 | ||
580 | if (mreg != null) | 580 | if (mreg != null) |
581 | { | 581 | { |
582 | httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString(); | 582 | httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString(); |
583 | lock (m_cachedRegionMapItemsAddress) | 583 | lock (m_cachedRegionMapItemsAddress) |
584 | { | 584 | { |
585 | if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) | 585 | if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 268612e..f128aa2 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -82,7 +82,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
82 | 82 | ||
83 | public event DeRezObject OnDeRezObject; | 83 | public event DeRezObject OnDeRezObject; |
84 | public event Action<IClientAPI> OnRegionHandShakeReply; | 84 | public event Action<IClientAPI> OnRegionHandShakeReply; |
85 | public event GenericCall2 OnRequestWearables; | 85 | public event GenericCall1 OnRequestWearables; |
86 | public event GenericCall1 OnCompleteMovementToRegion; | 86 | public event GenericCall1 OnCompleteMovementToRegion; |
87 | public event UpdateAgent OnPreAgentUpdate; | 87 | public event UpdateAgent OnPreAgentUpdate; |
88 | public event UpdateAgent OnAgentUpdate; | 88 | public event UpdateAgent OnAgentUpdate; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f0ae45e..f77fb2c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -119,7 +119,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | 119 | ||
120 | protected IXMLRPC m_xmlrpcModule; | 120 | protected IXMLRPC m_xmlrpcModule; |
121 | protected IWorldComm m_worldCommModule; | 121 | protected IWorldComm m_worldCommModule; |
122 | protected IAvatarFactory m_AvatarFactory; | ||
123 | protected IConfigSource m_config; | 122 | protected IConfigSource m_config; |
124 | protected IRegionSerialiserModule m_serialiser; | 123 | protected IRegionSerialiserModule m_serialiser; |
125 | protected IDialogModule m_dialogModule; | 124 | protected IDialogModule m_dialogModule; |
@@ -399,11 +398,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
399 | 398 | ||
400 | public IAttachmentsModule AttachmentsModule { get; set; } | 399 | public IAttachmentsModule AttachmentsModule { get; set; } |
401 | 400 | ||
402 | public IAvatarFactory AvatarFactory | ||
403 | { | ||
404 | get { return m_AvatarFactory; } | ||
405 | } | ||
406 | |||
407 | public ICapabilitiesModule CapsModule | 401 | public ICapabilitiesModule CapsModule |
408 | { | 402 | { |
409 | get { return m_capsModule; } | 403 | get { return m_capsModule; } |
@@ -1159,7 +1153,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1159 | m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); | 1153 | m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); |
1160 | m_worldCommModule = RequestModuleInterface<IWorldComm>(); | 1154 | m_worldCommModule = RequestModuleInterface<IWorldComm>(); |
1161 | XferManager = RequestModuleInterface<IXfer>(); | 1155 | XferManager = RequestModuleInterface<IXfer>(); |
1162 | m_AvatarFactory = RequestModuleInterface<IAvatarFactory>(); | ||
1163 | AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); | 1156 | AttachmentsModule = RequestModuleInterface<IAttachmentsModule>(); |
1164 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); | 1157 | m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); |
1165 | m_dialogModule = RequestModuleInterface<IDialogModule>(); | 1158 | m_dialogModule = RequestModuleInterface<IDialogModule>(); |
@@ -3756,9 +3749,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
3756 | 3749 | ||
3757 | // We have to wait until the viewer contacts this region after receiving EAC. | 3750 | // We have to wait until the viewer contacts this region after receiving EAC. |
3758 | // That calls AddNewClient, which finally creates the ScenePresence | 3751 | // That calls AddNewClient, which finally creates the ScenePresence |
3752 | m_log.Debug("ICADU -> pre wait"); | ||
3759 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); | 3753 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); |
3754 | m_log.Debug("ICADU -> post wait"); | ||
3760 | if (childAgentUpdate != null) | 3755 | if (childAgentUpdate != null) |
3761 | { | 3756 | { |
3757 | m_log.Debug("ICADU -> not child agent!"); | ||
3762 | childAgentUpdate.ChildAgentDataUpdate(cAgentData); | 3758 | childAgentUpdate.ChildAgentDataUpdate(cAgentData); |
3763 | return true; | 3759 | return true; |
3764 | } | 3760 | } |
@@ -3774,7 +3770,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3774 | /// <returns>true if we handled it.</returns> | 3770 | /// <returns>true if we handled it.</returns> |
3775 | public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) | 3771 | public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) |
3776 | { | 3772 | { |
3777 | //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); | 3773 | m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); |
3778 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); | 3774 | ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); |
3779 | if (childAgentUpdate != null) | 3775 | if (childAgentUpdate != null) |
3780 | { | 3776 | { |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 13d9964..1abd134 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -75,7 +75,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
75 | 75 | ||
76 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 76 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
77 | 77 | ||
78 | private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; | ||
79 | // private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); | 78 | // private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); |
80 | private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); | 79 | private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); |
81 | private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); | 80 | private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); |
@@ -137,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | 136 | ||
138 | private SendCourseLocationsMethod m_sendCourseLocationsMethod; | 137 | private SendCourseLocationsMethod m_sendCourseLocationsMethod; |
139 | 138 | ||
140 | private bool m_startAnimationSet; | ||
141 | |||
142 | //private Vector3 m_requestedSitOffset = new Vector3(); | 139 | //private Vector3 m_requestedSitOffset = new Vector3(); |
143 | 140 | ||
144 | private Vector3 m_LastFinitePos; | 141 | private Vector3 m_LastFinitePos; |
@@ -713,13 +710,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
713 | SetDirectionVectors(); | 710 | SetDirectionVectors(); |
714 | } | 711 | } |
715 | 712 | ||
713 | /* | ||
716 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, | 714 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
717 | AvatarWearable[] wearables) | 715 | AvatarWearable[] wearables) |
718 | : this(client, world, reginfo) | 716 | : this(client, world, reginfo) |
719 | { | 717 | { |
720 | m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); | 718 | m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); |
721 | } | 719 | } |
722 | 720 | */ | |
723 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) | 721 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) |
724 | : this(client, world, reginfo) | 722 | : this(client, world, reginfo) |
725 | { | 723 | { |
@@ -733,8 +731,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
733 | 731 | ||
734 | public void RegisterToEvents() | 732 | public void RegisterToEvents() |
735 | { | 733 | { |
736 | m_controllingClient.OnRequestWearables += SendWearables; | ||
737 | m_controllingClient.OnSetAppearance += SetAppearance; | ||
738 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; | 734 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; |
739 | //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; | 735 | //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; |
740 | m_controllingClient.OnAgentUpdate += HandleAgentUpdate; | 736 | m_controllingClient.OnAgentUpdate += HandleAgentUpdate; |
@@ -1068,7 +1064,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1068 | /// <summary> | 1064 | /// <summary> |
1069 | /// Sets avatar height in the phyiscs plugin | 1065 | /// Sets avatar height in the phyiscs plugin |
1070 | /// </summary> | 1066 | /// </summary> |
1071 | internal void SetHeight(float height) | 1067 | public void SetHeight(float height) |
1072 | { | 1068 | { |
1073 | m_avHeight = height; | 1069 | m_avHeight = height; |
1074 | if (PhysicsActor != null && !IsChildAgent) | 1070 | if (PhysicsActor != null && !IsChildAgent) |
@@ -1133,7 +1129,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1133 | if (friendsModule != null) | 1129 | if (friendsModule != null) |
1134 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | 1130 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); |
1135 | } | 1131 | } |
1136 | |||
1137 | } | 1132 | } |
1138 | 1133 | ||
1139 | /// <summary> | 1134 | /// <summary> |
@@ -2392,9 +2387,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2392 | if (m_appearance.Texture == null) | 2387 | if (m_appearance.Texture == null) |
2393 | return; | 2388 | return; |
2394 | 2389 | ||
2395 | Vector3 pos = m_pos; | 2390 | if (IsChildAgent) |
2396 | pos.Z += m_appearance.HipOffset; | 2391 | { |
2397 | 2392 | m_log.WarnFormat("[SCENEPRESENCE] A child agent is attempting to send out avatar data"); | |
2393 | return; | ||
2394 | } | ||
2395 | |||
2398 | remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); | 2396 | remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); |
2399 | m_scene.StatsReporter.AddAgentUpdates(1); | 2397 | m_scene.StatsReporter.AddAgentUpdates(1); |
2400 | } | 2398 | } |
@@ -2437,6 +2435,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2437 | m_perfMonMS = Util.EnvironmentTickCount(); | 2435 | m_perfMonMS = Util.EnvironmentTickCount(); |
2438 | 2436 | ||
2439 | // only send update from root agents to other clients; children are only "listening posts" | 2437 | // only send update from root agents to other clients; children are only "listening posts" |
2438 | if (IsChildAgent) | ||
2439 | { | ||
2440 | m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent"); | ||
2441 | return; | ||
2442 | } | ||
2443 | |||
2440 | int count = 0; | 2444 | int count = 0; |
2441 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 2445 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
2442 | { | 2446 | { |
@@ -2460,29 +2464,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
2460 | // the inventory arrives | 2464 | // the inventory arrives |
2461 | // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); | 2465 | // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); |
2462 | 2466 | ||
2463 | Vector3 pos = m_pos; | ||
2464 | pos.Z += m_appearance.HipOffset; | ||
2465 | |||
2466 | m_controllingClient.SendAvatarDataImmediate(this); | 2467 | m_controllingClient.SendAvatarDataImmediate(this); |
2468 | m_controllingClient.SendAppearance(m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes()); | ||
2467 | 2469 | ||
2468 | SendInitialFullUpdateToAllClients(); | 2470 | SendInitialFullUpdateToAllClients(); |
2469 | } | 2471 | } |
2470 | 2472 | ||
2471 | /// <summary> | 2473 | /// <summary> |
2472 | /// Tell the client for this scene presence what items it should be wearing now | ||
2473 | /// </summary> | ||
2474 | public void SendWearables() | ||
2475 | { | ||
2476 | m_log.DebugFormat("[SCENE]: Received request for wearables of {0}", Name); | ||
2477 | |||
2478 | ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); | ||
2479 | } | ||
2480 | |||
2481 | /// <summary> | ||
2482 | /// | 2474 | /// |
2483 | /// </summary> | 2475 | /// </summary> |
2484 | public void SendAppearanceToAllOtherAgents() | 2476 | public void SendAppearanceToAllOtherAgents() |
2485 | { | 2477 | { |
2478 | // DEBUG ON | ||
2479 | m_log.WarnFormat("[SP] Send appearance from {0} to all other agents",m_uuid); | ||
2480 | // DEBUG OFF | ||
2486 | m_perfMonMS = Util.EnvironmentTickCount(); | 2481 | m_perfMonMS = Util.EnvironmentTickCount(); |
2487 | 2482 | ||
2488 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2483 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
@@ -2502,87 +2497,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2502 | /// <param name="avatar"></param> | 2497 | /// <param name="avatar"></param> |
2503 | public void SendAppearanceToOtherAgent(ScenePresence avatar) | 2498 | public void SendAppearanceToOtherAgent(ScenePresence avatar) |
2504 | { | 2499 | { |
2500 | // DEBUG ON | ||
2501 | m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); | ||
2502 | // DEBUG OFF | ||
2505 | avatar.ControllingClient.SendAppearance( | 2503 | avatar.ControllingClient.SendAppearance( |
2506 | m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); | 2504 | m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); |
2507 | } | 2505 | } |
2508 | 2506 | ||
2509 | /// <summary> | ||
2510 | /// Set appearance data (textureentry and slider settings) received from the client | ||
2511 | /// </summary> | ||
2512 | /// <param name="texture"></param> | ||
2513 | /// <param name="visualParam"></param> | ||
2514 | public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) | ||
2515 | { | ||
2516 | if (m_physicsActor != null) | ||
2517 | { | ||
2518 | if (!IsChildAgent) | ||
2519 | { | ||
2520 | // This may seem like it's redundant, remove the avatar from the physics scene | ||
2521 | // just to add it back again, but it saves us from having to update | ||
2522 | // 3 variables 10 times a second. | ||
2523 | bool flyingTemp = m_physicsActor.Flying; | ||
2524 | RemoveFromPhysicalScene(); | ||
2525 | //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); | ||
2526 | |||
2527 | //PhysicsActor = null; | ||
2528 | |||
2529 | AddToPhysicalScene(flyingTemp); | ||
2530 | } | ||
2531 | } | ||
2532 | |||
2533 | #region Bake Cache Check | ||
2534 | |||
2535 | if (textureEntry != null) | ||
2536 | { | ||
2537 | for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
2538 | { | ||
2539 | int j = BAKE_INDICES[i]; | ||
2540 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[j]; | ||
2541 | |||
2542 | if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) | ||
2543 | { | ||
2544 | if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) | ||
2545 | { | ||
2546 | m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + this.Name); | ||
2547 | this.ControllingClient.SendRebakeAvatarTextures(face.TextureID); | ||
2548 | } | ||
2549 | } | ||
2550 | } | ||
2551 | |||
2552 | } | ||
2553 | |||
2554 | |||
2555 | #endregion Bake Cache Check | ||
2556 | |||
2557 | m_appearance.SetAppearance(textureEntry, visualParams); | ||
2558 | if (m_appearance.AvatarHeight > 0) | ||
2559 | SetHeight(m_appearance.AvatarHeight); | ||
2560 | |||
2561 | // This is not needed, because only the transient data changed | ||
2562 | //AvatarData adata = new AvatarData(m_appearance); | ||
2563 | //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); | ||
2564 | |||
2565 | SendAppearanceToAllOtherAgents(); | ||
2566 | if (!m_startAnimationSet) | ||
2567 | { | ||
2568 | Animator.UpdateMovementAnimations(); | ||
2569 | m_startAnimationSet = true; | ||
2570 | } | ||
2571 | |||
2572 | Vector3 pos = m_pos; | ||
2573 | pos.Z += m_appearance.HipOffset; | ||
2574 | |||
2575 | m_controllingClient.SendAvatarDataImmediate(this); | ||
2576 | } | ||
2577 | |||
2578 | public void SetWearable(int wearableId, AvatarWearable wearable) | ||
2579 | { | ||
2580 | m_appearance.SetWearable(wearableId, wearable); | ||
2581 | AvatarData adata = new AvatarData(m_appearance); | ||
2582 | m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); | ||
2583 | m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); | ||
2584 | } | ||
2585 | |||
2586 | // Because appearance setting is in a module, we actually need | 2507 | // Because appearance setting is in a module, we actually need |
2587 | // to give it access to our appearance directly, otherwise we | 2508 | // to give it access to our appearance directly, otherwise we |
2588 | // get a synchronization issue. | 2509 | // get a synchronization issue. |
@@ -2925,7 +2846,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2925 | 2846 | ||
2926 | public void ChildAgentDataUpdate(AgentData cAgentData) | 2847 | public void ChildAgentDataUpdate(AgentData cAgentData) |
2927 | { | 2848 | { |
2928 | //m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); | 2849 | m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); |
2929 | if (!IsChildAgent) | 2850 | if (!IsChildAgent) |
2930 | return; | 2851 | return; |
2931 | 2852 | ||
@@ -2976,6 +2897,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2976 | 2897 | ||
2977 | public void CopyTo(AgentData cAgent) | 2898 | public void CopyTo(AgentData cAgent) |
2978 | { | 2899 | { |
2900 | cAgent.CallbackURI = m_callbackURI; | ||
2901 | |||
2979 | cAgent.AgentID = UUID; | 2902 | cAgent.AgentID = UUID; |
2980 | cAgent.RegionID = Scene.RegionInfo.RegionID; | 2903 | cAgent.RegionID = Scene.RegionInfo.RegionID; |
2981 | 2904 | ||
@@ -3015,6 +2938,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3015 | 2938 | ||
3016 | cAgent.AlwaysRun = m_setAlwaysRun; | 2939 | cAgent.AlwaysRun = m_setAlwaysRun; |
3017 | 2940 | ||
2941 | cAgent.Appearance = new AvatarAppearance(m_appearance); | ||
2942 | |||
2943 | /* | ||
3018 | try | 2944 | try |
3019 | { | 2945 | { |
3020 | // We might not pass the Wearables in all cases... | 2946 | // We might not pass the Wearables in all cases... |
@@ -3054,14 +2980,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3054 | { | 2980 | { |
3055 | //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); | 2981 | //m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); |
3056 | int i = 0; | 2982 | int i = 0; |
3057 | AttachmentData[] attachs = new AttachmentData[attPoints.Count]; | 2983 | AvatarAttachment[] attachs = new AvatarAttachment[attPoints.Count]; |
3058 | foreach (int point in attPoints) | 2984 | foreach (int point in attPoints) |
3059 | { | 2985 | { |
3060 | attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point)); | 2986 | attachs[i++] = new AvatarAttachment(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point)); |
3061 | } | 2987 | } |
3062 | cAgent.Attachments = attachs; | 2988 | cAgent.Attachments = attachs; |
3063 | } | 2989 | } |
3064 | 2990 | */ | |
3065 | lock (scriptedcontrols) | 2991 | lock (scriptedcontrols) |
3066 | { | 2992 | { |
3067 | ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; | 2993 | ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; |
@@ -3088,6 +3014,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3088 | 3014 | ||
3089 | public void CopyFrom(AgentData cAgent) | 3015 | public void CopyFrom(AgentData cAgent) |
3090 | { | 3016 | { |
3017 | // DEBUG ON | ||
3018 | m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM"); | ||
3019 | // DEBUG OFF | ||
3091 | m_originRegionID = cAgent.RegionID; | 3020 | m_originRegionID = cAgent.RegionID; |
3092 | 3021 | ||
3093 | m_callbackURI = cAgent.CallbackURI; | 3022 | m_callbackURI = cAgent.CallbackURI; |
@@ -3113,6 +3042,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3113 | m_godLevel = cAgent.GodLevel; | 3042 | m_godLevel = cAgent.GodLevel; |
3114 | m_setAlwaysRun = cAgent.AlwaysRun; | 3043 | m_setAlwaysRun = cAgent.AlwaysRun; |
3115 | 3044 | ||
3045 | m_appearance = new AvatarAppearance(cAgent.Appearance); | ||
3046 | |||
3047 | /* | ||
3116 | uint i = 0; | 3048 | uint i = 0; |
3117 | try | 3049 | try |
3118 | { | 3050 | { |
@@ -3125,15 +3057,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3125 | UUID assetId = cAgent.Wearables[n + 1]; | 3057 | UUID assetId = cAgent.Wearables[n + 1]; |
3126 | wears[i++] = new AvatarWearable(itemId, assetId); | 3058 | wears[i++] = new AvatarWearable(itemId, assetId); |
3127 | } | 3059 | } |
3128 | m_appearance.Wearables = wears; | 3060 | // m_appearance.Wearables = wears; |
3129 | Primitive.TextureEntry te; | 3061 | Primitive.TextureEntry textures = null; |
3130 | if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1) | 3062 | if (cAgent.AgentTextures != null && cAgent.AgentTextures.Length > 1) |
3131 | te = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length); | 3063 | textures = new Primitive.TextureEntry(cAgent.AgentTextures, 0, cAgent.AgentTextures.Length); |
3132 | else | 3064 | |
3133 | te = AvatarAppearance.GetDefaultTexture(); | 3065 | byte[] visuals = null; |
3134 | if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) | 3066 | |
3135 | cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); | 3067 | if ((cAgent.VisualParams != null) && (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) |
3136 | m_appearance.SetAppearance(te, (byte[])cAgent.VisualParams.Clone()); | 3068 | visuals = (byte[])cAgent.VisualParams.Clone(); |
3069 | |||
3070 | m_appearance = new AvatarAppearance(cAgent.AgentID,wears,textures,visuals); | ||
3137 | } | 3071 | } |
3138 | catch (Exception e) | 3072 | catch (Exception e) |
3139 | { | 3073 | { |
@@ -3146,14 +3080,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3146 | if (cAgent.Attachments != null) | 3080 | if (cAgent.Attachments != null) |
3147 | { | 3081 | { |
3148 | m_appearance.ClearAttachments(); | 3082 | m_appearance.ClearAttachments(); |
3149 | foreach (AttachmentData att in cAgent.Attachments) | 3083 | foreach (AvatarAttachment att in cAgent.Attachments) |
3150 | { | 3084 | { |
3151 | m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); | 3085 | m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); |
3152 | } | 3086 | } |
3153 | } | 3087 | } |
3154 | } | 3088 | } |
3155 | catch { } | 3089 | catch { } |
3156 | 3090 | */ | |
3157 | try | 3091 | try |
3158 | { | 3092 | { |
3159 | lock (scriptedcontrols) | 3093 | lock (scriptedcontrols) |
@@ -3722,15 +3656,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3722 | return; | 3656 | return; |
3723 | } | 3657 | } |
3724 | 3658 | ||
3725 | List<int> attPoints = m_appearance.GetAttachedPoints(); | 3659 | List<AvatarAttachment> attachments = m_appearance.GetAttachments(); |
3726 | foreach (int p in attPoints) | 3660 | foreach (AvatarAttachment attach in attachments) |
3727 | { | 3661 | { |
3728 | if (m_isDeleted) | 3662 | if (m_isDeleted) |
3729 | return; | 3663 | return; |
3730 | 3664 | ||
3731 | UUID itemID = m_appearance.GetAttachedItem(p); | 3665 | int p = attach.AttachPoint; |
3666 | UUID itemID = attach.ItemID; | ||
3732 | 3667 | ||
3733 | //UUID assetID = m_appearance.GetAttachedAsset(p); | 3668 | //UUID assetID = attach.AssetID; |
3734 | // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down | 3669 | // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down |
3735 | // But they're not used anyway, the item is being looked up for now, so let's proceed. | 3670 | // But they're not used anyway, the item is being looked up for now, so let's proceed. |
3736 | //if (UUID.Zero == assetID) | 3671 | //if (UUID.Zero == assetID) |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 159af79..fc17192 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -676,7 +676,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
676 | public event TeleportLandmarkRequest OnTeleportLandmarkRequest; | 676 | public event TeleportLandmarkRequest OnTeleportLandmarkRequest; |
677 | public event DeRezObject OnDeRezObject; | 677 | public event DeRezObject OnDeRezObject; |
678 | public event Action<IClientAPI> OnRegionHandShakeReply; | 678 | public event Action<IClientAPI> OnRegionHandShakeReply; |
679 | public event GenericCall2 OnRequestWearables; | 679 | public event GenericCall1 OnRequestWearables; |
680 | public event GenericCall1 OnCompleteMovementToRegion; | 680 | public event GenericCall1 OnCompleteMovementToRegion; |
681 | public event UpdateAgent OnPreAgentUpdate; | 681 | public event UpdateAgent OnPreAgentUpdate; |
682 | public event UpdateAgent OnAgentUpdate; | 682 | public event UpdateAgent OnAgentUpdate; |
@@ -899,7 +899,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
899 | Scene scene = (Scene)Scene; | 899 | Scene scene = (Scene)Scene; |
900 | AvatarAppearance appearance; | 900 | AvatarAppearance appearance; |
901 | scene.GetAvatarAppearance(this, out appearance); | 901 | scene.GetAvatarAppearance(this, out appearance); |
902 | OnSetAppearance(appearance.Texture, (byte[])appearance.VisualParams.Clone()); | 902 | OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone()); |
903 | } | 903 | } |
904 | 904 | ||
905 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) | 905 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs index 0786bd9..922eaaf 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs | |||
@@ -29,6 +29,7 @@ using System.Collections; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Security; | 30 | using System.Security; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | 35 | ||
@@ -81,16 +82,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
81 | get { | 82 | get { |
82 | List<IAvatarAttachment> attachments = new List<IAvatarAttachment>(); | 83 | List<IAvatarAttachment> attachments = new List<IAvatarAttachment>(); |
83 | 84 | ||
84 | Hashtable internalAttachments = GetSP().Appearance.GetAttachments(); | 85 | List<AvatarAttachment> internalAttachments = GetSP().Appearance.GetAttachments(); |
85 | if (internalAttachments != null) | 86 | foreach (AvatarAttachment attach in internalAttachments) |
86 | { | 87 | { |
87 | foreach (DictionaryEntry element in internalAttachments) | 88 | attachments.Add(new SPAvatarAttachment(m_rootScene, this, attach.AttachPoint, |
88 | { | 89 | new UUID(attach.ItemID), |
89 | Hashtable attachInfo = (Hashtable)element.Value; | 90 | new UUID(attach.AssetID), m_security)); |
90 | attachments.Add(new SPAvatarAttachment(m_rootScene, this, (int) element.Key, | ||
91 | new UUID((string) attachInfo["item"]), | ||
92 | new UUID((string) attachInfo["asset"]), m_security)); | ||
93 | } | ||
94 | } | 91 | } |
95 | 92 | ||
96 | return attachments.ToArray(); | 93 | return attachments.ToArray(); |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index fae12b6..6928c4e 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -188,7 +188,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
188 | 188 | ||
189 | public event DeRezObject OnDeRezObject; | 189 | public event DeRezObject OnDeRezObject; |
190 | public event Action<IClientAPI> OnRegionHandShakeReply; | 190 | public event Action<IClientAPI> OnRegionHandShakeReply; |
191 | public event GenericCall2 OnRequestWearables; | 191 | public event GenericCall1 OnRequestWearables; |
192 | public event GenericCall1 OnCompleteMovementToRegion; | 192 | public event GenericCall1 OnCompleteMovementToRegion; |
193 | public event UpdateAgent OnPreAgentUpdate; | 193 | public event UpdateAgent OnPreAgentUpdate; |
194 | public event UpdateAgent OnAgentUpdate; | 194 | public event UpdateAgent OnAgentUpdate; |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index ab0be77..c471636 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -64,15 +64,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
64 | if (m_appearanceCache.ContainsKey(target)) | 64 | if (m_appearanceCache.ContainsKey(target)) |
65 | return m_appearanceCache[target]; | 65 | return m_appearanceCache[target]; |
66 | 66 | ||
67 | AvatarData adata = scene.AvatarService.GetAvatar(target); | 67 | AvatarAppearance appearance = scene.AvatarService.GetAppearance(target); |
68 | if (adata != null) | 68 | if (appearance != null) |
69 | { | 69 | { |
70 | AvatarAppearance x = adata.ToAvatarAppearance(target); | 70 | m_appearanceCache.Add(target, appearance); |
71 | 71 | return appearance; | |
72 | m_appearanceCache.Add(target, x); | ||
73 | |||
74 | return x; | ||
75 | } | 72 | } |
73 | |||
76 | return new AvatarAppearance(); | 74 | return new AvatarAppearance(); |
77 | } | 75 | } |
78 | 76 | ||
@@ -169,7 +167,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
169 | { | 167 | { |
170 | AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); | 168 | AvatarAppearance x = GetAppearance(p_cloneAppearanceFrom, p_scene); |
171 | 169 | ||
172 | sp.SetAppearance(x.Texture, (byte[])x.VisualParams.Clone()); | 170 | sp.Appearance.SetTextureEntries(x.Texture); |
171 | sp.Appearance.SetVisualParams((byte[])x.VisualParams.Clone()); | ||
172 | sp.SendAppearanceToAllOtherAgents(); | ||
173 | } | 173 | } |
174 | 174 | ||
175 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | 175 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); |
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index f64a079..a5ec4f2 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs | |||
@@ -124,6 +124,8 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
124 | UUID uuid = UUID.Zero; | 124 | UUID uuid = UUID.Zero; |
125 | string regionname = string.Empty; | 125 | string regionname = string.Empty; |
126 | string gatekeeper_host = string.Empty; | 126 | string gatekeeper_host = string.Empty; |
127 | string gatekeeper_serveruri = string.Empty; | ||
128 | string destination_serveruri = string.Empty; | ||
127 | int gatekeeper_port = 0; | 129 | int gatekeeper_port = 0; |
128 | IPEndPoint client_ipaddress = null; | 130 | IPEndPoint client_ipaddress = null; |
129 | 131 | ||
@@ -131,8 +133,13 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
131 | gatekeeper_host = args["gatekeeper_host"].AsString(); | 133 | gatekeeper_host = args["gatekeeper_host"].AsString(); |
132 | if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) | 134 | if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) |
133 | Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port); | 135 | Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port); |
136 | if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] !=null) | ||
137 | gatekeeper_serveruri = args["gatekeeper_serveruri"]; | ||
138 | if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] !=null) | ||
139 | destination_serveruri = args["destination_serveruri"]; | ||
134 | 140 | ||
135 | GridRegion gatekeeper = new GridRegion(); | 141 | GridRegion gatekeeper = new GridRegion(); |
142 | gatekeeper.ServerURI = gatekeeper_serveruri; | ||
136 | gatekeeper.ExternalHostName = gatekeeper_host; | 143 | gatekeeper.ExternalHostName = gatekeeper_host; |
137 | gatekeeper.HttpPort = (uint)gatekeeper_port; | 144 | gatekeeper.HttpPort = (uint)gatekeeper_port; |
138 | gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | 145 | gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); |
@@ -173,7 +180,8 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
173 | destination.RegionLocX = x; | 180 | destination.RegionLocX = x; |
174 | destination.RegionLocY = y; | 181 | destination.RegionLocY = y; |
175 | destination.RegionName = regionname; | 182 | destination.RegionName = regionname; |
176 | 183 | destination.ServerURI = destination_serveruri; | |
184 | |||
177 | AgentCircuitData aCircuit = new AgentCircuitData(); | 185 | AgentCircuitData aCircuit = new AgentCircuitData(); |
178 | try | 186 | try |
179 | { | 187 | { |
diff --git a/OpenSim/Services/AvatarService/AvatarService.cs b/OpenSim/Services/AvatarService/AvatarService.cs index 19e662c..a8ad413 100644 --- a/OpenSim/Services/AvatarService/AvatarService.cs +++ b/OpenSim/Services/AvatarService/AvatarService.cs | |||
@@ -51,6 +51,20 @@ namespace OpenSim.Services.AvatarService | |||
51 | m_log.Debug("[AVATAR SERVICE]: Starting avatar service"); | 51 | m_log.Debug("[AVATAR SERVICE]: Starting avatar service"); |
52 | } | 52 | } |
53 | 53 | ||
54 | // Get|SetAppearance should preserve existing semantics | ||
55 | // until AvatarData can be removed completely | ||
56 | public AvatarAppearance GetAppearance(UUID principalID) | ||
57 | { | ||
58 | AvatarData avatar = GetAvatar(principalID); | ||
59 | return avatar.ToAvatarAppearance(principalID); | ||
60 | } | ||
61 | |||
62 | public bool SetAppearance(UUID principalID, AvatarAppearance appearance) | ||
63 | { | ||
64 | AvatarData avatar = new AvatarData(appearance); | ||
65 | return SetAvatar(principalID,avatar); | ||
66 | } | ||
67 | |||
54 | public AvatarData GetAvatar(UUID principalID) | 68 | public AvatarData GetAvatar(UUID principalID) |
55 | { | 69 | { |
56 | AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString()); | 70 | AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString()); |
diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs index 96c05a9..1cd6bf8 100644 --- a/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs | |||
@@ -87,6 +87,18 @@ namespace OpenSim.Services.Connectors | |||
87 | 87 | ||
88 | #region IAvatarService | 88 | #region IAvatarService |
89 | 89 | ||
90 | public AvatarAppearance GetAppearance(UUID userID) | ||
91 | { | ||
92 | AvatarData avatar = GetAvatar(userID); | ||
93 | return avatar.ToAvatarAppearance(userID); | ||
94 | } | ||
95 | |||
96 | public bool SetAppearance(UUID userID, AvatarAppearance appearance) | ||
97 | { | ||
98 | AvatarData avatar = new AvatarData(appearance); | ||
99 | return SetAvatar(userID,avatar); | ||
100 | } | ||
101 | |||
90 | public AvatarData GetAvatar(UUID userID) | 102 | public AvatarData GetAvatar(UUID userID) |
91 | { | 103 | { |
92 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 104 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 479a80e..70bafda 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
63 | 63 | ||
64 | protected override string AgentPath() | 64 | protected override string AgentPath() |
65 | { | 65 | { |
66 | return "/foreignagent/"; | 66 | return "foreignagent/"; |
67 | } | 67 | } |
68 | 68 | ||
69 | protected override string ObjectPath() | 69 | protected override string ObjectPath() |
70 | { | 70 | { |
71 | return "/foreignobject/"; | 71 | return "foreignobject/"; |
72 | } | 72 | } |
73 | 73 | ||
74 | public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) | 74 | public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) |
@@ -86,12 +86,11 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
86 | paramList.Add(hash); | 86 | paramList.Add(hash); |
87 | 87 | ||
88 | XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); | 88 | XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); |
89 | string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"); | 89 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI); |
90 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); | ||
91 | XmlRpcResponse response = null; | 90 | XmlRpcResponse response = null; |
92 | try | 91 | try |
93 | { | 92 | { |
94 | response = request.Send(uri, 10000); | 93 | response = request.Send(info.ServerURI, 10000); |
95 | } | 94 | } |
96 | catch (Exception e) | 95 | catch (Exception e) |
97 | { | 96 | { |
@@ -108,8 +107,8 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
108 | } | 107 | } |
109 | 108 | ||
110 | hash = (Hashtable)response.Value; | 109 | hash = (Hashtable)response.Value; |
111 | //foreach (Object o in hash) | 110 | foreach (Object o in hash) |
112 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | 111 | m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); |
113 | try | 112 | try |
114 | { | 113 | { |
115 | bool success = false; | 114 | bool success = false; |
@@ -117,16 +116,20 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
117 | if (success) | 116 | if (success) |
118 | { | 117 | { |
119 | UUID.TryParse((string)hash["uuid"], out regionID); | 118 | UUID.TryParse((string)hash["uuid"], out regionID); |
120 | //m_log.Debug(">> HERE, uuid: " + uuid); | 119 | m_log.Debug(">> HERE, uuid: " + regionID); |
121 | if ((string)hash["handle"] != null) | 120 | if ((string)hash["handle"] != null) |
122 | { | 121 | { |
123 | realHandle = Convert.ToUInt64((string)hash["handle"]); | 122 | realHandle = Convert.ToUInt64((string)hash["handle"]); |
124 | //m_log.Debug(">> HERE, realHandle: " + realHandle); | 123 | m_log.Debug(">> HERE, realHandle: " + realHandle); |
125 | } | 124 | } |
126 | if (hash["region_image"] != null) | 125 | if (hash["region_image"] != null) { |
127 | imageURL = (string)hash["region_image"]; | 126 | imageURL = (string)hash["region_image"]; |
128 | if (hash["external_name"] != null) | 127 | m_log.Debug(">> HERE, imageURL: " + imageURL); |
128 | } | ||
129 | if (hash["external_name"] != null) { | ||
129 | externalName = (string)hash["external_name"]; | 130 | externalName = (string)hash["external_name"]; |
131 | m_log.Debug(">> HERE, externalName: " + externalName); | ||
132 | } | ||
130 | } | 133 | } |
131 | 134 | ||
132 | } | 135 | } |
@@ -188,12 +191,11 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
188 | paramList.Add(hash); | 191 | paramList.Add(hash); |
189 | 192 | ||
190 | XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); | 193 | XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); |
191 | string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"); | 194 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); |
192 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); | ||
193 | XmlRpcResponse response = null; | 195 | XmlRpcResponse response = null; |
194 | try | 196 | try |
195 | { | 197 | { |
196 | response = request.Send(uri, 10000); | 198 | response = request.Send(gatekeeper.ServerURI, 10000); |
197 | } | 199 | } |
198 | catch (Exception e) | 200 | catch (Exception e) |
199 | { | 201 | { |
@@ -219,38 +221,48 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
219 | GridRegion region = new GridRegion(); | 221 | GridRegion region = new GridRegion(); |
220 | 222 | ||
221 | UUID.TryParse((string)hash["uuid"], out region.RegionID); | 223 | UUID.TryParse((string)hash["uuid"], out region.RegionID); |
222 | //m_log.Debug(">> HERE, uuid: " + region.RegionID); | 224 | m_log.Debug(">> HERE, uuid: " + region.RegionID); |
223 | int n = 0; | 225 | int n = 0; |
224 | if (hash["x"] != null) | 226 | if (hash["x"] != null) |
225 | { | 227 | { |
226 | Int32.TryParse((string)hash["x"], out n); | 228 | Int32.TryParse((string)hash["x"], out n); |
227 | region.RegionLocX = n; | 229 | region.RegionLocX = n; |
228 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | 230 | m_log.Debug(">> HERE, x: " + region.RegionLocX); |
229 | } | 231 | } |
230 | if (hash["y"] != null) | 232 | if (hash["y"] != null) |
231 | { | 233 | { |
232 | Int32.TryParse((string)hash["y"], out n); | 234 | Int32.TryParse((string)hash["y"], out n); |
233 | region.RegionLocY = n; | 235 | region.RegionLocY = n; |
234 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | 236 | m_log.Debug(">> HERE, y: " + region.RegionLocY); |
235 | } | 237 | } |
236 | if (hash["region_name"] != null) | 238 | if (hash["region_name"] != null) |
237 | { | 239 | { |
238 | region.RegionName = (string)hash["region_name"]; | 240 | region.RegionName = (string)hash["region_name"]; |
239 | //m_log.Debug(">> HERE, name: " + region.RegionName); | 241 | m_log.Debug(">> HERE, region_name: " + region.RegionName); |
240 | } | 242 | } |
241 | if (hash["hostname"] != null) | 243 | if (hash["hostname"] != null) { |
242 | region.ExternalHostName = (string)hash["hostname"]; | 244 | region.ExternalHostName = (string)hash["hostname"]; |
245 | m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); | ||
246 | } | ||
243 | if (hash["http_port"] != null) | 247 | if (hash["http_port"] != null) |
244 | { | 248 | { |
245 | uint p = 0; | 249 | uint p = 0; |
246 | UInt32.TryParse((string)hash["http_port"], out p); | 250 | UInt32.TryParse((string)hash["http_port"], out p); |
247 | region.HttpPort = p; | 251 | region.HttpPort = p; |
252 | m_log.Debug(">> HERE, http_port: " + region.HttpPort); | ||
248 | } | 253 | } |
249 | if (hash["internal_port"] != null) | 254 | if (hash["internal_port"] != null) |
250 | { | 255 | { |
251 | int p = 0; | 256 | int p = 0; |
252 | Int32.TryParse((string)hash["internal_port"], out p); | 257 | Int32.TryParse((string)hash["internal_port"], out p); |
253 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); | 258 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); |
259 | m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); | ||
260 | } | ||
261 | |||
262 | if (hash["server_uri"] != null) | ||
263 | { | ||
264 | region.ServerURI = (string) hash["server_uri"]; | ||
265 | m_log.Debug(">> HERE, server_uri: " + region.ServerURI); | ||
254 | } | 266 | } |
255 | 267 | ||
256 | // Successful return | 268 | // Successful return |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 247dd7e..0c41935 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -232,12 +232,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
232 | m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); | 232 | m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); |
233 | } | 233 | } |
234 | // Add the input arguments | 234 | // Add the input arguments |
235 | args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI); | ||
235 | args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); | 236 | args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); |
236 | args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString()); | 237 | args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString()); |
237 | args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); | 238 | args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); |
238 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); | 239 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); |
239 | args["destination_name"] = OSD.FromString(destination.RegionName); | 240 | args["destination_name"] = OSD.FromString(destination.RegionName); |
240 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | 241 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); |
242 | args["destination_serveruri"] = OSD.FromString(destination.ServerURI); | ||
241 | 243 | ||
242 | // 10/3/2010 | 244 | // 10/3/2010 |
243 | // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here. | 245 | // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here. |
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index 8143b5a..4b25ac8 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs | |||
@@ -84,8 +84,7 @@ namespace OpenSim.Services.Connectors | |||
84 | if (info != null) // just to be sure | 84 | if (info != null) // just to be sure |
85 | { | 85 | { |
86 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); | 86 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); |
87 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; | 87 | XmlRpcResponse response = request.Send(info.ServerURI, 10000); |
88 | XmlRpcResponse response = request.Send(uri, 10000); | ||
89 | if (response.IsFault) | 88 | if (response.IsFault) |
90 | { | 89 | { |
91 | m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); | 90 | m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); |
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 0a982f8..9c57a40 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs | |||
@@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors | |||
87 | 87 | ||
88 | public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) | 88 | public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) |
89 | { | 89 | { |
90 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; | 90 | string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; |
91 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); | 91 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); |
92 | 92 | ||
93 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); | 93 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 4d0d53e..ea9b4b4 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs | |||
@@ -28,6 +28,9 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Collections.Specialized; | 30 | using System.Collections.Specialized; |
31 | // DEBUG ON | ||
32 | using System.Diagnostics; | ||
33 | // DEBUG OFF | ||
31 | using System.Reflection; | 34 | using System.Reflection; |
32 | using log4net; | 35 | using log4net; |
33 | using Mono.Addins; | 36 | using Mono.Addins; |
@@ -106,6 +109,80 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
106 | 109 | ||
107 | #region IAvatarService | 110 | #region IAvatarService |
108 | 111 | ||
112 | // <summary> | ||
113 | // Retrieves the LLPackedAppearance field from user data and unpacks | ||
114 | // it into an AvatarAppearance structure | ||
115 | // </summary> | ||
116 | // <param name="userID"></param> | ||
117 | public AvatarAppearance GetAppearance(UUID userID) | ||
118 | { | ||
119 | NameValueCollection requestArgs = new NameValueCollection | ||
120 | { | ||
121 | { "RequestMethod", "GetUser" }, | ||
122 | { "UserID", userID.ToString() } | ||
123 | }; | ||
124 | |||
125 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | ||
126 | if (response["Success"].AsBoolean()) | ||
127 | { | ||
128 | OSDMap map = null; | ||
129 | try { map = OSDParser.DeserializeJson(response["LLPackedAppearance"].AsString()) as OSDMap; } | ||
130 | catch { } | ||
131 | |||
132 | if (map != null) | ||
133 | { | ||
134 | AvatarAppearance appearance = new AvatarAppearance(map); | ||
135 | // DEBUG ON | ||
136 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR] retrieved appearance for {0}:\n{1}",userID,appearance.ToString()); | ||
137 | // DEBUG OFF | ||
138 | return appearance; | ||
139 | } | ||
140 | |||
141 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to decode appearance for {0}",userID); | ||
142 | return null; | ||
143 | } | ||
144 | |||
145 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to get appearance for {0}: {1}", | ||
146 | userID,response["Message"].AsString()); | ||
147 | return null; | ||
148 | } | ||
149 | |||
150 | // <summary> | ||
151 | // </summary> | ||
152 | // <param name=""></param> | ||
153 | public bool SetAppearance(UUID userID, AvatarAppearance appearance) | ||
154 | { | ||
155 | OSDMap map = appearance.Pack(); | ||
156 | if (map == null) | ||
157 | { | ||
158 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to encode appearance for {0}",userID); | ||
159 | return false; | ||
160 | } | ||
161 | |||
162 | // DEBUG ON | ||
163 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR] save appearance for {0}",userID); | ||
164 | // DEBUG OFF | ||
165 | |||
166 | NameValueCollection requestArgs = new NameValueCollection | ||
167 | { | ||
168 | { "RequestMethod", "AddUserData" }, | ||
169 | { "UserID", userID.ToString() }, | ||
170 | { "LLPackedAppearance", OSDParser.SerializeJsonString(map) } | ||
171 | }; | ||
172 | |||
173 | OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | ||
174 | bool success = response["Success"].AsBoolean(); | ||
175 | |||
176 | if (! success) | ||
177 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to save appearance for {0}: {1}", | ||
178 | userID,response["Message"].AsString()); | ||
179 | |||
180 | return success; | ||
181 | } | ||
182 | |||
183 | // <summary> | ||
184 | // </summary> | ||
185 | // <param name=""></param> | ||
109 | public AvatarData GetAvatar(UUID userID) | 186 | public AvatarData GetAvatar(UUID userID) |
110 | { | 187 | { |
111 | NameValueCollection requestArgs = new NameValueCollection | 188 | NameValueCollection requestArgs = new NameValueCollection |
@@ -154,7 +231,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
154 | foreach (KeyValuePair<string, OSD> kvp in map) | 231 | foreach (KeyValuePair<string, OSD> kvp in map) |
155 | avatar.Data[kvp.Key] = kvp.Value.AsString(); | 232 | avatar.Data[kvp.Key] = kvp.Value.AsString(); |
156 | } | 233 | } |
157 | 234 | ||
158 | return avatar; | 235 | return avatar; |
159 | } | 236 | } |
160 | else | 237 | else |
@@ -173,6 +250,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
173 | return null; | 250 | return null; |
174 | } | 251 | } |
175 | 252 | ||
253 | // <summary> | ||
254 | // </summary> | ||
255 | // <param name=""></param> | ||
176 | public bool SetAvatar(UUID userID, AvatarData avatar) | 256 | public bool SetAvatar(UUID userID, AvatarData avatar) |
177 | { | 257 | { |
178 | m_log.Debug("[SIMIAN AVATAR CONNECTOR]: SetAvatar called for " + userID); | 258 | m_log.Debug("[SIMIAN AVATAR CONNECTOR]: SetAvatar called for " + userID); |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 168b233..8076fab 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -145,8 +145,6 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
145 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); | 145 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); |
146 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); | 146 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); |
147 | 147 | ||
148 | string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/"; | ||
149 | |||
150 | OSDMap extraData = new OSDMap | 148 | OSDMap extraData = new OSDMap |
151 | { | 149 | { |
152 | { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, | 150 | { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, |
@@ -168,7 +166,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
168 | { "Name", regionInfo.RegionName }, | 166 | { "Name", regionInfo.RegionName }, |
169 | { "MinPosition", minPosition.ToString() }, | 167 | { "MinPosition", minPosition.ToString() }, |
170 | { "MaxPosition", maxPosition.ToString() }, | 168 | { "MaxPosition", maxPosition.ToString() }, |
171 | { "Address", httpAddress }, | 169 | { "Address", regionInfo.ServerURI }, |
172 | { "Enabled", "1" }, | 170 | { "Enabled", "1" }, |
173 | { "ExtraData", OSDParser.SerializeJsonString(extraData) } | 171 | { "ExtraData", OSDParser.SerializeJsonString(extraData) } |
174 | }; | 172 | }; |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index a5f748f..c4284eb 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
72 | 72 | ||
73 | protected virtual string AgentPath() | 73 | protected virtual string AgentPath() |
74 | { | 74 | { |
75 | return "/agent/"; | 75 | return "agent/"; |
76 | } | 76 | } |
77 | 77 | ||
78 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) | 78 | public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) |
@@ -104,26 +104,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
104 | return false; | 104 | return false; |
105 | } | 105 | } |
106 | 106 | ||
107 | string uri = string.Empty; | 107 | string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; |
108 | |||
109 | // HACK -- Simian grid make it work!!! | ||
110 | if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) | ||
111 | uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; | ||
112 | else | ||
113 | { | ||
114 | try | ||
115 | { | ||
116 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; | ||
117 | } | ||
118 | catch (Exception e) | ||
119 | { | ||
120 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); | ||
121 | reason = e.Message; | ||
122 | return false; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); | ||
127 | 108 | ||
128 | AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); | 109 | AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); |
129 | AgentCreateRequest.Method = "POST"; | 110 | AgentCreateRequest.Method = "POST"; |
@@ -277,17 +258,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
277 | private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) | 258 | private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) |
278 | { | 259 | { |
279 | // Eventually, we want to use a caps url instead of the agentID | 260 | // Eventually, we want to use a caps url instead of the agentID |
280 | string uri = string.Empty; | 261 | string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; |
281 | try | ||
282 | { | ||
283 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; | ||
284 | } | ||
285 | catch (Exception e) | ||
286 | { | ||
287 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); | ||
288 | return false; | ||
289 | } | ||
290 | //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); | ||
291 | 262 | ||
292 | HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); | 263 | HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); |
293 | ChildUpdateRequest.Method = "PUT"; | 264 | ChildUpdateRequest.Method = "PUT"; |
@@ -385,8 +356,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
385 | { | 356 | { |
386 | agent = null; | 357 | agent = null; |
387 | // Eventually, we want to use a caps url instead of the agentID | 358 | // Eventually, we want to use a caps url instead of the agentID |
388 | string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | 359 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; |
389 | //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); | ||
390 | 360 | ||
391 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); | 361 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); |
392 | request.Method = "GET"; | 362 | request.Method = "GET"; |
@@ -407,7 +377,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
407 | sr = new StreamReader(webResponse.GetResponseStream()); | 377 | sr = new StreamReader(webResponse.GetResponseStream()); |
408 | reply = sr.ReadToEnd().Trim(); | 378 | reply = sr.ReadToEnd().Trim(); |
409 | 379 | ||
410 | //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply); | ||
411 | 380 | ||
412 | } | 381 | } |
413 | catch (WebException ex) | 382 | catch (WebException ex) |
@@ -428,7 +397,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
428 | OSDMap args = Util.GetOSDMap(reply); | 397 | OSDMap args = Util.GetOSDMap(reply); |
429 | if (args == null) | 398 | if (args == null) |
430 | { | 399 | { |
431 | //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply"); | ||
432 | return false; | 400 | return false; |
433 | } | 401 | } |
434 | 402 | ||
@@ -437,7 +405,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
437 | return true; | 405 | return true; |
438 | } | 406 | } |
439 | 407 | ||
440 | //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); | ||
441 | return false; | 408 | return false; |
442 | } | 409 | } |
443 | 410 | ||
@@ -479,18 +446,8 @@ namespace OpenSim.Services.Connectors.Simulation | |||
479 | 446 | ||
480 | public bool CloseAgent(GridRegion destination, UUID id) | 447 | public bool CloseAgent(GridRegion destination, UUID id) |
481 | { | 448 | { |
482 | string uri = string.Empty; | 449 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; |
483 | try | ||
484 | { | ||
485 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | ||
486 | } | ||
487 | catch (Exception e) | ||
488 | { | ||
489 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); | ||
490 | return false; | ||
491 | } | ||
492 | 450 | ||
493 | //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); | ||
494 | 451 | ||
495 | WebRequest request = WebRequest.Create(uri); | 452 | WebRequest request = WebRequest.Create(uri); |
496 | request.Method = "DELETE"; | 453 | request.Method = "DELETE"; |
@@ -538,7 +495,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
538 | public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) | 495 | public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) |
539 | { | 496 | { |
540 | string uri | 497 | string uri |
541 | = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; | 498 | = destination.ServerURI + ObjectPath() + sog.UUID + "/"; |
542 | //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); | 499 | //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); |
543 | 500 | ||
544 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); | 501 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e7988d6..125c2be 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService | |||
479 | OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); | 479 | OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); |
480 | MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", | 480 | MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", |
481 | r.RegionName, r.RegionID, | 481 | r.RegionName, r.RegionID, |
482 | String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), | 482 | String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], |
483 | r.Data["owner_uuid"].ToString(), flags.ToString())); | 483 | r.Data["owner_uuid"].ToString(), flags.ToString())); |
484 | } | 484 | } |
485 | return; | 485 | return; |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index a67404f..50da1bd 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -127,11 +127,12 @@ namespace OpenSim.Services.GridService | |||
127 | 127 | ||
128 | if (MainConsole.Instance != null) | 128 | if (MainConsole.Instance != null) |
129 | { | 129 | { |
130 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", | 130 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <ServerURI> [<RemoteRegionName>]", "Link a HyperGrid Region", RunCommand); |
131 | "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", | 131 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region", |
132 | "Link a hypergrid region", RunCommand); | 132 | "legacy-link-region <Xloc> <Yloc> <RegionIP> <RegionPort> [<RemoteRegionName>]", |
133 | "Link a hypergrid region (deprecated)", RunCommand); | ||
133 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", | 134 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", |
134 | "unlink-region <local name> or <HostName>:<HttpPort> <cr>", | 135 | "unlink-region <local name>", |
135 | "Unlink a hypergrid region", RunCommand); | 136 | "Unlink a hypergrid region", RunCommand); |
136 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", | 137 | MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", |
137 | "Set local coordinate to map HG regions to", RunCommand); | 138 | "Set local coordinate to map HG regions to", RunCommand); |
@@ -204,30 +205,34 @@ namespace OpenSim.Services.GridService | |||
204 | 205 | ||
205 | return null; | 206 | return null; |
206 | } | 207 | } |
207 | 208 | ||
208 | 209 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason) | |
209 | // From the command line and the 2 above | 210 | { |
210 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, | 211 | return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason); |
211 | string externalRegionName, uint externalPort, string externalHostName, UUID ownerID, | 212 | } |
212 | out GridRegion regInfo, out string reason) | 213 | |
214 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) | ||
213 | { | 215 | { |
214 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); | 216 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); |
215 | 217 | ||
216 | reason = string.Empty; | 218 | reason = string.Empty; |
217 | regInfo = new GridRegion(); | 219 | regInfo = new GridRegion(); |
218 | regInfo.RegionName = externalRegionName; | 220 | if ( externalPort > 0) |
219 | regInfo.HttpPort = externalPort; | 221 | regInfo.HttpPort = externalPort; |
220 | regInfo.ExternalHostName = externalHostName; | 222 | else |
223 | regInfo.HttpPort = 0; | ||
224 | if ( externalHostName != null) | ||
225 | regInfo.ExternalHostName = externalHostName; | ||
226 | else | ||
227 | regInfo.ExternalHostName = "0.0.0.0"; | ||
228 | if ( serverURI != null) | ||
229 | regInfo.ServerURI = serverURI; | ||
230 | |||
221 | regInfo.RegionLocX = xloc; | 231 | regInfo.RegionLocX = xloc; |
222 | regInfo.RegionLocY = yloc; | 232 | regInfo.RegionLocY = yloc; |
223 | regInfo.ScopeID = scopeID; | 233 | regInfo.ScopeID = scopeID; |
224 | regInfo.EstateOwner = ownerID; | 234 | regInfo.EstateOwner = ownerID; |
225 | 235 | ||
226 | // Big HACK for Simian Grid !!! | ||
227 | // We need to clean up all URLs used in OpenSim !!! | ||
228 | if (externalHostName.Contains("/")) | ||
229 | regInfo.ServerURI = externalHostName; | ||
230 | |||
231 | // Check for free coordinates | 236 | // Check for free coordinates |
232 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); | 237 | GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); |
233 | if (region != null) | 238 | if (region != null) |
@@ -267,9 +272,14 @@ namespace OpenSim.Services.GridService | |||
267 | } | 272 | } |
268 | 273 | ||
269 | regInfo.RegionID = regionID; | 274 | regInfo.RegionID = regionID; |
270 | if (regInfo.RegionName == string.Empty) | ||
271 | regInfo.RegionName = regInfo.ExternalHostName; | ||
272 | 275 | ||
276 | if ( externalName == string.Empty ) | ||
277 | regInfo.RegionName = regInfo.ServerURI; | ||
278 | else | ||
279 | regInfo.RegionName = externalName; | ||
280 | |||
281 | m_log.Debug("naming linked region " + regInfo.RegionName); | ||
282 | |||
273 | // Try get the map image | 283 | // Try get the map image |
274 | //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); | 284 | //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); |
275 | // I need a texture that works for this... the one I tried doesn't seem to be working | 285 | // I need a texture that works for this... the one I tried doesn't seem to be working |
@@ -442,6 +452,21 @@ namespace OpenSim.Services.GridService | |||
442 | RunHGCommand(command, cmdparams); | 452 | RunHGCommand(command, cmdparams); |
443 | 453 | ||
444 | } | 454 | } |
455 | |||
456 | private void RunLinkRegionCommand(string[] cmdparams) | ||
457 | { | ||
458 | int xloc, yloc; | ||
459 | string serverURI; | ||
460 | string remoteName = null; | ||
461 | xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; | ||
462 | yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; | ||
463 | serverURI = cmdparams[2]; | ||
464 | if (cmdparams.Length == 4) | ||
465 | remoteName = cmdparams[3]; | ||
466 | string reason = string.Empty; | ||
467 | GridRegion regInfo; | ||
468 | TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason); | ||
469 | } | ||
445 | 470 | ||
446 | private void RunHGCommand(string command, string[] cmdparams) | 471 | private void RunHGCommand(string command, string[] cmdparams) |
447 | { | 472 | { |
@@ -465,6 +490,18 @@ namespace OpenSim.Services.GridService | |||
465 | } | 490 | } |
466 | else if (command.Equals("link-region")) | 491 | else if (command.Equals("link-region")) |
467 | { | 492 | { |
493 | if (cmdparams.Length > 0 && cmdparams.Length < 5) | ||
494 | { | ||
495 | RunLinkRegionCommand(cmdparams); | ||
496 | } | ||
497 | else | ||
498 | { | ||
499 | LinkRegionCmdUsage(); | ||
500 | } | ||
501 | return; | ||
502 | } | ||
503 | else if (command.Equals("legacy-link-region")) | ||
504 | { | ||
468 | if (cmdparams.Length < 3) | 505 | if (cmdparams.Length < 3) |
469 | { | 506 | { |
470 | if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) | 507 | if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) |
@@ -517,12 +554,16 @@ namespace OpenSim.Services.GridService | |||
517 | int xloc, yloc; | 554 | int xloc, yloc; |
518 | uint externalPort; | 555 | uint externalPort; |
519 | string externalHostName; | 556 | string externalHostName; |
557 | string serverURI; | ||
520 | try | 558 | try |
521 | { | 559 | { |
522 | xloc = Convert.ToInt32(cmdparams[0]); | 560 | xloc = Convert.ToInt32(cmdparams[0]); |
523 | yloc = Convert.ToInt32(cmdparams[1]); | 561 | yloc = Convert.ToInt32(cmdparams[1]); |
524 | externalPort = Convert.ToUInt32(cmdparams[3]); | 562 | externalPort = Convert.ToUInt32(cmdparams[3]); |
525 | externalHostName = cmdparams[2]; | 563 | externalHostName = cmdparams[2]; |
564 | if ( cmdparams.Length == 4 ) { | ||
565 | |||
566 | } | ||
526 | //internalPort = Convert.ToUInt32(cmdparams[4]); | 567 | //internalPort = Convert.ToUInt32(cmdparams[4]); |
527 | //remotingPort = Convert.ToUInt32(cmdparams[5]); | 568 | //remotingPort = Convert.ToUInt32(cmdparams[5]); |
528 | } | 569 | } |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 3f5c4f1..9e96163 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -157,7 +157,7 @@ namespace OpenSim.Services.HypergridService | |||
157 | string regionimage = "regionImage" + region.RegionID.ToString(); | 157 | string regionimage = "regionImage" + region.RegionID.ToString(); |
158 | regionimage = regionimage.Replace("-", ""); | 158 | regionimage = regionimage.Replace("-", ""); |
159 | 159 | ||
160 | imageURL = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/index.php?method=" + regionimage; | 160 | imageURL = region.ServerURI + "index.php?method=" + regionimage; |
161 | 161 | ||
162 | return true; | 162 | return true; |
163 | } | 163 | } |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index eb6433c..32b4249 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -134,23 +134,27 @@ namespace OpenSim.Services.HypergridService | |||
134 | public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason) | 134 | public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason) |
135 | { | 135 | { |
136 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", | 136 | m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", |
137 | agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), | 137 | agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); |
138 | gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); | ||
139 | |||
140 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination | 138 | // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination |
141 | GridRegion region = new GridRegion(gatekeeper); | 139 | GridRegion region = new GridRegion(gatekeeper); |
140 | region.ServerURI = gatekeeper.ServerURI; | ||
141 | region.ExternalHostName = finalDestination.ExternalHostName; | ||
142 | region.InternalEndPoint = finalDestination.InternalEndPoint; | ||
142 | region.RegionName = finalDestination.RegionName; | 143 | region.RegionName = finalDestination.RegionName; |
143 | region.RegionID = finalDestination.RegionID; | 144 | region.RegionID = finalDestination.RegionID; |
144 | region.RegionLocX = finalDestination.RegionLocX; | 145 | region.RegionLocX = finalDestination.RegionLocX; |
145 | region.RegionLocY = finalDestination.RegionLocY; | 146 | region.RegionLocY = finalDestination.RegionLocY; |
146 | 147 | ||
147 | // Generate a new service session | 148 | // Generate a new service session |
148 | agentCircuit.ServiceSessionID = "http://" + region.ExternalHostName + ":" + region.HttpPort + ";" + UUID.Random(); | 149 | agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); |
149 | TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); | 150 | TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); |
150 | 151 | ||
151 | bool success = false; | 152 | bool success = false; |
152 | string myExternalIP = string.Empty; | 153 | string myExternalIP = string.Empty; |
153 | string gridName = "http://" + gatekeeper.ExternalHostName + ":" + gatekeeper.HttpPort; | 154 | string gridName = gatekeeper.ServerURI; |
155 | |||
156 | m_log.Debug("m_grid - " + m_GridName + ", gn - " + gridName); | ||
157 | |||
154 | if (m_GridName == gridName) | 158 | if (m_GridName == gridName) |
155 | success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); | 159 | success = m_GatekeeperService.LoginAgent(agentCircuit, finalDestination, out reason); |
156 | else | 160 | else |
@@ -159,7 +163,7 @@ namespace OpenSim.Services.HypergridService | |||
159 | if (!success) | 163 | if (!success) |
160 | { | 164 | { |
161 | m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", | 165 | m_log.DebugFormat("[USER AGENT SERVICE]: Unable to login user {0} {1} to grid {2}, reason: {3}", |
162 | agentCircuit.firstname, agentCircuit.lastname, region.ExternalHostName + ":" + region.HttpPort, reason); | 166 | agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); |
163 | 167 | ||
164 | // restore the old travel info | 168 | // restore the old travel info |
165 | lock (m_TravelingAgents) | 169 | lock (m_TravelingAgents) |
@@ -210,7 +214,7 @@ namespace OpenSim.Services.HypergridService | |||
210 | m_TravelingAgents[agentCircuit.SessionID] = travel; | 214 | m_TravelingAgents[agentCircuit.SessionID] = travel; |
211 | } | 215 | } |
212 | travel.UserID = agentCircuit.AgentID; | 216 | travel.UserID = agentCircuit.AgentID; |
213 | travel.GridExternalName = "http://" + region.ExternalHostName + ":" + region.HttpPort; | 217 | travel.GridExternalName = region.ServerURI; |
214 | travel.ServiceToken = agentCircuit.ServiceSessionID; | 218 | travel.ServiceToken = agentCircuit.ServiceSessionID; |
215 | if (old != null) | 219 | if (old != null) |
216 | travel.ClientIPAddress = old.ClientIPAddress; | 220 | travel.ClientIPAddress = old.ClientIPAddress; |
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs index de3bcf9..eaa6534 100644 --- a/OpenSim/Services/Interfaces/IAvatarService.cs +++ b/OpenSim/Services/Interfaces/IAvatarService.cs | |||
@@ -42,6 +42,21 @@ namespace OpenSim.Services.Interfaces | |||
42 | /// </summary> | 42 | /// </summary> |
43 | /// <param name="userID"></param> | 43 | /// <param name="userID"></param> |
44 | /// <returns></returns> | 44 | /// <returns></returns> |
45 | AvatarAppearance GetAppearance(UUID userID); | ||
46 | |||
47 | /// <summary> | ||
48 | /// Called by everyone who can change the avatar data (so, regions) | ||
49 | /// </summary> | ||
50 | /// <param name="userID"></param> | ||
51 | /// <param name="appearance"></param> | ||
52 | /// <returns></returns> | ||
53 | bool SetAppearance(UUID userID, AvatarAppearance appearance); | ||
54 | |||
55 | /// <summary> | ||
56 | /// Called by the login service | ||
57 | /// </summary> | ||
58 | /// <param name="userID"></param> | ||
59 | /// <returns></returns> | ||
45 | AvatarData GetAvatar(UUID userID); | 60 | AvatarData GetAvatar(UUID userID); |
46 | 61 | ||
47 | /// <summary> | 62 | /// <summary> |
@@ -163,17 +178,11 @@ namespace OpenSim.Services.Interfaces | |||
163 | Data["UnderShirtAsset"] = appearance.UnderShirtAsset.ToString(); | 178 | Data["UnderShirtAsset"] = appearance.UnderShirtAsset.ToString(); |
164 | 179 | ||
165 | // Attachments | 180 | // Attachments |
166 | Hashtable attachs = appearance.GetAttachments(); | 181 | List<AvatarAttachment> attachments = appearance.GetAttachments(); |
167 | if (attachs != null) | 182 | foreach (AvatarAttachment attach in attachments) |
168 | foreach (DictionaryEntry dentry in attachs) | 183 | { |
169 | { | 184 | Data["_ap_" + attach.AttachPoint] = attach.ItemID.ToString(); |
170 | if (dentry.Value != null) | 185 | } |
171 | { | ||
172 | Hashtable tab = (Hashtable)dentry.Value; | ||
173 | if (tab.ContainsKey("item") && tab["item"] != null) | ||
174 | Data["_ap_" + dentry.Key] = tab["item"].ToString(); | ||
175 | } | ||
176 | } | ||
177 | } | 186 | } |
178 | 187 | ||
179 | public AvatarAppearance ToAvatarAppearance(UUID owner) | 188 | public AvatarAppearance ToAvatarAppearance(UUID owner) |
@@ -217,23 +226,26 @@ namespace OpenSim.Services.Interfaces | |||
217 | foreach (KeyValuePair<string, string> _kvp in Data) | 226 | foreach (KeyValuePair<string, string> _kvp in Data) |
218 | if (_kvp.Key.StartsWith("_ap_")) | 227 | if (_kvp.Key.StartsWith("_ap_")) |
219 | attchs[_kvp.Key] = _kvp.Value; | 228 | attchs[_kvp.Key] = _kvp.Value; |
220 | Hashtable aaAttachs = new Hashtable(); | 229 | |
221 | foreach (KeyValuePair<string, string> _kvp in attchs) | 230 | foreach (KeyValuePair<string, string> _kvp in attchs) |
222 | { | 231 | { |
223 | string pointStr = _kvp.Key.Substring(4); | 232 | string pointStr = _kvp.Key.Substring(4); |
224 | int point = 0; | 233 | int point = 0; |
225 | if (!Int32.TryParse(pointStr, out point)) | 234 | if (!Int32.TryParse(pointStr, out point)) |
226 | continue; | 235 | continue; |
227 | Hashtable tmp = new Hashtable(); | 236 | |
228 | UUID uuid = UUID.Zero; | 237 | UUID uuid = UUID.Zero; |
229 | UUID.TryParse(_kvp.Value, out uuid); | 238 | UUID.TryParse(_kvp.Value, out uuid); |
230 | tmp["item"] = uuid; | 239 | |
231 | tmp["asset"] = UUID.Zero.ToString(); | 240 | appearance.SetAttachment(point,uuid,UUID.Zero); |
232 | aaAttachs[point] = tmp; | ||
233 | } | 241 | } |
234 | appearance.SetAttachments(aaAttachs); | ||
235 | } | 242 | } |
236 | catch { } | 243 | catch |
244 | { | ||
245 | // We really should report something here, returning null | ||
246 | // will at least break the wrapper | ||
247 | return null; | ||
248 | } | ||
237 | 249 | ||
238 | return appearance; | 250 | return appearance; |
239 | } | 251 | } |
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 77230a3..6d3bff7 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -115,8 +115,20 @@ namespace OpenSim.Services.Interfaces | |||
115 | /// </summary> | 115 | /// </summary> |
116 | public string ServerURI | 116 | public string ServerURI |
117 | { | 117 | { |
118 | get { return m_serverURI; } | 118 | get { |
119 | set { m_serverURI = value; } | 119 | if ( m_serverURI != string.Empty ) { |
120 | return m_serverURI; | ||
121 | } else { | ||
122 | return "http://" + m_externalHostName + ":" + m_httpPort + "/"; | ||
123 | } | ||
124 | } | ||
125 | set { | ||
126 | if ( value.EndsWith("/") ) { | ||
127 | m_serverURI = value; | ||
128 | } else { | ||
129 | m_serverURI = value + '/'; | ||
130 | } | ||
131 | } | ||
120 | } | 132 | } |
121 | protected string m_serverURI; | 133 | protected string m_serverURI; |
122 | 134 | ||
@@ -164,6 +176,7 @@ namespace OpenSim.Services.Interfaces | |||
164 | 176 | ||
165 | public GridRegion() | 177 | public GridRegion() |
166 | { | 178 | { |
179 | m_serverURI = string.Empty; | ||
167 | } | 180 | } |
168 | 181 | ||
169 | public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) | 182 | public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) |
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 0da1715..f985ab2 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -333,34 +333,7 @@ namespace OpenSim.Services.LLLoginService | |||
333 | 333 | ||
334 | private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) | 334 | private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) |
335 | { | 335 | { |
336 | string capsSeedPath = String.Empty; | 336 | SeedCapability = destination.ServerURI + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); |
337 | |||
338 | // Don't use the following! It Fails for logging into any region not on the same port as the http server! | ||
339 | // Kept here so it doesn't happen again! | ||
340 | // response.SeedCapability = regionInfo.ServerURI + capsSeedPath; | ||
341 | |||
342 | #region IP Translation for NAT | ||
343 | if (ipepClient != null) | ||
344 | { | ||
345 | capsSeedPath | ||
346 | = "http://" | ||
347 | + NetworkUtil.GetHostFor(ipepClient.Address, destination.ExternalHostName) | ||
348 | + ":" | ||
349 | + destination.HttpPort | ||
350 | + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); | ||
351 | } | ||
352 | else | ||
353 | { | ||
354 | capsSeedPath | ||
355 | = "http://" | ||
356 | + destination.ExternalHostName | ||
357 | + ":" | ||
358 | + destination.HttpPort | ||
359 | + CapsUtil.GetCapsSeedPath(aCircuit.CapsPath); | ||
360 | } | ||
361 | #endregion | ||
362 | |||
363 | SeedCapability = capsSeedPath; | ||
364 | } | 337 | } |
365 | 338 | ||
366 | private void SetDefaultValues() | 339 | private void SetDefaultValues() |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 127c4b2..f6ee9ac 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -330,10 +330,10 @@ namespace OpenSim.Services.LLLoginService | |||
330 | // | 330 | // |
331 | // Get the avatar | 331 | // Get the avatar |
332 | // | 332 | // |
333 | AvatarData avatar = null; | 333 | AvatarAppearance avatar = null; |
334 | if (m_AvatarService != null) | 334 | if (m_AvatarService != null) |
335 | { | 335 | { |
336 | avatar = m_AvatarService.GetAvatar(account.PrincipalID); | 336 | avatar = m_AvatarService.GetAppearance(account.PrincipalID); |
337 | } | 337 | } |
338 | 338 | ||
339 | // | 339 | // |
@@ -566,6 +566,7 @@ namespace OpenSim.Services.LLLoginService | |||
566 | 566 | ||
567 | private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper) | 567 | private GridRegion FindForeignRegion(string domainName, uint port, string regionName, out GridRegion gatekeeper) |
568 | { | 568 | { |
569 | m_log.Debug("attempting to findforeignregion " + domainName + ":" + port.ToString() + ":" + regionName); | ||
569 | gatekeeper = new GridRegion(); | 570 | gatekeeper = new GridRegion(); |
570 | gatekeeper.ExternalHostName = domainName; | 571 | gatekeeper.ExternalHostName = domainName; |
571 | gatekeeper.HttpPort = port; | 572 | gatekeeper.HttpPort = port; |
@@ -601,7 +602,7 @@ namespace OpenSim.Services.LLLoginService | |||
601 | } | 602 | } |
602 | } | 603 | } |
603 | 604 | ||
604 | protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarData avatar, | 605 | protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarAppearance avatar, |
605 | UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, string channel, string mac, string id0, | 606 | UUID session, UUID secureSession, Vector3 position, string currentWhere, string viewer, string channel, string mac, string id0, |
606 | IPEndPoint clientIP, out string where, out string reason, out GridRegion dest) | 607 | IPEndPoint clientIP, out string where, out string reason, out GridRegion dest) |
607 | { | 608 | { |
@@ -631,11 +632,9 @@ namespace OpenSim.Services.LLLoginService | |||
631 | gatekeeper = new GridRegion(destination); | 632 | gatekeeper = new GridRegion(destination); |
632 | gatekeeper.ExternalHostName = hostName; | 633 | gatekeeper.ExternalHostName = hostName; |
633 | gatekeeper.HttpPort = (uint)port; | 634 | gatekeeper.HttpPort = (uint)port; |
634 | 635 | gatekeeper.ServerURI = m_GatekeeperURL; | |
635 | } | ||
636 | else // login to foreign grid | ||
637 | { | ||
638 | } | 636 | } |
637 | m_log.Debug("no gatekeeper detected..... using " + m_GatekeeperURL); | ||
639 | } | 638 | } |
640 | 639 | ||
641 | bool success = false; | 640 | bool success = false; |
@@ -697,14 +696,14 @@ namespace OpenSim.Services.LLLoginService | |||
697 | } | 696 | } |
698 | 697 | ||
699 | private AgentCircuitData MakeAgent(GridRegion region, UserAccount account, | 698 | private AgentCircuitData MakeAgent(GridRegion region, UserAccount account, |
700 | AvatarData avatar, UUID session, UUID secureSession, uint circuit, Vector3 position, | 699 | AvatarAppearance avatar, UUID session, UUID secureSession, uint circuit, Vector3 position, |
701 | string ipaddress, string viewer, string channel, string mac, string id0) | 700 | string ipaddress, string viewer, string channel, string mac, string id0) |
702 | { | 701 | { |
703 | AgentCircuitData aCircuit = new AgentCircuitData(); | 702 | AgentCircuitData aCircuit = new AgentCircuitData(); |
704 | 703 | ||
705 | aCircuit.AgentID = account.PrincipalID; | 704 | aCircuit.AgentID = account.PrincipalID; |
706 | if (avatar != null) | 705 | if (avatar != null) |
707 | aCircuit.Appearance = avatar.ToAvatarAppearance(account.PrincipalID); | 706 | aCircuit.Appearance = new AvatarAppearance(avatar); |
708 | else | 707 | else |
709 | aCircuit.Appearance = new AvatarAppearance(account.PrincipalID); | 708 | aCircuit.Appearance = new AvatarAppearance(account.PrincipalID); |
710 | 709 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index e46f9b7..b2c8b35 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -94,7 +94,7 @@ namespace OpenSim.Tests.Common.Mock | |||
94 | 94 | ||
95 | public event DeRezObject OnDeRezObject; | 95 | public event DeRezObject OnDeRezObject; |
96 | public event Action<IClientAPI> OnRegionHandShakeReply; | 96 | public event Action<IClientAPI> OnRegionHandShakeReply; |
97 | public event GenericCall2 OnRequestWearables; | 97 | public event GenericCall1 OnRequestWearables; |
98 | public event GenericCall1 OnCompleteMovementToRegion; | 98 | public event GenericCall1 OnCompleteMovementToRegion; |
99 | public event UpdateAgent OnPreAgentUpdate; | 99 | public event UpdateAgent OnPreAgentUpdate; |
100 | public event UpdateAgent OnAgentUpdate; | 100 | public event UpdateAgent OnAgentUpdate; |