aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs28
-rw-r--r--OpenSim/Client/MXP/ClientStack/MXPClientView.cs4
-rw-r--r--OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs4
-rw-r--r--OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs2
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs61
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs794
-rw-r--r--OpenSim/Framework/AvatarAttachment.cs (renamed from OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs)50
-rw-r--r--OpenSim/Framework/AvatarWearable.cs46
-rw-r--r--OpenSim/Framework/Capabilities/Caps.cs4
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs70
-rw-r--r--OpenSim/Framework/IClientAPI.cs6
-rw-r--r--OpenSim/Framework/Tests/AgentCircuitDataTest.cs2
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs16
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs237
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs11
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs162
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs16
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs11
-rw-r--r--OpenSim/Services/AvatarService/AvatarService.cs14
-rw-r--r--OpenSim/Services/Connectors/Avatar/AvatarServiceConnector.cs12
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs82
-rw-r--r--OpenSim/Services/Interfaces/IAvatarService.cs32
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs10
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs2
-rw-r--r--bin/assets/TexturesAssetSet/TexturesAssetSet.xml6
-rw-r--r--bin/inventory/BodyPartsLibrary/BodyPartsLibraryItems.xml28
31 files changed, 967 insertions, 766 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index aeed467..0589748 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 Dictionary<int, AvatarAttachment> attachments = avatarAppearance.Attachments;
1623 1618
1624 foreach (KeyValuePair<int, UUID[]> attachment in attachments) 1619 foreach (KeyValuePair<int, AvatarAttachment> attachment in attachments)
1625 { 1620 {
1626 int attachpoint = attachment.Key; 1621 int attachpoint = attachment.Value.AttachPoint;
1627 UUID itemID = attachment.Value[0]; 1622 UUID itemID = attachment.Value.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/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..be98380 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -26,7 +26,9 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
29using System.Collections.Generic; 30using System.Collections.Generic;
31using log4net;
30using OpenMetaverse; 32using OpenMetaverse;
31using OpenMetaverse.StructuredData; 33using 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>
@@ -205,6 +213,7 @@ namespace OpenSim.Framework
205 args["mac"] = OSD.FromString(Mac); 213 args["mac"] = OSD.FromString(Mac);
206 args["id0"] = OSD.FromString(Id0); 214 args["id0"] = OSD.FromString(Id0);
207 215
216/*
208 if (Appearance != null) 217 if (Appearance != null)
209 { 218 {
210 //System.Console.WriteLine("XXX Before packing Wearables"); 219 //System.Console.WriteLine("XXX Before packing Wearables");
@@ -221,20 +230,26 @@ namespace OpenSim.Framework
221 } 230 }
222 231
223 //System.Console.WriteLine("XXX Before packing Attachments"); 232 //System.Console.WriteLine("XXX Before packing Attachments");
224 Dictionary<int, UUID[]> attachments = Appearance.GetAttachmentDictionary(); 233 Dictionary<int, AvatarAttachment> attachments = Appearance.Attachments;
225 if ((attachments != null) && (attachments.Count > 0)) 234 if ((attachments != null) && (attachments.Count > 0))
226 { 235 {
227 OSDArray attachs = new OSDArray(attachments.Count); 236 OSDArray attachs = new OSDArray(attachments.Count);
228 foreach (KeyValuePair<int, UUID[]> kvp in attachments) 237 foreach (KeyValuePair<int, AvatarAttachment> kvp in attachments)
229 { 238 {
230 AttachmentData adata = new AttachmentData(kvp.Key, kvp.Value[0], kvp.Value[1]); 239 AvatarAttachment adata = new AvatarAttachment(kvp.Value);
231 attachs.Add(adata.PackUpdateMessage()); 240 attachs.Add(adata.Pack());
232 //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]); 241 //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]);
233 } 242 }
234 args["attachments"] = attachs; 243 args["attachments"] = attachs;
235 } 244 }
236 } 245 }
237 246*/
247 if (Appearance != null)
248 {
249 OSDMap appmap = Appearance.Pack();
250 args["packed_appearance"] = appmap;
251 }
252
238 if (ServiceURLs != null && ServiceURLs.Count > 0) 253 if (ServiceURLs != null && ServiceURLs.Count > 0)
239 { 254 {
240 OSDArray urls = new OSDArray(ServiceURLs.Count * 2); 255 OSDArray urls = new OSDArray(ServiceURLs.Count * 2);
@@ -317,9 +332,37 @@ namespace OpenSim.Framework
317 if (args["start_pos"] != null) 332 if (args["start_pos"] != null)
318 Vector3.TryParse(args["start_pos"].AsString(), out startpos); 333 Vector3.TryParse(args["start_pos"].AsString(), out startpos);
319 334
335// DEBUG ON
336 m_log.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString());
337// DEBUG OFF
338
339 try {
340 // Unpack various appearance elements
320 Appearance = new AvatarAppearance(AgentID); 341 Appearance = new AvatarAppearance(AgentID);
342 if (args["packed_appearance"] != null)
343 {
344 if (args["packed_appearance"].Type == OSDType.Map)
345 {
346 Appearance.Unpack((OSDMap)args["packed_appearance"]);
347 m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance");
348 }
349 else
350 m_log.WarnFormat("[AGENTCIRCUITDATA] packed_appearance is not a map:\n{0}",args["packed_appearance"].ToString());
351 }
352// DEBUG ON
353 else
354 m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance");
355// DEBUG OFF
356 } catch (Exception e)
357 {
358 m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message);
359 }
360
361
362/*
321 if (args["appearance_serial"] != null) 363 if (args["appearance_serial"] != null)
322 Appearance.Serial = args["appearance_serial"].AsInteger(); 364 Appearance.Serial = args["appearance_serial"].AsInteger();
365
323 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) 366 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
324 { 367 {
325 OSDArray wears = (OSDArray)(args["wearables"]); 368 OSDArray wears = (OSDArray)(args["wearables"]);
@@ -328,23 +371,23 @@ namespace OpenSim.Framework
328 Appearance.Wearables[i].ItemID = wears[i*2].AsUUID(); 371 Appearance.Wearables[i].ItemID = wears[i*2].AsUUID();
329 Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID(); 372 Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID();
330 } 373 }
331 } 374 }
332 375
333 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) 376 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
334 { 377 {
335 OSDArray attachs = (OSDArray)(args["attachments"]); 378 OSDArray attachs = (OSDArray)(args["attachments"]);
336 AttachmentData[] attachments = new AttachmentData[attachs.Count]; 379 AvatarAttachment[] attachments = new AvatarAttachment[attachs.Count];
337 int i = 0; 380 int i = 0;
338 foreach (OSD o in attachs) 381 foreach (OSD o in attachs)
339 { 382 {
340 if (o.Type == OSDType.Map) 383 if (o.Type == OSDType.Map)
341 { 384 {
342 attachments[i++] = new AttachmentData((OSDMap)o); 385 attachments[i++] = new AvatarAttachment((OSDMap)o);
343 } 386 }
344 } 387 }
345 Appearance.SetAttachments(attachments); 388 Appearance.SetAttachments(attachments);
346 } 389 }
347 390*/
348 ServiceURLs = new Dictionary<string, object>(); 391 ServiceURLs = new Dictionary<string, object>();
349 if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) 392 if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array)
350 { 393 {
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 829ad79..55646dd 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -26,163 +26,40 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
29using System.Collections; 30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using OpenMetaverse; 32using OpenMetaverse;
33using OpenMetaverse.StructuredData;
34using log4net;
32 35
33namespace OpenSim.Framework 36namespace OpenSim.Framework
34{ 37{
35 // A special dictionary for avatar appearance
36 public struct LayerItem
37 {
38 public UUID ItemID;
39 public UUID AssetID;
40
41 public LayerItem(UUID itemID, UUID assetID)
42 {
43 ItemID = itemID;
44 AssetID = assetID;
45 }
46 }
47
48 public class Layer
49 {
50 protected int m_layerType;
51 protected Dictionary<UUID, UUID> m_items = new Dictionary<UUID, UUID>();
52 protected List<UUID> m_ids = new List<UUID>();
53
54 public Layer(int type)
55 {
56 m_layerType = type;
57 }
58
59 public int LayerType
60 {
61 get { return m_layerType; }
62 }
63
64 public int Count
65 {
66 get { return m_ids.Count; }
67 }
68
69 public void Add(UUID itemID, UUID assetID)
70 {
71 if (m_items.ContainsKey(itemID))
72 return;
73 if (m_ids.Count >= 5)
74 return;
75
76 m_ids.Add(itemID);
77 m_items[itemID] = assetID;
78 }
79
80 public void Wear(UUID itemID, UUID assetID)
81 {
82 Clear();
83 Add(itemID, assetID);
84 }
85
86 public void Clear()
87 {
88 m_ids.Clear();
89 m_items.Clear();
90 }
91
92 public void RemoveItem(UUID itemID)
93 {
94 if (m_items.ContainsKey(itemID))
95 {
96 m_ids.Remove(itemID);
97 m_items.Remove(itemID);
98 }
99 }
100
101 public void RemoveAsset(UUID assetID)
102 {
103 UUID itemID = UUID.Zero;
104
105 foreach (KeyValuePair<UUID, UUID> kvp in m_items)
106 {
107 if (kvp.Value == assetID)
108 {
109 itemID = kvp.Key;
110 break;
111 }
112 }
113
114 if (itemID != UUID.Zero)
115 {
116 m_ids.Remove(itemID);
117 m_items.Remove(itemID);
118 }
119 }
120
121 public LayerItem this [int idx]
122 {
123 get
124 {
125 if (idx >= m_ids.Count || idx < 0)
126 return new LayerItem(UUID.Zero, UUID.Zero);
127
128 return new LayerItem(m_ids[idx], m_items[m_ids[idx]]);
129 }
130 }
131 }
132
133 public enum AppearanceLayer
134 {
135 BODY = 0,
136 SKIN = 1,
137 HAIR = 2,
138 EYES = 3,
139 SHIRT = 4,
140 PANTS = 5,
141 SHOES = 6,
142 SOCKS = 7,
143 JACKET = 8,
144 GLOVES = 9,
145 UNDERSHIRT = 10,
146 UNDERPANTS = 11,
147 SKIRT = 12,
148 ALPHA = 13,
149 TATTOO = 14,
150
151 MAX_WEARABLES = 15
152 }
153
154 /// <summary> 38 /// <summary>
155 /// Contains the Avatar's Appearance and methods to manipulate the appearance. 39 /// Contains the Avatar's Appearance and methods to manipulate the appearance.
156 /// </summary> 40 /// </summary>
157 public class AvatarAppearance 41 public class AvatarAppearance
158 { 42 {
159 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
160
161 private static UUID BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
162 private static UUID BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
163 private static UUID SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb");
164 private static UUID SKIN_ITEM = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9");
165 private static UUID SHIRT_ASSET = new UUID("00000000-38f9-1111-024e-222222111110");
166 private static UUID SHIRT_ITEM = new UUID("77c41e39-38f9-f75a-0000-585989bf0000");
167 private static UUID PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120");
168 private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111");
169 private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66");
170 private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66");
171 private static UUID ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594");
172 private static UUID TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007");
173 private static UUID ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8");
174 private static UUID TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1");
175 44
176 public readonly static int VISUALPARAM_COUNT = 218; 45 public readonly static int VISUALPARAM_COUNT = 218;
177 46
47 public readonly static int TEXTURE_COUNT = 21;
48
178 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, AvatarAttachment> m_attachments;
55 protected float m_avatarHeight = 0;
56 protected float m_hipOffset = 0;
179 57
180 public virtual UUID Owner 58 public virtual UUID Owner
181 { 59 {
182 get { return m_owner; } 60 get { return m_owner; }
183 set { m_owner = value; } 61 set { m_owner = value; }
184 } 62 }
185 protected int m_serial = 1;
186 63
187 public virtual int Serial 64 public virtual int Serial
188 { 65 {
@@ -190,15 +67,17 @@ namespace OpenSim.Framework
190 set { m_serial = value; } 67 set { m_serial = value; }
191 } 68 }
192 69
193 protected byte[] m_visualparams;
194
195 public virtual byte[] VisualParams 70 public virtual byte[] VisualParams
196 { 71 {
197 get { return m_visualparams; } 72 get { return m_visualparams; }
198 set { m_visualparams = value; } 73 set { m_visualparams = value; }
199 } 74 }
200 75
201 protected AvatarWearable[] m_wearables; 76 public virtual Primitive.TextureEntry Texture
77 {
78 get { return m_texture; }
79 set { m_texture = value; }
80 }
202 81
203 public virtual AvatarWearable[] Wearables 82 public virtual AvatarWearable[] Wearables
204 { 83 {
@@ -206,183 +85,141 @@ namespace OpenSim.Framework
206 set { m_wearables = value; } 85 set { m_wearables = value; }
207 } 86 }
208 87
88 public virtual Dictionary<int, AvatarAttachment> Attachments
89 {
90 get { return m_attachments; }
91 }
92
209 public virtual UUID BodyItem { 93 public virtual UUID BodyItem {
210 get { return m_wearables[(int)AppearanceLayer.BODY].ItemID; } 94 get { return m_wearables[AvatarWearable.BODY].ItemID; }
211 set { m_wearables[(int)AppearanceLayer.BODY].ItemID = value; } 95 set { m_wearables[AvatarWearable.BODY].ItemID = value; }
212 } 96 }
213 97
214 public virtual UUID BodyAsset { 98 public virtual UUID BodyAsset {
215 get { return m_wearables[(int)AppearanceLayer.BODY].AssetID; } 99 get { return m_wearables[AvatarWearable.BODY].AssetID; }
216 set { m_wearables[(int)AppearanceLayer.BODY].AssetID = value; } 100 set { m_wearables[AvatarWearable.BODY].AssetID = value; }
217 } 101 }
218 102
219 public virtual UUID SkinItem { 103 public virtual UUID SkinItem {
220 get { return m_wearables[(int)AppearanceLayer.SKIN].ItemID; } 104 get { return m_wearables[AvatarWearable.SKIN].ItemID; }
221 set { m_wearables[(int)AppearanceLayer.SKIN].ItemID = value; } 105 set { m_wearables[AvatarWearable.SKIN].ItemID = value; }
222 } 106 }
223 107
224 public virtual UUID SkinAsset { 108 public virtual UUID SkinAsset {
225 get { return m_wearables[(int)AppearanceLayer.SKIN].AssetID; } 109 get { return m_wearables[AvatarWearable.SKIN].AssetID; }
226 set { m_wearables[(int)AppearanceLayer.SKIN].AssetID = value; } 110 set { m_wearables[AvatarWearable.SKIN].AssetID = value; }
227 } 111 }
228 112
229 public virtual UUID HairItem { 113 public virtual UUID HairItem {
230 get { return m_wearables[(int)AppearanceLayer.HAIR].ItemID; } 114 get { return m_wearables[AvatarWearable.HAIR].ItemID; }
231 set { m_wearables[(int)AppearanceLayer.HAIR].ItemID = value; } 115 set { m_wearables[AvatarWearable.HAIR].ItemID = value; }
232 } 116 }
233 117
234 public virtual UUID HairAsset { 118 public virtual UUID HairAsset {
235 get { return m_wearables[(int)AppearanceLayer.HAIR].AssetID; } 119 get { return m_wearables[AvatarWearable.HAIR].AssetID; }
236 set { m_wearables[(int)AppearanceLayer.HAIR].AssetID = value; } 120 set { m_wearables[AvatarWearable.HAIR].AssetID = value; }
237 } 121 }
238 122
239 public virtual UUID EyesItem { 123 public virtual UUID EyesItem {
240 get { return m_wearables[(int)AppearanceLayer.EYES].ItemID; } 124 get { return m_wearables[AvatarWearable.EYES].ItemID; }
241 set { m_wearables[(int)AppearanceLayer.EYES].ItemID = value; } 125 set { m_wearables[AvatarWearable.EYES].ItemID = value; }
242 } 126 }
243 127
244 public virtual UUID EyesAsset { 128 public virtual UUID EyesAsset {
245 get { return m_wearables[(int)AppearanceLayer.EYES].AssetID; } 129 get { return m_wearables[AvatarWearable.EYES].AssetID; }
246 set { m_wearables[(int)AppearanceLayer.EYES].AssetID = value; } 130 set { m_wearables[AvatarWearable.EYES].AssetID = value; }
247 } 131 }
248 132
249 public virtual UUID ShirtItem { 133 public virtual UUID ShirtItem {
250 get { return m_wearables[(int)AppearanceLayer.SHIRT].ItemID; } 134 get { return m_wearables[AvatarWearable.SHIRT].ItemID; }
251 set { m_wearables[(int)AppearanceLayer.SHIRT].ItemID = value; } 135 set { m_wearables[AvatarWearable.SHIRT].ItemID = value; }
252 } 136 }
253 137
254 public virtual UUID ShirtAsset { 138 public virtual UUID ShirtAsset {
255 get { return m_wearables[(int)AppearanceLayer.SHIRT].AssetID; } 139 get { return m_wearables[AvatarWearable.SHIRT].AssetID; }
256 set { m_wearables[(int)AppearanceLayer.SHIRT].AssetID = value; } 140 set { m_wearables[AvatarWearable.SHIRT].AssetID = value; }
257 } 141 }
258 142
259 public virtual UUID PantsItem { 143 public virtual UUID PantsItem {
260 get { return m_wearables[(int)AppearanceLayer.PANTS].ItemID; } 144 get { return m_wearables[AvatarWearable.PANTS].ItemID; }
261 set { m_wearables[(int)AppearanceLayer.PANTS].ItemID = value; } 145 set { m_wearables[AvatarWearable.PANTS].ItemID = value; }
262 } 146 }
263 147
264 public virtual UUID PantsAsset { 148 public virtual UUID PantsAsset {
265 get { return m_wearables[(int)AppearanceLayer.PANTS].AssetID; } 149 get { return m_wearables[AvatarWearable.PANTS].AssetID; }
266 set { m_wearables[(int)AppearanceLayer.PANTS].AssetID = value; } 150 set { m_wearables[AvatarWearable.PANTS].AssetID = value; }
267 } 151 }
268 152
269 public virtual UUID ShoesItem { 153 public virtual UUID ShoesItem {
270 get { return m_wearables[(int)AppearanceLayer.SHOES].ItemID; } 154 get { return m_wearables[AvatarWearable.SHOES].ItemID; }
271 set { m_wearables[(int)AppearanceLayer.SHOES].ItemID = value; } 155 set { m_wearables[AvatarWearable.SHOES].ItemID = value; }
272 } 156 }
273 157
274 public virtual UUID ShoesAsset { 158 public virtual UUID ShoesAsset {
275 get { return m_wearables[(int)AppearanceLayer.SHOES].AssetID; } 159 get { return m_wearables[AvatarWearable.SHOES].AssetID; }
276 set { m_wearables[(int)AppearanceLayer.SHOES].AssetID = value; } 160 set { m_wearables[AvatarWearable.SHOES].AssetID = value; }
277 } 161 }
278 162
279 public virtual UUID SocksItem { 163 public virtual UUID SocksItem {
280 get { return m_wearables[(int)AppearanceLayer.SOCKS].ItemID; } 164 get { return m_wearables[AvatarWearable.SOCKS].ItemID; }
281 set { m_wearables[(int)AppearanceLayer.SOCKS].ItemID = value; } 165 set { m_wearables[AvatarWearable.SOCKS].ItemID = value; }
282 } 166 }
283 167
284 public virtual UUID SocksAsset { 168 public virtual UUID SocksAsset {
285 get { return m_wearables[(int)AppearanceLayer.SOCKS].AssetID; } 169 get { return m_wearables[AvatarWearable.SOCKS].AssetID; }
286 set { m_wearables[(int)AppearanceLayer.SOCKS].AssetID = value; } 170 set { m_wearables[AvatarWearable.SOCKS].AssetID = value; }
287 } 171 }
288 172
289 public virtual UUID JacketItem { 173 public virtual UUID JacketItem {
290 get { return m_wearables[(int)AppearanceLayer.JACKET].ItemID; } 174 get { return m_wearables[AvatarWearable.JACKET].ItemID; }
291 set { m_wearables[(int)AppearanceLayer.JACKET].ItemID = value; } 175 set { m_wearables[AvatarWearable.JACKET].ItemID = value; }
292 } 176 }
293 177
294 public virtual UUID JacketAsset { 178 public virtual UUID JacketAsset {
295 get { return m_wearables[(int)AppearanceLayer.JACKET].AssetID; } 179 get { return m_wearables[AvatarWearable.JACKET].AssetID; }
296 set { m_wearables[(int)AppearanceLayer.JACKET].AssetID = value; } 180 set { m_wearables[AvatarWearable.JACKET].AssetID = value; }
297 } 181 }
298 182
299 public virtual UUID GlovesItem { 183 public virtual UUID GlovesItem {
300 get { return m_wearables[(int)AppearanceLayer.GLOVES].ItemID; } 184 get { return m_wearables[AvatarWearable.GLOVES].ItemID; }
301 set { m_wearables[(int)AppearanceLayer.GLOVES].ItemID = value; } 185 set { m_wearables[AvatarWearable.GLOVES].ItemID = value; }
302 } 186 }
303 187
304 public virtual UUID GlovesAsset { 188 public virtual UUID GlovesAsset {
305 get { return m_wearables[(int)AppearanceLayer.GLOVES].AssetID; } 189 get { return m_wearables[AvatarWearable.GLOVES].AssetID; }
306 set { m_wearables[(int)AppearanceLayer.GLOVES].AssetID = value; } 190 set { m_wearables[AvatarWearable.GLOVES].AssetID = value; }
307 } 191 }
308 192
309 public virtual UUID UnderShirtItem { 193 public virtual UUID UnderShirtItem {
310 get { return m_wearables[(int)AppearanceLayer.UNDERSHIRT].ItemID; } 194 get { return m_wearables[AvatarWearable.UNDERSHIRT].ItemID; }
311 set { m_wearables[(int)AppearanceLayer.UNDERSHIRT].ItemID = value; } 195 set { m_wearables[AvatarWearable.UNDERSHIRT].ItemID = value; }
312 } 196 }
313 197
314 public virtual UUID UnderShirtAsset { 198 public virtual UUID UnderShirtAsset {
315 get { return m_wearables[(int)AppearanceLayer.UNDERSHIRT].AssetID; } 199 get { return m_wearables[AvatarWearable.UNDERSHIRT].AssetID; }
316 set { m_wearables[(int)AppearanceLayer.UNDERSHIRT].AssetID = value; } 200 set { m_wearables[AvatarWearable.UNDERSHIRT].AssetID = value; }
317 } 201 }
318 202
319 public virtual UUID UnderPantsItem { 203 public virtual UUID UnderPantsItem {
320 get { return m_wearables[(int)AppearanceLayer.UNDERPANTS].ItemID; } 204 get { return m_wearables[AvatarWearable.UNDERPANTS].ItemID; }
321 set { m_wearables[(int)AppearanceLayer.UNDERPANTS].ItemID = value; } 205 set { m_wearables[AvatarWearable.UNDERPANTS].ItemID = value; }
322 } 206 }
323 207
324 public virtual UUID UnderPantsAsset { 208 public virtual UUID UnderPantsAsset {
325 get { return m_wearables[(int)AppearanceLayer.UNDERPANTS].AssetID; } 209 get { return m_wearables[AvatarWearable.UNDERPANTS].AssetID; }
326 set { m_wearables[(int)AppearanceLayer.UNDERPANTS].AssetID = value; } 210 set { m_wearables[AvatarWearable.UNDERPANTS].AssetID = value; }
327 } 211 }
328 212
329 public virtual UUID SkirtItem { 213 public virtual UUID SkirtItem {
330 get { return m_wearables[(int)AppearanceLayer.SKIRT].ItemID; } 214 get { return m_wearables[AvatarWearable.SKIRT].ItemID; }
331 set { m_wearables[(int)AppearanceLayer.SKIRT].ItemID = value; } 215 set { m_wearables[AvatarWearable.SKIRT].ItemID = value; }
332 } 216 }
333 217
334 public virtual UUID SkirtAsset { 218 public virtual UUID SkirtAsset {
335 get { return m_wearables[(int)AppearanceLayer.SKIRT].AssetID; } 219 get { return m_wearables[AvatarWearable.SKIRT].AssetID; }
336 set { m_wearables[(int)AppearanceLayer.SKIRT].AssetID = value; } 220 set { m_wearables[AvatarWearable.SKIRT].AssetID = value; }
337 }
338
339 public virtual void SetDefaultWearables()
340 {
341 m_wearables[(int)AppearanceLayer.BODY].AssetID = BODY_ASSET;
342 m_wearables[(int)AppearanceLayer.BODY].ItemID = BODY_ITEM;
343 m_wearables[(int)AppearanceLayer.SKIN].AssetID = SKIN_ASSET;
344 m_wearables[(int)AppearanceLayer.SKIN].ItemID = SKIN_ITEM;
345 m_wearables[(int)AppearanceLayer.HAIR].AssetID = HAIR_ASSET;
346 m_wearables[(int)AppearanceLayer.HAIR].ItemID = HAIR_ITEM;
347 m_wearables[(int)AppearanceLayer.SHIRT].AssetID = SHIRT_ASSET;
348 m_wearables[(int)AppearanceLayer.SHIRT].ItemID = SHIRT_ITEM;
349 m_wearables[(int)AppearanceLayer.PANTS].AssetID = PANTS_ASSET;
350 m_wearables[(int)AppearanceLayer.PANTS].ItemID = PANTS_ITEM;
351 m_wearables[(int)AppearanceLayer.ALPHA].AssetID = ALPHA_ASSET;
352 m_wearables[(int)AppearanceLayer.ALPHA].ItemID = ALPHA_ITEM;
353 m_wearables[(int)AppearanceLayer.TATTOO].AssetID = TATTOO_ASSET;
354 m_wearables[(int)AppearanceLayer.TATTOO].ItemID = TATTOO_ITEM;
355 }
356
357 public virtual void ClearWearables()
358 {
359 for (int i = 0; i < m_wearables.Length ; i++)
360 {
361 m_wearables[i].AssetID = UUID.Zero;
362 m_wearables[i].ItemID = UUID.Zero;
363 }
364 }
365
366 public virtual void SetDefaultParams(byte[] vparams)
367 {
368 // TODO: Figure out better values then 'fat scientist 150' or 'alien 0'
369 for (int i = 0; i < VISUALPARAM_COUNT; i++)
370 {
371 vparams[i] = 150;
372 }
373 }
374
375 protected Primitive.TextureEntry m_texture;
376
377 public virtual Primitive.TextureEntry Texture
378 {
379 get { return m_texture; }
380 set { m_texture = value; }
381 } 221 }
382 222
383 protected float m_avatarHeight = 0;
384 protected float m_hipOffset = 0;
385
386 public virtual float AvatarHeight 223 public virtual float AvatarHeight
387 { 224 {
388 get { return m_avatarHeight; } 225 get { return m_avatarHeight; }
@@ -398,41 +235,213 @@ namespace OpenSim.Framework
398 235
399 public AvatarAppearance(UUID owner) 236 public AvatarAppearance(UUID owner)
400 { 237 {
401 m_wearables = new AvatarWearable[(int)AppearanceLayer.MAX_WEARABLES]; 238// DEBUG ON
402 for (int i = 0; i < (int)AppearanceLayer.MAX_WEARABLES; i++) 239 m_log.WarnFormat("[AVATAR APPEARANCE] create empty appearance for {0}",owner);
403 { 240// DEBUG OFF
404 // this makes them all null
405 m_wearables[i] = new AvatarWearable();
406 }
407 m_serial = 0; 241 m_serial = 0;
408 m_owner = owner; 242 m_owner = owner;
409 //BuildVisualParamEnum() 243
410 m_visualparams = new byte[VISUALPARAM_COUNT];
411 // This sets Visual Params with *less* weirder values then default. Instead of a ugly alien, it looks like a fat scientist
412 SetDefaultParams(m_visualparams);
413 SetDefaultWearables(); 244 SetDefaultWearables();
414 m_texture = GetDefaultTexture(); 245 SetDefaultTexture();
246 SetDefaultParams();
247 SetHeight();
248
249 m_attachments = new Dictionary<int, AvatarAttachment>();
415 } 250 }
416 251
417 public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, byte[] visualParams) 252 public AvatarAppearance(UUID avatarID, OSDMap map)
418 { 253 {
254// DEBUG ON
255 m_log.WarnFormat("[AVATAR APPEARANCE] create appearance for {0} from OSDMap",avatarID);
256// DEBUG OFF
419 m_owner = avatarID; 257 m_owner = avatarID;
420 m_serial = 1; 258 Unpack(map);
421 m_wearables = wearables; 259 SetHeight();
422 m_visualparams = visualParams;
423 m_texture = GetDefaultTexture();
424 } 260 }
425 261
426 /// <summary> 262 public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
427 /// Set up appearance textures and avatar parameters, including a height calculation
428 /// </summary>
429 public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams)
430 { 263 {
264// DEBUG ON
265 m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID);
266// DEBUG OFF
267 m_serial = 1;
268 m_owner = avatarID;
269
270 if (wearables != null)
271 m_wearables = wearables;
272 else
273 SetDefaultWearables();
274
431 if (textureEntry != null) 275 if (textureEntry != null)
432 m_texture = textureEntry; 276 m_texture = textureEntry;
277 else
278 SetDefaultTexture();
279
433 if (visualParams != null) 280 if (visualParams != null)
434 m_visualparams = visualParams; 281 m_visualparams = visualParams;
282 else
283 SetDefaultParams();
284
285 SetHeight();
286
287 m_attachments = new Dictionary<int, AvatarAttachment>();
288 }
289
290 public AvatarAppearance(AvatarAppearance appearance)
291 {
292// DEBUG ON
293 m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance");
294// DEBUG OFF
295 if (appearance == null)
296 {
297 m_serial = 0;
298 m_owner = UUID.Zero;
299
300 SetDefaultWearables();
301 SetDefaultTexture();
302 SetDefaultParams();
303 SetHeight();
304
305 m_attachments = new Dictionary<int, AvatarAttachment>();
306
307 return;
308 }
309
310 m_serial = appearance.Serial;
311 m_owner = appearance.Owner;
312
313 m_wearables = null;
314 if (appearance.Wearables != null)
315 {
316 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 13 of these
317 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
318 SetWearable(i,appearance.Wearables[i]);
319 }
320
321 m_texture = null;
322 if (appearance.Texture != null)
323 {
324 byte[] tbytes = appearance.Texture.GetBytes();
325 m_texture = new Primitive.TextureEntry(tbytes,0,tbytes.Length);
326 }
327
328 m_visualparams = null;
329 if (appearance.VisualParams != null)
330 m_visualparams = (byte[])appearance.VisualParams.Clone();
331
332 m_attachments = new Dictionary<int, AvatarAttachment>();
333 foreach (KeyValuePair<int, AvatarAttachment> kvp in appearance.Attachments)
334 m_attachments[kvp.Key] = new AvatarAttachment(kvp.Value);
335 }
336
337 protected virtual void SetDefaultWearables()
338 {
339 m_wearables = AvatarWearable.DefaultWearables;
340 }
341
342 protected virtual void SetDefaultParams()
343 {
344 m_visualparams = new byte[VISUALPARAM_COUNT];
345 for (int i = 0; i < VISUALPARAM_COUNT; i++)
346 {
347 m_visualparams[i] = 150;
348 }
349 }
350
351 protected virtual void SetDefaultTexture()
352 {
353 m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
354 // The initialization of these seems to force a rebake regardless of whether it is needed
355 // m_textures.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012");
356 // m_textures.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID;
357 // m_textures.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID;
358 // m_textures.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77");
359 // m_textures.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B");
360 // m_textures.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010");
361 // m_textures.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011");
362 }
363
364 /// <summary>
365 /// Set up appearance textures.
366 /// Returns boolean that indicates whether the new entries actually change the
367 /// existing values.
368 /// </summary>
369 public virtual bool SetTextureEntries(Primitive.TextureEntry textureEntry)
370 {
371 if (textureEntry == null)
372 return false;
373
374 // There are much simpler versions of this copy that could be
375 // made. We determine if any of the textures actually
376 // changed to know if the appearance should be saved later
377 bool changed = false;
378 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
379 {
380 Primitive.TextureEntryFace newface = textureEntry.FaceTextures[i];
381 Primitive.TextureEntryFace oldface = m_texture.FaceTextures[i];
382
383 if (newface == null)
384 {
385 if (oldface == null) continue;
386 }
387 else
388 {
389 if (oldface != null && oldface.TextureID == newface.TextureID) continue;
390 }
391
392 m_texture.FaceTextures[i] = (newface != null) ? new Primitive.TextureEntryFace(newface) : null;
393 changed = true;
394// DEBUG ON
395 if (newface != null)
396 m_log.WarnFormat("[SCENEPRESENCE] index {0}, new texture id {1}",i,newface.TextureID);
397// DEBUG OFF
398 }
399
400 return changed;
401 }
402
403 /// <summary>
404 /// Set up visual parameters for the avatar and refresh the avatar height
405 /// Returns boolean that indicates whether the new entries actually change the
406 /// existing values.
407 /// </summary>
408 public virtual bool SetVisualParams(byte[] visualParams)
409 {
410 if (visualParams == null)
411 return false;
412
413 // There are much simpler versions of this copy that could be
414 // made. We determine if any of the visual parameters actually
415 // changed to know if the appearance should be saved later
416 bool changed = false;
417 for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++)
418 {
419 if (visualParams[i] != m_visualparams[i])
420 {
421// DEBUG ON
422 m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}",
423 i,m_visualparams[i],visualParams[i]);
424// DEBUG OFF
425 m_visualparams[i] = visualParams[i];
426 changed = true;
427 }
428 }
429
430 // Reset the height if the visual parameters actually changed
431 if (changed)
432 SetHeight();
435 433
434 return changed;
435 }
436
437 public virtual void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams)
438 {
439 SetTextureEntries(textureEntry);
440 SetVisualParams(visualParams);
441 }
442
443 public virtual void SetHeight()
444 {
436 m_avatarHeight = 1.23077f // Shortest possible avatar height 445 m_avatarHeight = 1.23077f // Shortest possible avatar height
437 + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height 446 + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height
438 + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size 447 + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size
@@ -440,102 +449,63 @@ namespace OpenSim.Framework
440 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height 449 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height
441 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height 450 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height
442 + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length 451 + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length
452
443 m_hipOffset = (((1.23077f // Half of avatar 453 m_hipOffset = (((1.23077f // Half of avatar
444 + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height 454 + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height
445 + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length 455 + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length
446 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height 456 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height
447 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height 457 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height
448 ) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f; 458 ) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f;
449
450
451
452 //System.Console.WriteLine(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}" + m_avatarHeight + " " + m_hipOffset);
453 //m_log.Debug("------------- Set Appearance Texture ---------------");
454 //Primitive.TextureEntryFace[] faces = Texture.FaceTextures;
455 //foreach (Primitive.TextureEntryFace face in faces)
456 //{
457 // if (face != null)
458 // m_log.Debug(" ++ " + face.TextureID);
459 // else
460 // m_log.Debug(" ++ NULL ");
461 //}
462 //m_log.Debug("----------------------------");
463
464 } 459 }
465 460
466 public virtual void SetWearable(int wearableId, AvatarWearable wearable) 461 public virtual void SetWearable(int wearableId, AvatarWearable wearable)
467 { 462 {
468 m_wearables[wearableId] = wearable; 463// DEBUG ON
464// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID);
465// DEBUG OFF
466 m_wearables[wearableId] = new AvatarWearable(wearable.ItemID,wearable.AssetID);
469 } 467 }
470 468
471 public static Primitive.TextureEntry GetDefaultTexture()
472 {
473 Primitive.TextureEntry textu = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97"));
474 textu.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012");
475 textu.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID;
476 textu.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID;
477 textu.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77");
478 textu.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B");
479 textu.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010");
480 textu.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011");
481 return textu;
482 }
483 469
484 public static byte[] GetDefaultVisualParams() 470// DEBUG ON
471 public override String ToString()
485 { 472 {
486 byte[] visualParams; 473 String s = "";
487 visualParams = new byte[VISUALPARAM_COUNT]; 474 for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
488 for (int i = 0; i < VISUALPARAM_COUNT; i++) 475 if (m_texture.FaceTextures[i] != null)
489 { 476 s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID);
490 visualParams[i] = 100; 477
491 } 478 foreach (AvatarWearable awear in m_wearables)
492 return visualParams; 479 s += String.Format("Wearable: item={0}, asset={1}\n",awear.ItemID,awear.AssetID);
480
481 s += "Visual Params: ";
482 for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++)
483 s += String.Format("{0},",m_visualparams[j]);
484 s += "\n";
485
486 return s;
493 } 487 }
488// DEBUG OFF
494 489
495 private Dictionary<int, UUID[]> m_attachments = new Dictionary<int, UUID[]>(); 490 public void SetAttachments(AvatarAttachment[] data)
496
497 public void SetAttachments(AttachmentData[] data)
498 { 491 {
499 foreach (AttachmentData a in data) 492 foreach (AvatarAttachment attach in data)
500 { 493 m_attachments[attach.AttachPoint] = new AvatarAttachment(attach);
501 m_attachments[a.AttachPoint] = new UUID[2];
502 m_attachments[a.AttachPoint][0] = a.ItemID;
503 m_attachments[a.AttachPoint][1] = a.AssetID;
504 }
505 } 494 }
506 495
507 public void SetAttachments(Hashtable data) 496 public void SetAttachment(int attachpoint, UUID item, UUID asset)
508 { 497 {
509 m_attachments.Clear(); 498 if (attachpoint == 0)
510
511 if (data == null)
512 return; 499 return;
513 500
514 foreach (DictionaryEntry e in data) 501 if (item == UUID.Zero)
515 { 502 {
516 int attachpoint = Convert.ToInt32(e.Key);
517
518 if (m_attachments.ContainsKey(attachpoint)) 503 if (m_attachments.ContainsKey(attachpoint))
519 continue; 504 m_attachments.Remove(attachpoint);
520 505 return;
521 UUID item;
522 UUID asset;
523
524 Hashtable uuids = (Hashtable) e.Value;
525 UUID.TryParse(uuids["item"].ToString(), out item);
526 UUID.TryParse(uuids["asset"].ToString(), out asset);
527
528 UUID[] attachment = new UUID[2];
529 attachment[0] = item;
530 attachment[1] = asset;
531
532 m_attachments[attachpoint] = attachment;
533 } 506 }
534 }
535 507
536 public Dictionary<int, UUID[]> GetAttachmentDictionary() 508 m_attachments[attachpoint] = new AvatarAttachment(attachpoint,item,asset);
537 {
538 return m_attachments;
539 } 509 }
540 510
541 public Hashtable GetAttachments() 511 public Hashtable GetAttachments()
@@ -545,16 +515,13 @@ namespace OpenSim.Framework
545 515
546 Hashtable ret = new Hashtable(); 516 Hashtable ret = new Hashtable();
547 517
548 foreach (KeyValuePair<int, UUID[]> kvp in m_attachments) 518 foreach (KeyValuePair<int, AvatarAttachment> kvp in m_attachments)
549 { 519 {
550 int attachpoint = kvp.Key;
551 UUID[] uuids = kvp.Value;
552
553 Hashtable data = new Hashtable(); 520 Hashtable data = new Hashtable();
554 data["item"] = uuids[0].ToString(); 521 data["item"] = kvp.Value.ItemID.ToString();
555 data["asset"] = uuids[1].ToString(); 522 data["asset"] = kvp.Value.AssetID.ToString();
556 523
557 ret[attachpoint] = data; 524 ret[kvp.Key] = data;
558 } 525 }
559 526
560 return ret; 527 return ret;
@@ -570,7 +537,7 @@ namespace OpenSim.Framework
570 if (!m_attachments.ContainsKey(attachpoint)) 537 if (!m_attachments.ContainsKey(attachpoint))
571 return UUID.Zero; 538 return UUID.Zero;
572 539
573 return m_attachments[attachpoint][0]; 540 return m_attachments[attachpoint].ItemID;
574 } 541 }
575 542
576 public UUID GetAttachedAsset(int attachpoint) 543 public UUID GetAttachedAsset(int attachpoint)
@@ -578,33 +545,14 @@ namespace OpenSim.Framework
578 if (!m_attachments.ContainsKey(attachpoint)) 545 if (!m_attachments.ContainsKey(attachpoint))
579 return UUID.Zero; 546 return UUID.Zero;
580 547
581 return m_attachments[attachpoint][1]; 548 return m_attachments[attachpoint].AssetID;
582 }
583
584 public void SetAttachment(int attachpoint, UUID item, UUID asset)
585 {
586 if (attachpoint == 0)
587 return;
588
589 if (item == UUID.Zero)
590 {
591 if (m_attachments.ContainsKey(attachpoint))
592 m_attachments.Remove(attachpoint);
593 return;
594 }
595
596 if (!m_attachments.ContainsKey(attachpoint))
597 m_attachments[attachpoint] = new UUID[2];
598
599 m_attachments[attachpoint][0] = item;
600 m_attachments[attachpoint][1] = asset;
601 } 549 }
602 550
603 public int GetAttachpoint(UUID itemID) 551 public int GetAttachpoint(UUID itemID)
604 { 552 {
605 foreach (KeyValuePair<int, UUID[]> kvp in m_attachments) 553 foreach (KeyValuePair<int, AvatarAttachment> kvp in m_attachments)
606 { 554 {
607 if (kvp.Value[0] == itemID) 555 if (kvp.Value.ItemID == itemID)
608 { 556 {
609 return kvp.Key; 557 return kvp.Key;
610 } 558 }
@@ -625,42 +573,126 @@ namespace OpenSim.Framework
625 m_attachments.Clear(); 573 m_attachments.Clear();
626 } 574 }
627 575
628 string GetAttachmentsString() 576 /// <summary>
577 /// Create an OSDMap from the appearance data
578 /// </summary>
579 public OSDMap Pack()
629 { 580 {
630 List<string> strings = new List<string>(); 581 OSDMap data = new OSDMap();
631 582
632 foreach (KeyValuePair<int, UUID[]> e in m_attachments) 583 data["serial"] = OSD.FromInteger(m_serial);
584 data["height"] = OSD.FromReal(m_avatarHeight);
585 data["hipoffset"] = OSD.FromReal(m_hipOffset);
586
587 // Wearables
588 OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES);
589 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
590 wears.Add(m_wearables[i].Pack());
591 data["wearables"] = wears;
592
593 // Avatar Textures
594 OSDArray textures = new OSDArray(AvatarAppearance.TEXTURE_COUNT);
595 for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
633 { 596 {
634 strings.Add(e.Key.ToString()); 597 if (m_texture.FaceTextures[i] != null)
635 strings.Add(e.Value[0].ToString()); 598 textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID));
636 strings.Add(e.Value[1].ToString()); 599 else
600 textures.Add(OSD.FromUUID(UUID.Zero));
637 } 601 }
602 data["textures"] = textures;
638 603
639 return String.Join(",", strings.ToArray()); 604 // Visual Parameters
605 OSDBinary visualparams = new OSDBinary(m_visualparams);
606 data["visualparams"] = visualparams;
607
608 // Attachments
609 OSDArray attachs = new OSDArray(m_attachments.Count);
610 foreach (KeyValuePair<int, AvatarAttachment> kvp in m_attachments)
611 attachs.Add(kvp.Value.Pack());
612 data["attachments"] = attachs;
613
614 return data;
640 } 615 }
641 616
642 void SetAttachmentsString(string data) 617 /// <summary>
618 /// Unpack and OSDMap and initialize the appearance
619 /// from it
620 /// </summary>
621 public void Unpack(OSDMap data)
643 { 622 {
644 string[] strings = data.Split(new char[] {','}); 623 if ((data != null) && (data["appearance_serial"] != null))
645 int i = 0; 624 m_serial = data["appearance_serial"].AsInteger();
625 if ((data != null) && (data["height"] != null))
626 m_avatarHeight = (float)data["height"].AsReal();
627 if ((data != null) && (data["hipoffset"] != null))
628 m_hipOffset = (float)data["hipoffset"].AsReal();
629
630 try
631 {
632 // Wearables
633 SetDefaultWearables();
634 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
635 {
636 OSDArray wears = (OSDArray)(data["wearables"]);
637 for (int i = 0; i < wears.Count; i++)
638 m_wearables[i] = new AvatarWearable((OSDMap)wears[i]);
639 }
640 else
641 {
642 m_log.Warn("[AVATARAPPEARANCE] failed to unpack wearables");
643 }
646 644
647 m_attachments.Clear(); 645 // Avatar Textures
646 SetDefaultTexture();
647 if ((data != null) && (data["textures"] != null) && (data["textures"]).Type == OSDType.Array)
648 {
649 OSDArray textures = (OSDArray)(data["textures"]);
650 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++)
651 {
652 if (textures[i] != null)
653 {
654 UUID textureID = textures[i].AsUUID();
655 if (textureID != UUID.Zero)
656 m_texture.CreateFace((uint)i).TextureID = textureID;
657 }
658 }
659 }
660 else
661 {
662 m_log.Warn("[AVATARAPPEARANCE] failed to unpack textures");
663 }
648 664
649 while (strings.Length - i > 2) 665 // Visual Parameters
650 { 666 SetDefaultParams();
651 int attachpoint = Int32.Parse(strings[i]); 667 if ((data != null) && (data["visualparams"] != null))
652 UUID item = new UUID(strings[i+1]); 668 {
653 UUID asset = new UUID(strings[i+2]); 669 if ((data["visualparams"].Type == OSDType.Binary) || (data["visualparams"].Type == OSDType.Array))
654 i += 3; 670 m_visualparams = data["visualparams"].AsBinary();
671 }
672 else
673 {
674 m_log.Warn("[AVATARAPPEARANCE] failed to unpack visual parameters");
675 }
655 676
656 if (!m_attachments.ContainsKey(attachpoint)) 677 // Attachments
678 m_attachments = new Dictionary<int, AvatarAttachment>();
679 if ((data != null) && (data["attachments"] != null) && (data["attachments"]).Type == OSDType.Array)
657 { 680 {
658 m_attachments[attachpoint] = new UUID[2]; 681 OSDArray attachs = (OSDArray)(data["attachments"]);
659 m_attachments[attachpoint][0] = item; 682 for (int i = 0; i < attachs.Count; i++)
660 m_attachments[attachpoint][1] = asset; 683 {
684 AvatarAttachment attach = new AvatarAttachment((OSDMap)attachs[i]);
685 m_attachments[attach.AttachPoint] = attach;
686 }
661 } 687 }
662 } 688 }
689 catch (Exception e)
690 {
691 m_log.ErrorFormat("[AVATARAPPEARANCE] unpack failed badly: {0}",e.Message);
692 }
663 } 693 }
694
695
664 /// <summary> 696 /// <summary>
665 /// Viewer Params Array Element for AgentSetAppearance 697 /// Viewer Params Array Element for AgentSetAppearance
666 /// Generated from LibOMV's Visual Params list 698 /// Generated from LibOMV's Visual Params list
@@ -1424,4 +1456,4 @@ namespace OpenSim.Framework
1424 SKIRT_SKIRT_BLUE = 217 1456 SKIRT_SKIRT_BLUE = 217
1425 } 1457 }
1426 } 1458 }
1427} 1459} \ No newline at end of file
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
28using System;
28using OpenMetaverse; 29using OpenMetaverse;
29using OpenSim.Framework; 30using OpenMetaverse.StructuredData;
30 31
31namespace OpenSim.Region.Framework.Interfaces 32namespace 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
28using System; 28using System;
29using System.Runtime.Serialization;
30using System.Security.Permissions;
31using OpenMetaverse; 29using OpenMetaverse;
30using OpenMetaverse.StructuredData;
32 31
33namespace OpenSim.Framework 32namespace 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..6b64e12 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -976,7 +976,9 @@ namespace OpenSim.Framework.Capabilities
976 976
977 public void BakedTextureUploaded(UUID assetID, byte[] data) 977 public void BakedTextureUploaded(UUID assetID, byte[] data)
978 { 978 {
979 m_log.DebugFormat("[CAPS]: Received baked texture {0}", assetID.ToString()); 979// DEBUG ON
980 m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
981// DEBUG OFF
980 AssetBase asset; 982 AssetBase asset;
981 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString()); 983 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString());
982 asset.Data = data; 984 asset.Data = data;
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 0dc5dbc..fdebba3 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -225,46 +225,6 @@ namespace OpenSim.Framework
225 } 225 }
226 } 226 }
227 227
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 228 public class ControllerData
269 { 229 {
270 public UUID ItemID; 230 public UUID ItemID;
@@ -348,11 +308,14 @@ namespace OpenSim.Framework
348 public UUID GranterID; 308 public UUID GranterID;
349 309
350 // Appearance 310 // Appearance
311 public AvatarAppearance Appearance;
312
313/*
351 public byte[] AgentTextures; 314 public byte[] AgentTextures;
352 public byte[] VisualParams; 315 public byte[] VisualParams;
353 public UUID[] Wearables; 316 public UUID[] Wearables;
354 public AttachmentData[] Attachments; 317 public AvatarAttachment[] Attachments;
355 318*/
356 // Scripted 319 // Scripted
357 public ControllerData[] Controllers; 320 public ControllerData[] Controllers;
358 321
@@ -413,6 +376,9 @@ namespace OpenSim.Framework
413 args["animations"] = anims; 376 args["animations"] = anims;
414 } 377 }
415 378
379 if (Appearance != null)
380 args["packed_appearance"] = Appearance.Pack();
381
416 //if ((AgentTextures != null) && (AgentTextures.Length > 0)) 382 //if ((AgentTextures != null) && (AgentTextures.Length > 0))
417 //{ 383 //{
418 // OSDArray textures = new OSDArray(AgentTextures.Length); 384 // OSDArray textures = new OSDArray(AgentTextures.Length);
@@ -421,7 +387,7 @@ namespace OpenSim.Framework
421 // args["agent_textures"] = textures; 387 // args["agent_textures"] = textures;
422 //} 388 //}
423 389
424 390/*
425 if ((AgentTextures != null) && (AgentTextures.Length > 0)) 391 if ((AgentTextures != null) && (AgentTextures.Length > 0))
426 args["texture_entry"] = OSD.FromBinary(AgentTextures); 392 args["texture_entry"] = OSD.FromBinary(AgentTextures);
427 393
@@ -441,11 +407,11 @@ namespace OpenSim.Framework
441 if ((Attachments != null) && (Attachments.Length > 0)) 407 if ((Attachments != null) && (Attachments.Length > 0))
442 { 408 {
443 OSDArray attachs = new OSDArray(Attachments.Length); 409 OSDArray attachs = new OSDArray(Attachments.Length);
444 foreach (AttachmentData att in Attachments) 410 foreach (AvatarAttachment att in Attachments)
445 attachs.Add(att.PackUpdateMessage()); 411 attachs.Add(att.Pack());
446 args["attachments"] = attachs; 412 args["attachments"] = attachs;
447 } 413 }
448 414*/
449 if ((Controllers != null) && (Controllers.Length > 0)) 415 if ((Controllers != null) && (Controllers.Length > 0))
450 { 416 {
451 OSDArray controls = new OSDArray(Controllers.Length); 417 OSDArray controls = new OSDArray(Controllers.Length);
@@ -581,6 +547,12 @@ namespace OpenSim.Framework
581 // AgentTextures[i++] = o.AsUUID(); 547 // AgentTextures[i++] = o.AsUUID();
582 //} 548 //}
583 549
550 if (args["packed_appearance"] != null)
551 Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]);
552 else
553 Appearance = new AvatarAppearance(AgentID);
554
555/*
584 if (args["texture_entry"] != null) 556 if (args["texture_entry"] != null)
585 AgentTextures = args["texture_entry"].AsBinary(); 557 AgentTextures = args["texture_entry"].AsBinary();
586 558
@@ -599,17 +571,17 @@ namespace OpenSim.Framework
599 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) 571 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
600 { 572 {
601 OSDArray attachs = (OSDArray)(args["attachments"]); 573 OSDArray attachs = (OSDArray)(args["attachments"]);
602 Attachments = new AttachmentData[attachs.Count]; 574 Attachments = new AvatarAttachment[attachs.Count];
603 int i = 0; 575 int i = 0;
604 foreach (OSD o in attachs) 576 foreach (OSD o in attachs)
605 { 577 {
606 if (o.Type == OSDType.Map) 578 if (o.Type == OSDType.Map)
607 { 579 {
608 Attachments[i++] = new AttachmentData((OSDMap)o); 580 Attachments[i++] = new AvatarAttachment((OSDMap)o);
609 } 581 }
610 } 582 }
611 } 583 }
612 584*/
613 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) 585 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
614 { 586 {
615 OSDArray controls = (OSDArray)(args["controllers"]); 587 OSDArray controls = (OSDArray)(args["controllers"]);
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/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/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/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..9f7ff7f 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -38,48 +38,20 @@ using OpenSim.Services.Interfaces;
38 38
39namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory 39namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
40{ 40{
41 public class AvatarFactoryModule : IAvatarFactory, IRegionModule 41 public class AvatarFactoryModule : IRegionModule
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
44 private Scene m_scene = null; 45 private Scene m_scene = null;
45 private static readonly AvatarAppearance def = new AvatarAppearance();
46 46
47 public bool TryGetAvatarAppearance(UUID avatarId, out AvatarAppearance appearance) 47 private bool m_startAnimationSet = false;
48 {
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
57 m_log.ErrorFormat("[APPEARANCE]: Appearance not found for {0}, creating default", avatarId);
58 appearance = CreateDefault(avatarId);
59 return false;
60 }
61
62 private AvatarAppearance CreateDefault(UUID avatarId)
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 48
73 public void Initialise(Scene scene, IConfigSource source) 49 public void Initialise(Scene scene, IConfigSource source)
74 { 50 {
75 scene.RegisterModuleInterface<IAvatarFactory>(this);
76 scene.EventManager.OnNewClient += NewClient; 51 scene.EventManager.OnNewClient += NewClient;
77 52
78 if (m_scene == null) 53 if (m_scene == null)
79 {
80 m_scene = scene; 54 m_scene = scene;
81 }
82
83 } 55 }
84 56
85 public void PostInitialise() 57 public void PostInitialise()
@@ -102,6 +74,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
102 74
103 public void NewClient(IClientAPI client) 75 public void NewClient(IClientAPI client)
104 { 76 {
77 client.OnRequestWearables += SendWearables;
78 client.OnSetAppearance += SetAppearance;
105 client.OnAvatarNowWearing += AvatarIsWearing; 79 client.OnAvatarNowWearing += AvatarIsWearing;
106 } 80 }
107 81
@@ -110,42 +84,115 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
110 // client.OnAvatarNowWearing -= AvatarIsWearing; 84 // client.OnAvatarNowWearing -= AvatarIsWearing;
111 } 85 }
112 86
113 public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) 87 /// <summary>
88 /// Set appearance data (textureentry and slider settings) received from the client
89 /// </summary>
90 /// <param name="texture"></param>
91 /// <param name="visualParam"></param>
92 public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams)
114 { 93 {
115 IInventoryService invService = m_scene.InventoryService; 94 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
95 if (sp == null)
96 {
97 m_log.WarnFormat("[AVFACTORY] SetAppearance unable to find presence for {0}",client.AgentId);
98 return;
99 }
100
101// DEBUG ON
102 m_log.WarnFormat("[AVFACTORY] SetAppearance for {0}",client.AgentId);
103// DEBUG OFF
116 104
117 if (invService.GetRootFolder(userID) != null) 105/*
106 if (m_physicsActor != null)
118 { 107 {
119 for (int i = 0; i < 13; i++) 108 if (!IsChildAgent)
120 { 109 {
121 if (appearance.Wearables[i].ItemID == UUID.Zero) 110 // This may seem like it's redundant, remove the avatar from the physics scene
122 { 111 // just to add it back again, but it saves us from having to update
123 appearance.Wearables[i].AssetID = UUID.Zero; 112 // 3 variables 10 times a second.
124 } 113 bool flyingTemp = m_physicsActor.Flying;
125 else 114 RemoveFromPhysicalScene();
126 { 115 //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
127 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID);
128 baseItem = invService.GetItem(baseItem);
129 116
130 if (baseItem != null) 117 //PhysicsActor = null;
131 { 118
132 appearance.Wearables[i].AssetID = baseItem.AssetID; 119 AddToPhysicalScene(flyingTemp);
133 } 120 }
134 else 121 }
122*/
123 #region Bake Cache Check
124
125 bool changed = false;
126
127 // Process the texture entry
128 if (textureEntry != null)
129 {
130 for (int i = 0; i < BAKE_INDICES.Length; i++)
131 {
132 int j = BAKE_INDICES[i];
133 Primitive.TextureEntryFace face = textureEntry.FaceTextures[j];
134
135 if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
136 {
137 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
135 { 138 {
136 m_log.ErrorFormat( 139 m_log.WarnFormat("[AVFACTORY]: Missing baked texture {0} ({1}) for avatar {2}",face.TextureID,j,this.Name);
137 "[APPEARANCE]: Can't find inventory item {0} for {1}, setting to default", 140 client.SendRebakeAvatarTextures(face.TextureID);
138 appearance.Wearables[i].ItemID, (WearableType)i);
139
140 appearance.Wearables[i].AssetID = def.Wearables[i].AssetID;
141 } 141 }
142 } 142 }
143 } 143 }
144 changed = sp.Appearance.SetTextureEntries(textureEntry);
145
146 }
147
148 #endregion Bake Cache Check
149
150 changed = sp.Appearance.SetVisualParams(visualParams) || changed;
151
152 // If nothing changed (this happens frequently) just return
153 if (changed)
154 {
155// DEBUG ON
156 m_log.Warn("[AVFACTORY] Appearance changed");
157// DEBUG OFF
158 sp.Appearance.SetAppearance(textureEntry, visualParams);
159 if (sp.Appearance.AvatarHeight > 0)
160 sp.SetHeight(sp.Appearance.AvatarHeight);
161
162 m_scene.AvatarService.SetAppearance(client.AgentId, sp.Appearance);
144 } 163 }
164// DEBUG ON
145 else 165 else
166 m_log.Warn("[AVFACTORY] Appearance did not change");
167// DEBUG OFF
168
169 sp.SendAppearanceToAllOtherAgents();
170 if (!m_startAnimationSet)
171 {
172 sp.Animator.UpdateMovementAnimations();
173 m_startAnimationSet = true;
174 }
175
176 client.SendAvatarDataImmediate(sp);
177 client.SendAppearance(sp.Appearance.Owner,sp.Appearance.VisualParams,sp.Appearance.Texture.GetBytes());
178 }
179
180 /// <summary>
181 /// Tell the client for this scene presence what items it should be wearing now
182 /// </summary>
183 public void SendWearables(IClientAPI client)
184 {
185 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
186 if (sp == null)
146 { 187 {
147 m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID); 188 m_log.WarnFormat("[AVFACTORY] SendWearables unable to find presence for {0}",client.AgentId);
189 return;
148 } 190 }
191
192// DEBUG ON
193 m_log.WarnFormat("[AVFACTORY]: Received request for wearables of {0}", client.AgentId);
194// DEBUG OFF
195 client.SendWearables(sp.Appearance.Wearables,sp.Appearance.Serial++);
149 } 196 }
150 197
151 /// <summary> 198 /// <summary>
@@ -153,65 +200,81 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
153 /// </summary> 200 /// </summary>
154 /// <param name="sender"></param> 201 /// <param name="sender"></param>
155 /// <param name="e"></param> 202 /// <param name="e"></param>
156 public void AvatarIsWearing(Object sender, AvatarWearingArgs e) 203 public void AvatarIsWearing(IClientAPI client, AvatarWearingArgs e)
157 { 204 {
158 m_log.DebugFormat("[APPEARANCE]: AvatarIsWearing"); 205 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
159 206 if (sp == null)
160 IClientAPI clientView = (IClientAPI)sender;
161 ScenePresence sp = m_scene.GetScenePresence(clientView.AgentId);
162
163 if (sp == null)
164 { 207 {
165 m_log.Error("[APPEARANCE]: Avatar is child agent, ignoring AvatarIsWearing event"); 208 m_log.WarnFormat("[AVFACTORY] AvatarIsWearing unable to find presence for {0}",client.AgentId);
166 return; 209 return;
167 } 210 }
211
212// DEBUG ON
213 m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}",client.AgentId);
214// DEBUG OFF
215
216 AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance);
168 217
169 AvatarAppearance avatAppearance = sp.Appearance; 218 //if (!TryGetAvatarAppearance(client.AgentId, out avatAppearance))
170 //if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance))
171 //{ 219 //{
172 // m_log.Warn("[APPEARANCE]: We didn't seem to find the appearance, falling back to ScenePresence"); 220 // m_log.Warn("[AVFACTORY]: We didn't seem to find the appearance, falling back to ScenePresence");
173 // avatAppearance = sp.Appearance; 221 // avatAppearance = sp.Appearance;
174 //} 222 //}
175 223
176 //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); 224 //m_log.DebugFormat("[AVFACTORY]: Received wearables for {0}", client.Name);
177 225
178 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) 226 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
179 { 227 {
180 if (wear.Type < 13) 228 if (wear.Type < AvatarWearable.MAX_WEARABLES)
181 { 229 {
182 avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; 230 AvatarWearable newWearable = new AvatarWearable(wear.ItemID,UUID.Zero);
231 avatAppearance.SetWearable(wear.Type, newWearable);
183 } 232 }
184 } 233 }
185 234
186 SetAppearanceAssets(sp.UUID, ref avatAppearance); 235 SetAppearanceAssets(sp.UUID, ref avatAppearance);
187 AvatarData adata = new AvatarData(avatAppearance);
188 m_scene.AvatarService.SetAvatar(clientView.AgentId, adata);
189 236
237 m_scene.AvatarService.SetAppearance(client.AgentId, avatAppearance);
190 sp.Appearance = avatAppearance; 238 sp.Appearance = avatAppearance;
191 } 239 }
192 240
193 public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) 241 private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
194 { 242 {
195 visualParams = GetDefaultVisualParams(); 243 IInventoryService invService = m_scene.InventoryService;
196 wearables = AvatarWearable.DefaultWearables;
197 }
198 244
199 public void UpdateDatabase(UUID user, AvatarAppearance appearance) 245 if (invService.GetRootFolder(userID) != null)
200 { 246 {
201 //m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); 247 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
202 AvatarData adata = new AvatarData(appearance); 248 {
203 m_scene.AvatarService.SetAvatar(user, adata); 249 if (appearance.Wearables[i].ItemID == UUID.Zero)
204 } 250 {
251 appearance.Wearables[i].AssetID = UUID.Zero;
252 }
253 else
254 {
255 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID);
256 baseItem = invService.GetItem(baseItem);
205 257
206 private static byte[] GetDefaultVisualParams() 258 if (baseItem != null)
207 { 259 {
208 byte[] visualParams; 260 appearance.Wearables[i].AssetID = baseItem.AssetID;
209 visualParams = new byte[218]; 261 }
210 for (int i = 0; i < 218; i++) 262 else
263 {
264 m_log.ErrorFormat(
265 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default",
266 appearance.Wearables[i].ItemID, (WearableType)i);
267
268 appearance.Wearables[i].ItemID = UUID.Zero;
269 appearance.Wearables[i].AssetID = UUID.Zero;
270 }
271 }
272 }
273 }
274 else
211 { 275 {
212 visualParams[i] = 100; 276 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID);
213 } 277 }
214 return visualParams;
215 } 278 }
216 } 279 }
217} 280}
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;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
35using OpenSim.Server.Base; 36using 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/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..6367fcf 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>();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 13d9964..6576e64 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.
@@ -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)
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/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/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index efd7e22..1a13dea 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2003,14 +2003,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2003 m_host.AddScriptLPS(1); 2003 m_host.AddScriptLPS(1);
2004 2004
2005 // try to let this work as in SL... 2005 // try to let this work as in SL...
2006 if (m_host.LinkNum < 2) 2006 if (m_host.ParentID == 0)
2007 { 2007 {
2008 // Special case: If we are root, rotate complete SOG to new 2008 // special case: If we are root, rotate complete SOG to new rotation
2009 // rotation.
2010 // We are root if the link number is 0 (single prim) or 1
2011 // (root prim). ParentID may be nonzero in attachments and
2012 // using it would cause attachments and HUDs to rotate
2013 // to the wrong positions.
2014 SetRot(m_host, Rot2Quaternion(rot)); 2009 SetRot(m_host, Rot2Quaternion(rot));
2015 } 2010 }
2016 else 2011 else
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/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 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31// DEBUG ON
32using System.Diagnostics;
33// DEBUG OFF
31using System.Reflection; 34using System.Reflection;
32using log4net; 35using log4net;
33using Mono.Addins; 36using 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/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs
index de3bcf9..93b977b 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>
@@ -217,23 +232,26 @@ namespace OpenSim.Services.Interfaces
217 foreach (KeyValuePair<string, string> _kvp in Data) 232 foreach (KeyValuePair<string, string> _kvp in Data)
218 if (_kvp.Key.StartsWith("_ap_")) 233 if (_kvp.Key.StartsWith("_ap_"))
219 attchs[_kvp.Key] = _kvp.Value; 234 attchs[_kvp.Key] = _kvp.Value;
220 Hashtable aaAttachs = new Hashtable(); 235
221 foreach (KeyValuePair<string, string> _kvp in attchs) 236 foreach (KeyValuePair<string, string> _kvp in attchs)
222 { 237 {
223 string pointStr = _kvp.Key.Substring(4); 238 string pointStr = _kvp.Key.Substring(4);
224 int point = 0; 239 int point = 0;
225 if (!Int32.TryParse(pointStr, out point)) 240 if (!Int32.TryParse(pointStr, out point))
226 continue; 241 continue;
227 Hashtable tmp = new Hashtable(); 242
228 UUID uuid = UUID.Zero; 243 UUID uuid = UUID.Zero;
229 UUID.TryParse(_kvp.Value, out uuid); 244 UUID.TryParse(_kvp.Value, out uuid);
230 tmp["item"] = uuid; 245
231 tmp["asset"] = UUID.Zero.ToString(); 246 appearance.SetAttachment(point,uuid,UUID.Zero);
232 aaAttachs[point] = tmp;
233 } 247 }
234 appearance.SetAttachments(aaAttachs);
235 } 248 }
236 catch { } 249 catch
250 {
251 // We really should report something here, returning null
252 // will at least break the wrapper
253 return null;
254 }
237 255
238 return appearance; 256 return appearance;
239 } 257 }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 127c4b2..a06476e 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 //
@@ -601,7 +601,7 @@ namespace OpenSim.Services.LLLoginService
601 } 601 }
602 } 602 }
603 603
604 protected AgentCircuitData LaunchAgentAtGrid(GridRegion gatekeeper, GridRegion destination, UserAccount account, AvatarData avatar, 604 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, 605 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) 606 IPEndPoint clientIP, out string where, out string reason, out GridRegion dest)
607 { 607 {
@@ -697,14 +697,14 @@ namespace OpenSim.Services.LLLoginService
697 } 697 }
698 698
699 private AgentCircuitData MakeAgent(GridRegion region, UserAccount account, 699 private AgentCircuitData MakeAgent(GridRegion region, UserAccount account,
700 AvatarData avatar, UUID session, UUID secureSession, uint circuit, Vector3 position, 700 AvatarAppearance avatar, UUID session, UUID secureSession, uint circuit, Vector3 position,
701 string ipaddress, string viewer, string channel, string mac, string id0) 701 string ipaddress, string viewer, string channel, string mac, string id0)
702 { 702 {
703 AgentCircuitData aCircuit = new AgentCircuitData(); 703 AgentCircuitData aCircuit = new AgentCircuitData();
704 704
705 aCircuit.AgentID = account.PrincipalID; 705 aCircuit.AgentID = account.PrincipalID;
706 if (avatar != null) 706 if (avatar != null)
707 aCircuit.Appearance = avatar.ToAvatarAppearance(account.PrincipalID); 707 aCircuit.Appearance = new AvatarAppearance(avatar);
708 else 708 else
709 aCircuit.Appearance = new AvatarAppearance(account.PrincipalID); 709 aCircuit.Appearance = new AvatarAppearance(account.PrincipalID);
710 710
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;
diff --git a/bin/assets/TexturesAssetSet/TexturesAssetSet.xml b/bin/assets/TexturesAssetSet/TexturesAssetSet.xml
index 7c74a48..c5cafa7 100644
--- a/bin/assets/TexturesAssetSet/TexturesAssetSet.xml
+++ b/bin/assets/TexturesAssetSet/TexturesAssetSet.xml
@@ -1,10 +1,4 @@
1<Nini> 1<Nini>
2 <Section Name="Default Alpha">
3 <Key Name="assetID" Value="1578a2b1-5179-4b53-b618-fe00ca5a5594" />
4 <Key Name="name" Value="alpha" />
5 <Key Name="assetType" Value="0" />
6 <Key Name="fileName" Value="defaultalpha.jp2" />
7 </Section>
8 <Section Name="texture1"> 2 <Section Name="texture1">
9 <Key Name="assetID" Value="00000000-0000-2222-3333-000000000099" /> 3 <Key Name="assetID" Value="00000000-0000-2222-3333-000000000099" />
10 <Key Name="name" Value="femface" /> 4 <Key Name="name" Value="femface" />
diff --git a/bin/inventory/BodyPartsLibrary/BodyPartsLibraryItems.xml b/bin/inventory/BodyPartsLibrary/BodyPartsLibraryItems.xml
index 5cb71c0..aa8d9d9 100644
--- a/bin/inventory/BodyPartsLibrary/BodyPartsLibraryItems.xml
+++ b/bin/inventory/BodyPartsLibrary/BodyPartsLibraryItems.xml
@@ -16,34 +16,6 @@
16 </Section> 16 </Section>
17--> 17-->
18<!-- 18<!--
19 <Section Name="Tattoo">
20 <Key Name="inventoryID" Value="c47e22bd-3021-4ba4-82aa-2b5cb34d35e1" />
21 <Key Name="assetID" Value="00000000-0000-2222-3333-100000001007" />
22 <Key Name="folderID" Value="d499e5e0-b9bf-11dc-95ff-0800200c9a66"/>
23 <Key Name="description" Value="Tattoo" />
24 <Key Name="name" Value="Tattoo" />
25 <Key Name="assetType" Value="13" />
26 <Key Name="inventoryType" Value="18" />
27 <Key Name="currentPermissions" Value="2147483647" />
28 <Key Name="nextPermissions" Value="2147483647" />
29 <Key Name="everyonePermissions" Value="2147483647" />
30 <Key Name="basePermissions" Value="2147483647" />
31 </Section>
32
33 <Section Name="Alpha">
34 <Key Name="inventoryID" Value="bfb9923c-4838-4d2d-bf07-608c5b1165c8" />
35 <Key Name="assetID" Value="1578a2b1-5179-4b53-b618-fe00ca5a5594" />
36 <Key Name="folderID" Value="d499e5e0-b9bf-11dc-95ff-0800200c9a66"/>
37 <Key Name="description" Value="Hair" />
38 <Key Name="name" Value="Hair" />
39 <Key Name="assetType" Value="13" />
40 <Key Name="inventoryType" Value="18" />
41 <Key Name="currentPermissions" Value="2147483647" />
42 <Key Name="nextPermissions" Value="2147483647" />
43 <Key Name="everyonePermissions" Value="2147483647" />
44 <Key Name="basePermissions" Value="2147483647" />
45 </Section>
46
47 <Section Name="Hair"> 19 <Section Name="Hair">
48 <Key Name="inventoryID" Value="d342e6c1-b9d2-11dc-95ff-0800200c9a66" /> 20 <Key Name="inventoryID" Value="d342e6c1-b9d2-11dc-95ff-0800200c9a66" />
49 <Key Name="assetID" Value="d342e6c0-b9d2-11dc-95ff-0800200c9a66" /> 21 <Key Name="assetID" Value="d342e6c0-b9d2-11dc-95ff-0800200c9a66" />