aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs18
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs5
-rw-r--r--OpenSim/Data/MySQL/Resources/Avatar.migrations8
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs53
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs319
-rw-r--r--OpenSim/Framework/AvatarWearable.cs170
-rw-r--r--OpenSim/Framework/Capabilities/Caps.cs4
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs10
-rw-r--r--OpenSim/Framework/Console/RemoteConsole.cs31
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs4
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
-rw-r--r--OpenSim/Region/Application/OpenSim.cs5
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs22
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs12
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs77
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs22
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs64
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs19
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs98
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs20
-rw-r--r--OpenSim/Services/AvatarService/AvatarService.cs11
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs53
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs56
-rw-r--r--OpenSim/Services/Interfaces/IAvatarService.cs205
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs29
-rw-r--r--OpenSim/Services/PresenceService/PresenceService.cs2
33 files changed, 687 insertions, 668 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 2e1c87e..4ac9ada 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -1628,11 +1628,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1628 1628
1629 for (int i=0; i<wearables.Length; i++) 1629 for (int i=0; i<wearables.Length; i++)
1630 { 1630 {
1631 if (inventoryMap.ContainsKey(wearables[i].ItemID)) 1631 if (inventoryMap.ContainsKey(wearables[i][0].ItemID))
1632 { 1632 {
1633 AvatarWearable wearable = new AvatarWearable(); 1633 AvatarWearable wearable = new AvatarWearable();
1634 wearable.AssetID = wearables[i].AssetID; 1634 wearable.Wear(inventoryMap[wearables[i][0].ItemID],
1635 wearable.ItemID = inventoryMap[wearables[i].ItemID]; 1635 wearables[i][0].AssetID);
1636 avatarAppearance.SetWearable(i, wearable); 1636 avatarAppearance.SetWearable(i, wearable);
1637 } 1637 }
1638 } 1638 }
@@ -1686,10 +1686,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1686 for (int i=0; i<wearables.Length; i++) 1686 for (int i=0; i<wearables.Length; i++)
1687 { 1687 {
1688 wearable = wearables[i]; 1688 wearable = wearables[i];
1689 if (wearable.ItemID != UUID.Zero) 1689 if (wearable[0].ItemID != UUID.Zero)
1690 { 1690 {
1691 // Get inventory item and copy it 1691 // Get inventory item and copy it
1692 InventoryItemBase item = new InventoryItemBase(wearable.ItemID, source); 1692 InventoryItemBase item = new InventoryItemBase(wearable[0].ItemID, source);
1693 item = inventoryService.GetItem(item); 1693 item = inventoryService.GetItem(item);
1694 1694
1695 if (item != null) 1695 if (item != null)
@@ -1720,13 +1720,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1720 1720
1721 // Wear item 1721 // Wear item
1722 AvatarWearable newWearable = new AvatarWearable(); 1722 AvatarWearable newWearable = new AvatarWearable();
1723 newWearable.AssetID = wearable.AssetID; 1723 newWearable.Wear(destinationItem.ID, wearable[0].AssetID);
1724 newWearable.ItemID = destinationItem.ID;
1725 avatarAppearance.SetWearable(i, newWearable); 1724 avatarAppearance.SetWearable(i, newWearable);
1726 } 1725 }
1727 else 1726 else
1728 { 1727 {
1729 m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID); 1728 m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable[0].ItemID, destinationFolder.ID);
1730 } 1729 }
1731 } 1730 }
1732 } 1731 }
@@ -2175,8 +2174,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2175 { 2174 {
2176 if (select && (GetStringAttribute(item, "wear", "false") == "true")) 2175 if (select && (GetStringAttribute(item, "wear", "false") == "true"))
2177 { 2176 {
2178 avatarAppearance.Wearables[inventoryItem.Flags].ItemID = inventoryItem.ID; 2177 avatarAppearance.Wearables[inventoryItem.Flags].Wear(inventoryItem.ID, inventoryItem.AssetID);
2179 avatarAppearance.Wearables[inventoryItem.Flags].AssetID = inventoryItem.AssetID;
2180 } 2178 }
2181 } 2179 }
2182 catch (Exception e) 2180 catch (Exception e)
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
index 3f6d4d6..019ca73 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
@@ -499,6 +499,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
499 indata = true; 499 indata = true;
500 } 500 }
501 break; 501 break;
502/*
502 case "Body" : 503 case "Body" :
503 if (xml.MoveToAttribute("Item")) 504 if (xml.MoveToAttribute("Item"))
504 { 505 {
@@ -655,6 +656,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
655 indata = true; 656 indata = true;
656 } 657 }
657 break; 658 break;
659*/
658 case "Attachment" : 660 case "Attachment" :
659 { 661 {
660 662
@@ -749,6 +751,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
749 rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString()); 751 rdata.writer.WriteAttributeString("Owner", rdata.userAppearance.Owner.ToString());
750 rdata.writer.WriteAttributeString("Serial", rdata.userAppearance.Serial.ToString()); 752 rdata.writer.WriteAttributeString("Serial", rdata.userAppearance.Serial.ToString());
751 753
754/*
752 FormatPart(rdata, "Body", rdata.userAppearance.BodyItem, rdata.userAppearance.BodyAsset); 755 FormatPart(rdata, "Body", rdata.userAppearance.BodyItem, rdata.userAppearance.BodyAsset);
753 FormatPart(rdata, "Skin", rdata.userAppearance.SkinItem, rdata.userAppearance.SkinAsset); 756 FormatPart(rdata, "Skin", rdata.userAppearance.SkinItem, rdata.userAppearance.SkinAsset);
754 FormatPart(rdata, "Hair", rdata.userAppearance.HairItem, rdata.userAppearance.HairAsset); 757 FormatPart(rdata, "Hair", rdata.userAppearance.HairItem, rdata.userAppearance.HairAsset);
@@ -765,7 +768,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
765 768
766 FormatPart(rdata, "UnderShirt", rdata.userAppearance.UnderShirtItem, rdata.userAppearance.UnderShirtAsset); 769 FormatPart(rdata, "UnderShirt", rdata.userAppearance.UnderShirtItem, rdata.userAppearance.UnderShirtAsset);
767 FormatPart(rdata, "UnderPants", rdata.userAppearance.UnderPantsItem, rdata.userAppearance.UnderPantsAsset); 770 FormatPart(rdata, "UnderPants", rdata.userAppearance.UnderPantsItem, rdata.userAppearance.UnderPantsAsset);
768 771*/
769 Rest.Log.DebugFormat("{0} FormatUserAppearance: Formatting attachments", MsgId); 772 Rest.Log.DebugFormat("{0} FormatUserAppearance: Formatting attachments", MsgId);
770 773
771 rdata.writer.WriteStartElement("Attachments"); 774 rdata.writer.WriteStartElement("Attachments");
diff --git a/OpenSim/Data/MySQL/Resources/Avatar.migrations b/OpenSim/Data/MySQL/Resources/Avatar.migrations
index 8d0eee6..f7cf176 100644
--- a/OpenSim/Data/MySQL/Resources/Avatar.migrations
+++ b/OpenSim/Data/MySQL/Resources/Avatar.migrations
@@ -10,3 +10,11 @@ CREATE TABLE Avatars (
10 KEY(PrincipalID)); 10 KEY(PrincipalID));
11 11
12COMMIT; 12COMMIT;
13
14:VERSION 2
15
16BEGIN;
17
18alter table Avatars change column Value Value text;
19
20COMMIT;
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 640a646..7b14ac7 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -212,41 +212,10 @@ namespace OpenSim.Framework
212 args["mac"] = OSD.FromString(Mac); 212 args["mac"] = OSD.FromString(Mac);
213 args["id0"] = OSD.FromString(Id0); 213 args["id0"] = OSD.FromString(Id0);
214 214
215 // Eventually this code should be deprecated, use full appearance
216 // packing in packed_appearance
217 if (Appearance != null) 215 if (Appearance != null)
218 { 216 {
219 args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); 217 args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);
220 218
221 //System.Console.WriteLine("XXX Before packing Wearables");
222 if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0))
223 {
224 OSDArray wears = new OSDArray(Appearance.Wearables.Length * 2);
225 foreach (AvatarWearable awear in Appearance.Wearables)
226 {
227 wears.Add(OSD.FromUUID(awear.ItemID));
228 wears.Add(OSD.FromUUID(awear.AssetID));
229 //System.Console.WriteLine("XXX ItemID=" + awear.ItemID + " assetID=" + awear.AssetID);
230 }
231 args["wearables"] = wears;
232 }
233
234 //System.Console.WriteLine("XXX Before packing Attachments");
235 List<AvatarAttachment> attachments = Appearance.GetAttachments();
236 if ((attachments != null) && (attachments.Count > 0))
237 {
238 OSDArray attachs = new OSDArray(attachments.Count);
239 foreach (AvatarAttachment attach in attachments)
240 {
241 attachs.Add(attach.Pack());
242 //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]);
243 }
244 args["attachments"] = attachs;
245 }
246 }
247
248 if (Appearance != null)
249 {
250 OSDMap appmap = Appearance.Pack(); 219 OSDMap appmap = Appearance.Pack();
251 args["packed_appearance"] = appmap; 220 args["packed_appearance"] = appmap;
252 } 221 }
@@ -346,28 +315,6 @@ namespace OpenSim.Framework
346 if (args["appearance_serial"] != null) 315 if (args["appearance_serial"] != null)
347 Appearance.Serial = args["appearance_serial"].AsInteger(); 316 Appearance.Serial = args["appearance_serial"].AsInteger();
348 317
349 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
350 {
351 OSDArray wears = (OSDArray)(args["wearables"]);
352 for (int i = 0; i < wears.Count / 2; i++)
353 {
354 AvatarWearable awear = new AvatarWearable(wears[i*2].AsUUID(),wears[(i*2)+1].AsUUID());
355 Appearance.SetWearable(i,awear);
356 }
357 }
358
359 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
360 {
361 OSDArray attachs = (OSDArray)(args["attachments"]);
362 foreach (OSD o in attachs)
363 {
364 if (o.Type == OSDType.Map)
365 {
366 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
367 }
368 }
369 }
370
371 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) 318 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map))
372 { 319 {
373 Appearance.Unpack((OSDMap)args["packed_appearance"]); 320 Appearance.Unpack((OSDMap)args["packed_appearance"]);
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index a4bb765..69e1ae6 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -35,104 +35,6 @@ using log4net;
35 35
36namespace OpenSim.Framework 36namespace OpenSim.Framework
37{ 37{
38 // A special dictionary for avatar appearance
39 public struct LayerItem
40 {
41 public UUID ItemID;
42 public UUID AssetID;
43
44 public LayerItem(UUID itemID, UUID assetID)
45 {
46 ItemID = itemID;
47 AssetID = assetID;
48 }
49 }
50
51 public class Layer
52 {
53 protected int m_layerType;
54 protected Dictionary<UUID, UUID> m_items = new Dictionary<UUID, UUID>();
55 protected List<UUID> m_ids = new List<UUID>();
56
57 public Layer(int type)
58 {
59 m_layerType = type;
60 }
61
62 public int LayerType
63 {
64 get { return m_layerType; }
65 }
66
67 public int Count
68 {
69 get { return m_ids.Count; }
70 }
71
72 public void Add(UUID itemID, UUID assetID)
73 {
74 if (m_items.ContainsKey(itemID))
75 return;
76 if (m_ids.Count >= 5)
77 return;
78
79 m_ids.Add(itemID);
80 m_items[itemID] = assetID;
81 }
82
83 public void Wear(UUID itemID, UUID assetID)
84 {
85 Clear();
86 Add(itemID, assetID);
87 }
88
89 public void Clear()
90 {
91 m_ids.Clear();
92 m_items.Clear();
93 }
94
95 public void RemoveItem(UUID itemID)
96 {
97 if (m_items.ContainsKey(itemID))
98 {
99 m_ids.Remove(itemID);
100 m_items.Remove(itemID);
101 }
102 }
103
104 public void RemoveAsset(UUID assetID)
105 {
106 UUID itemID = UUID.Zero;
107
108 foreach (KeyValuePair<UUID, UUID> kvp in m_items)
109 {
110 if (kvp.Value == assetID)
111 {
112 itemID = kvp.Key;
113 break;
114 }
115 }
116
117 if (itemID != UUID.Zero)
118 {
119 m_ids.Remove(itemID);
120 m_items.Remove(itemID);
121 }
122 }
123
124 public LayerItem this [int idx]
125 {
126 get
127 {
128 if (idx >= m_ids.Count || idx < 0)
129 return new LayerItem(UUID.Zero, UUID.Zero);
130
131 return new LayerItem(m_ids[idx], m_items[m_ids[idx]]);
132 }
133 }
134 }
135
136 /// <summary> 38 /// <summary>
137 /// Contains the Avatar's Appearance and methods to manipulate the appearance. 39 /// Contains the Avatar's Appearance and methods to manipulate the appearance.
138 /// </summary> 40 /// </summary>
@@ -184,136 +86,6 @@ namespace OpenSim.Framework
184 set { m_wearables = value; } 86 set { m_wearables = value; }
185 } 87 }
186 88
187 public virtual UUID BodyItem {
188 get { return m_wearables[AvatarWearable.BODY].ItemID; }
189 set { m_wearables[AvatarWearable.BODY].ItemID = value; }
190 }
191
192 public virtual UUID BodyAsset {
193 get { return m_wearables[AvatarWearable.BODY].AssetID; }
194 set { m_wearables[AvatarWearable.BODY].AssetID = value; }
195 }
196
197 public virtual UUID SkinItem {
198 get { return m_wearables[AvatarWearable.SKIN].ItemID; }
199 set { m_wearables[AvatarWearable.SKIN].ItemID = value; }
200 }
201
202 public virtual UUID SkinAsset {
203 get { return m_wearables[AvatarWearable.SKIN].AssetID; }
204 set { m_wearables[AvatarWearable.SKIN].AssetID = value; }
205 }
206
207 public virtual UUID HairItem {
208 get { return m_wearables[AvatarWearable.HAIR].ItemID; }
209 set { m_wearables[AvatarWearable.HAIR].ItemID = value; }
210 }
211
212 public virtual UUID HairAsset {
213 get { return m_wearables[AvatarWearable.HAIR].AssetID; }
214 set { m_wearables[AvatarWearable.HAIR].AssetID = value; }
215 }
216
217 public virtual UUID EyesItem {
218 get { return m_wearables[AvatarWearable.EYES].ItemID; }
219 set { m_wearables[AvatarWearable.EYES].ItemID = value; }
220 }
221
222 public virtual UUID EyesAsset {
223 get { return m_wearables[AvatarWearable.EYES].AssetID; }
224 set { m_wearables[AvatarWearable.EYES].AssetID = value; }
225 }
226
227 public virtual UUID ShirtItem {
228 get { return m_wearables[AvatarWearable.SHIRT].ItemID; }
229 set { m_wearables[AvatarWearable.SHIRT].ItemID = value; }
230 }
231
232 public virtual UUID ShirtAsset {
233 get { return m_wearables[AvatarWearable.SHIRT].AssetID; }
234 set { m_wearables[AvatarWearable.SHIRT].AssetID = value; }
235 }
236
237 public virtual UUID PantsItem {
238 get { return m_wearables[AvatarWearable.PANTS].ItemID; }
239 set { m_wearables[AvatarWearable.PANTS].ItemID = value; }
240 }
241
242 public virtual UUID PantsAsset {
243 get { return m_wearables[AvatarWearable.PANTS].AssetID; }
244 set { m_wearables[AvatarWearable.PANTS].AssetID = value; }
245 }
246
247 public virtual UUID ShoesItem {
248 get { return m_wearables[AvatarWearable.SHOES].ItemID; }
249 set { m_wearables[AvatarWearable.SHOES].ItemID = value; }
250 }
251
252 public virtual UUID ShoesAsset {
253 get { return m_wearables[AvatarWearable.SHOES].AssetID; }
254 set { m_wearables[AvatarWearable.SHOES].AssetID = value; }
255 }
256
257 public virtual UUID SocksItem {
258 get { return m_wearables[AvatarWearable.SOCKS].ItemID; }
259 set { m_wearables[AvatarWearable.SOCKS].ItemID = value; }
260 }
261
262 public virtual UUID SocksAsset {
263 get { return m_wearables[AvatarWearable.SOCKS].AssetID; }
264 set { m_wearables[AvatarWearable.SOCKS].AssetID = value; }
265 }
266
267 public virtual UUID JacketItem {
268 get { return m_wearables[AvatarWearable.JACKET].ItemID; }
269 set { m_wearables[AvatarWearable.JACKET].ItemID = value; }
270 }
271
272 public virtual UUID JacketAsset {
273 get { return m_wearables[AvatarWearable.JACKET].AssetID; }
274 set { m_wearables[AvatarWearable.JACKET].AssetID = value; }
275 }
276
277 public virtual UUID GlovesItem {
278 get { return m_wearables[AvatarWearable.GLOVES].ItemID; }
279 set { m_wearables[AvatarWearable.GLOVES].ItemID = value; }
280 }
281
282 public virtual UUID GlovesAsset {
283 get { return m_wearables[AvatarWearable.GLOVES].AssetID; }
284 set { m_wearables[AvatarWearable.GLOVES].AssetID = value; }
285 }
286
287 public virtual UUID UnderShirtItem {
288 get { return m_wearables[AvatarWearable.UNDERSHIRT].ItemID; }
289 set { m_wearables[AvatarWearable.UNDERSHIRT].ItemID = value; }
290 }
291
292 public virtual UUID UnderShirtAsset {
293 get { return m_wearables[AvatarWearable.UNDERSHIRT].AssetID; }
294 set { m_wearables[AvatarWearable.UNDERSHIRT].AssetID = value; }
295 }
296
297 public virtual UUID UnderPantsItem {
298 get { return m_wearables[AvatarWearable.UNDERPANTS].ItemID; }
299 set { m_wearables[AvatarWearable.UNDERPANTS].ItemID = value; }
300 }
301
302 public virtual UUID UnderPantsAsset {
303 get { return m_wearables[AvatarWearable.UNDERPANTS].AssetID; }
304 set { m_wearables[AvatarWearable.UNDERPANTS].AssetID = value; }
305 }
306
307 public virtual UUID SkirtItem {
308 get { return m_wearables[AvatarWearable.SKIRT].ItemID; }
309 set { m_wearables[AvatarWearable.SKIRT].ItemID = value; }
310 }
311
312 public virtual UUID SkirtAsset {
313 get { return m_wearables[AvatarWearable.SKIRT].AssetID; }
314 set { m_wearables[AvatarWearable.SKIRT].AssetID = value; }
315 }
316
317 public virtual float AvatarHeight 89 public virtual float AvatarHeight
318 { 90 {
319 get { return m_avatarHeight; } 91 get { return m_avatarHeight; }
@@ -329,9 +101,8 @@ namespace OpenSim.Framework
329 101
330 public AvatarAppearance(UUID owner) 102 public AvatarAppearance(UUID owner)
331 { 103 {
332// DEBUG ON 104// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner);
333 m_log.WarnFormat("[AVATAR APPEARANCE] create empty appearance for {0}",owner); 105
334// DEBUG OFF
335 m_serial = 1; 106 m_serial = 1;
336 m_owner = owner; 107 m_owner = owner;
337 108
@@ -345,9 +116,8 @@ namespace OpenSim.Framework
345 116
346 public AvatarAppearance(UUID avatarID, OSDMap map) 117 public AvatarAppearance(UUID avatarID, OSDMap map)
347 { 118 {
348// DEBUG ON 119// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance for {0} from OSDMap",avatarID);
349 m_log.WarnFormat("[AVATAR APPEARANCE] create appearance for {0} from OSDMap",avatarID); 120
350// DEBUG OFF
351 m_owner = avatarID; 121 m_owner = avatarID;
352 Unpack(map); 122 Unpack(map);
353 SetHeight(); 123 SetHeight();
@@ -355,9 +125,8 @@ namespace OpenSim.Framework
355 125
356 public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) 126 public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
357 { 127 {
358// DEBUG ON 128// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID);
359 m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); 129
360// DEBUG OFF
361 m_serial = 1; 130 m_serial = 1;
362 m_owner = avatarID; 131 m_owner = avatarID;
363 132
@@ -381,11 +150,14 @@ namespace OpenSim.Framework
381 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 150 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
382 } 151 }
383 152
384 public AvatarAppearance(AvatarAppearance appearance) 153 public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true)
385 { 154 {
386// DEBUG ON 155 }
387 m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance"); 156
388// DEBUG OFF 157 public AvatarAppearance(AvatarAppearance appearance, bool copyWearables)
158 {
159// m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance");
160
389 if (appearance == null) 161 if (appearance == null)
390 { 162 {
391 m_serial = 1; 163 m_serial = 1;
@@ -404,10 +176,11 @@ namespace OpenSim.Framework
404 m_serial = appearance.Serial; 176 m_serial = appearance.Serial;
405 m_owner = appearance.Owner; 177 m_owner = appearance.Owner;
406 178
407 m_wearables = null; 179 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
408 if (appearance.Wearables != null) 180 for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ )
181 m_wearables[i] = new AvatarWearable();
182 if (copyWearables && (appearance.Wearables != null))
409 { 183 {
410 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 13 of these
411 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 184 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
412 SetWearable(i,appearance.Wearables[i]); 185 SetWearable(i,appearance.Wearables[i]);
413 } 186 }
@@ -429,6 +202,28 @@ namespace OpenSim.Framework
429 AppendAttachment(new AvatarAttachment(attachment)); 202 AppendAttachment(new AvatarAttachment(attachment));
430 } 203 }
431 204
205 public void GetAssetsFrom(AvatarAppearance app)
206 {
207 for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ )
208 {
209 for (int j = 0 ; j < m_wearables[i].Count ; j++)
210 {
211 UUID itemID = m_wearables[i][j].ItemID;
212 UUID assetID = app.Wearables[i].GetAsset(itemID);
213
214 if (assetID != UUID.Zero)
215 m_wearables[i].Add(itemID, assetID);
216 }
217 }
218 }
219
220 public void ClearWearables()
221 {
222 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
223 for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ )
224 m_wearables[i] = new AvatarWearable();
225 }
226
432 protected virtual void SetDefaultWearables() 227 protected virtual void SetDefaultWearables()
433 { 228 {
434 m_wearables = AvatarWearable.DefaultWearables; 229 m_wearables = AvatarWearable.DefaultWearables;
@@ -436,11 +231,11 @@ namespace OpenSim.Framework
436 231
437 protected virtual void SetDefaultParams() 232 protected virtual void SetDefaultParams()
438 { 233 {
439 m_visualparams = new byte[VISUALPARAM_COUNT]; 234 m_visualparams = new byte[] { 33,61,85,23,58,127,63,85,63,42,0,85,63,36,85,95,153,63,34,0,63,109,88,132,63,136,81,85,103,136,127,0,150,150,150,127,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,104,0,0,0,0,0,0,0,0,0,145,216,133,0,127,0,127,170,0,0,127,127,109,85,127,127,63,85,42,150,150,150,150,150,150,150,25,150,150,150,0,127,0,0,144,85,127,132,127,85,0,127,127,127,127,127,127,59,127,85,127,127,106,47,79,127,127,204,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,36,85,131,127,127,127,153,95,0,140,75,27,127,127,0,150,150,198,0,0,63,30,127,165,209,198,127,127,153,204,51,51,255,255,255,204,0,255,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,127,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 };
440 for (int i = 0; i < VISUALPARAM_COUNT; i++) 235// for (int i = 0; i < VISUALPARAM_COUNT; i++)
441 { 236// {
442 m_visualparams[i] = 150; 237// m_visualparams[i] = 150;
443 } 238// }
444 } 239 }
445 240
446 protected virtual void SetDefaultTexture() 241 protected virtual void SetDefaultTexture()
@@ -479,10 +274,9 @@ namespace OpenSim.Framework
479 } 274 }
480 275
481 changed = true; 276 changed = true;
482// DEBUG ON 277
483 if (newface != null) 278// if (newface != null)
484 m_log.WarnFormat("[AVATAR APPEARANCE] index {0}, new texture id {1}",i,newface.TextureID); 279// m_log.WarnFormat("[AVATAR APPEARANCE]: index {0}, new texture id {1}",i,newface.TextureID);
485// DEBUG OFF
486 } 280 }
487 281
488 m_texture = textureEntry; 282 m_texture = textureEntry;
@@ -552,7 +346,9 @@ namespace OpenSim.Framework
552// DEBUG ON 346// DEBUG ON
553// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); 347// m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID);
554// DEBUG OFF 348// DEBUG OFF
555 m_wearables[wearableId] = new AvatarWearable(wearable.ItemID,wearable.AssetID); 349 m_wearables[wearableId].Clear();
350 for (int i = 0 ; i < wearable.Count ; i++)
351 m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID);
556 } 352 }
557 353
558 354
@@ -568,7 +364,10 @@ namespace OpenSim.Framework
568 s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID); 364 s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID);
569 365
570 foreach (AvatarWearable awear in m_wearables) 366 foreach (AvatarWearable awear in m_wearables)
571 s += String.Format("Wearable: item={0}, asset={1}\n",awear.ItemID,awear.AssetID); 367 {
368 for ( int i = 0 ; i < awear.Count ; i++ )
369 s += String.Format("Wearable: item={0}, asset={1}\n",awear[i].ItemID,awear[i].AssetID);
370 }
572 371
573 s += "Visual Params: "; 372 s += "Visual Params: ";
574 for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) 373 for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++)
@@ -738,11 +537,11 @@ namespace OpenSim.Framework
738 { 537 {
739 OSDArray wears = (OSDArray)(data["wearables"]); 538 OSDArray wears = (OSDArray)(data["wearables"]);
740 for (int i = 0; i < wears.Count; i++) 539 for (int i = 0; i < wears.Count; i++)
741 m_wearables[i] = new AvatarWearable((OSDMap)wears[i]); 540 m_wearables[i] = new AvatarWearable((OSDArray)wears[i]);
742 } 541 }
743 else 542 else
744 { 543 {
745 m_log.Warn("[AVATARAPPEARANCE] failed to unpack wearables"); 544 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack wearables");
746 } 545 }
747 546
748 // Avatar Textures 547 // Avatar Textures
@@ -760,7 +559,7 @@ namespace OpenSim.Framework
760 } 559 }
761 else 560 else
762 { 561 {
763 m_log.Warn("[AVATARAPPEARANCE] failed to unpack textures"); 562 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack textures");
764 } 563 }
765 564
766 // Visual Parameters 565 // Visual Parameters
@@ -772,7 +571,7 @@ namespace OpenSim.Framework
772 } 571 }
773 else 572 else
774 { 573 {
775 m_log.Warn("[AVATARAPPEARANCE] failed to unpack visual parameters"); 574 m_log.Warn("[AVATAR APPEARANCE]: failed to unpack visual parameters");
776 } 575 }
777 576
778 // Attachments 577 // Attachments
@@ -786,7 +585,7 @@ namespace OpenSim.Framework
786 } 585 }
787 catch (Exception e) 586 catch (Exception e)
788 { 587 {
789 m_log.ErrorFormat("[AVATARAPPEARANCE] unpack failed badly: {0}",e.Message); 588 m_log.ErrorFormat("[AVATAR APPEARANCE]: unpack failed badly: {0}{1}", e.Message, e.StackTrace);
790 } 589 }
791 } 590 }
792 591
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs
index 87098bf..0809ab6 100644
--- a/OpenSim/Framework/AvatarWearable.cs
+++ b/OpenSim/Framework/AvatarWearable.cs
@@ -26,11 +26,24 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using OpenMetaverse; 30using OpenMetaverse;
30using OpenMetaverse.StructuredData; 31using OpenMetaverse.StructuredData;
31 32
32namespace OpenSim.Framework 33namespace OpenSim.Framework
33{ 34{
35 public struct WearableItem
36 {
37 public UUID ItemID;
38 public UUID AssetID;
39
40 public WearableItem(UUID itemID, UUID assetID)
41 {
42 ItemID = itemID;
43 AssetID = assetID;
44 }
45 }
46
34 public class AvatarWearable 47 public class AvatarWearable
35 { 48 {
36 // these are guessed at by the list here - 49 // these are guessed at by the list here -
@@ -49,8 +62,10 @@ namespace OpenSim.Framework
49 public static readonly int UNDERSHIRT = 10; 62 public static readonly int UNDERSHIRT = 10;
50 public static readonly int UNDERPANTS = 11; 63 public static readonly int UNDERPANTS = 11;
51 public static readonly int SKIRT = 12; 64 public static readonly int SKIRT = 12;
65 public static readonly int ALPHA = 13;
66 public static readonly int TATTOO = 14;
52 67
53 public static readonly int MAX_WEARABLES = 13; 68 public static readonly int MAX_WEARABLES = 15;
54 69
55 public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); 70 public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
56 public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); 71 public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
@@ -67,68 +82,171 @@ namespace OpenSim.Framework
67 public static readonly UUID DEFAULT_PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); 82 public static readonly UUID DEFAULT_PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111");
68 public static readonly UUID DEFAULT_PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120"); 83 public static readonly UUID DEFAULT_PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120");
69 84
70 public UUID AssetID; 85// public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8");
71 public UUID ItemID; 86// public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594");
87
88// public static readonly UUID DEFAULT_TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1");
89// public static readonly UUID DEFAULT_TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007");
90
91 private static AvatarWearable[] defaultWearables = null;
92
93 protected Dictionary<UUID, UUID> m_items = new Dictionary<UUID, UUID>();
94 protected List<UUID> m_ids = new List<UUID>();
72 95
73 public AvatarWearable() 96 public AvatarWearable()
74 { 97 {
75 } 98 }
76 99
77 public AvatarWearable(UUID itemId, UUID assetId) 100 public AvatarWearable(UUID itemID, UUID assetID)
78 { 101 {
79 AssetID = assetId; 102 Wear(itemID, assetID);
80 ItemID = itemId;
81 } 103 }
82 104
83 public AvatarWearable(OSDMap args) 105 public AvatarWearable(OSDArray args)
84 { 106 {
85 Unpack(args); 107 Unpack(args);
86 } 108 }
87 109
88 public OSDMap Pack() 110 public OSD Pack()
111 {
112 OSDArray wearlist = new OSDArray();
113
114 foreach (UUID id in m_ids)
115 {
116 OSDMap weardata = new OSDMap();
117 weardata["item"] = OSD.FromUUID(id);
118 weardata["asset"] = OSD.FromUUID(m_items[id]);
119 wearlist.Add(weardata);
120 }
121
122 return wearlist;
123 }
124
125 public void Unpack(OSDArray args)
126 {
127 Clear();
128
129 foreach (OSDMap weardata in args)
130 {
131 Add(weardata["item"].AsUUID(), weardata["asset"].AsUUID());
132 }
133 }
134
135 public int Count
136 {
137 get { return m_ids.Count; }
138 }
139
140 public void Add(UUID itemID, UUID assetID)
141 {
142 if (itemID == UUID.Zero)
143 return;
144 if (m_items.ContainsKey(itemID))
145 {
146 m_items[itemID] = assetID;
147 return;
148 }
149 if (m_ids.Count >= 5)
150 return;
151
152 m_ids.Add(itemID);
153 m_items[itemID] = assetID;
154 }
155
156 public void Wear(WearableItem item)
157 {
158 Wear(item.ItemID, item.AssetID);
159 }
160
161 public void Wear(UUID itemID, UUID assetID)
162 {
163 Clear();
164 Add(itemID, assetID);
165 }
166
167 public void Clear()
168 {
169 m_ids.Clear();
170 m_items.Clear();
171 }
172
173 public void RemoveItem(UUID itemID)
174 {
175 if (m_items.ContainsKey(itemID))
176 {
177 m_ids.Remove(itemID);
178 m_items.Remove(itemID);
179 }
180 }
181
182 public void RemoveAsset(UUID assetID)
89 { 183 {
90 OSDMap weardata = new OSDMap(); 184 UUID itemID = UUID.Zero;
91 weardata["item"] = OSD.FromUUID(ItemID);
92 weardata["asset"] = OSD.FromUUID(AssetID);
93 185
94 return weardata; 186 foreach (KeyValuePair<UUID, UUID> kvp in m_items)
187 {
188 if (kvp.Value == assetID)
189 {
190 itemID = kvp.Key;
191 break;
192 }
193 }
194
195 if (itemID != UUID.Zero)
196 {
197 m_ids.Remove(itemID);
198 m_items.Remove(itemID);
199 }
200 }
201
202 public WearableItem this [int idx]
203 {
204 get
205 {
206 if (idx >= m_ids.Count || idx < 0)
207 return new WearableItem(UUID.Zero, UUID.Zero);
208
209 return new WearableItem(m_ids[idx], m_items[m_ids[idx]]);
210 }
95 } 211 }
96 212
97 public void Unpack(OSDMap args) 213 public UUID GetAsset(UUID itemID)
98 { 214 {
99 ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero; 215 if (!m_items.ContainsKey(itemID))
100 AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero; 216 return UUID.Zero;
217 return m_items[itemID];
101 } 218 }
102 219
103 public static AvatarWearable[] DefaultWearables 220 public static AvatarWearable[] DefaultWearables
104 { 221 {
105 get 222 get
106 { 223 {
107 AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 13 of these 224 defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these
108 for (int i = 0; i < MAX_WEARABLES; i++) 225 for (int i = 0; i < MAX_WEARABLES; i++)
109 { 226 {
110 defaultWearables[i] = new AvatarWearable(); 227 defaultWearables[i] = new AvatarWearable();
111 } 228 }
112 229
113 // Body 230 // Body
114 defaultWearables[0].ItemID = DEFAULT_BODY_ITEM; 231 defaultWearables[BODY].Add(DEFAULT_BODY_ITEM, DEFAULT_BODY_ASSET);
115 defaultWearables[0].AssetID = DEFAULT_BODY_ASSET;
116 232
117 // Hair 233 // Hair
118 defaultWearables[2].ItemID = DEFAULT_HAIR_ITEM; 234 defaultWearables[HAIR].Add(DEFAULT_HAIR_ITEM, DEFAULT_HAIR_ASSET);
119 defaultWearables[2].AssetID = DEFAULT_HAIR_ASSET;
120 235
121 // Skin 236 // Skin
122 defaultWearables[1].ItemID = DEFAULT_SKIN_ITEM; 237 defaultWearables[SKIN].Add(DEFAULT_SKIN_ITEM, DEFAULT_SKIN_ASSET);
123 defaultWearables[1].AssetID = DEFAULT_SKIN_ASSET;
124 238
125 // Shirt 239 // Shirt
126 defaultWearables[4].ItemID = DEFAULT_SHIRT_ITEM; 240 defaultWearables[SHIRT].Add(DEFAULT_SHIRT_ITEM, DEFAULT_SHIRT_ASSET);
127 defaultWearables[4].AssetID = DEFAULT_SHIRT_ASSET;
128 241
129 // Pants 242 // Pants
130 defaultWearables[5].ItemID = DEFAULT_PANTS_ITEM; 243 defaultWearables[PANTS].Add(DEFAULT_PANTS_ITEM, DEFAULT_PANTS_ASSET);
131 defaultWearables[5].AssetID = DEFAULT_PANTS_ASSET; 244
245// // Alpha
246// defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET);
247
248// // Tattoo
249// defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET);
132 250
133 return defaultWearables; 251 return defaultWearables;
134 } 252 }
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index 872de9a..7b0e053 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -988,9 +988,7 @@ namespace OpenSim.Framework.Capabilities
988 988
989 public void BakedTextureUploaded(UUID assetID, byte[] data) 989 public void BakedTextureUploaded(UUID assetID, byte[] data)
990 { 990 {
991// DEBUG ON 991// m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
992 m_log.WarnFormat("[CAPS]: Received baked texture {0}", assetID.ToString());
993// DEBUG OFF
994 AssetBase asset; 992 AssetBase asset;
995 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString()); 993 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_agentID.ToString());
996 asset.Data = data; 994 asset.Data = data;
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 66487f7..ddfaaed 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -414,12 +414,10 @@ namespace OpenSim.Framework
414 // We might not pass this in all cases... 414 // We might not pass this in all cases...
415 if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) 415 if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0))
416 { 416 {
417 OSDArray wears = new OSDArray(Appearance.Wearables.Length * 2); 417 OSDArray wears = new OSDArray(Appearance.Wearables.Length);
418 foreach (AvatarWearable awear in Appearance.Wearables) 418 foreach (AvatarWearable awear in Appearance.Wearables)
419 { 419 wears.Add(awear.Pack());
420 wears.Add(OSD.FromUUID(awear.ItemID)); 420
421 wears.Add(OSD.FromUUID(awear.AssetID));
422 }
423 args["wearables"] = wears; 421 args["wearables"] = wears;
424 } 422 }
425 423
@@ -592,7 +590,7 @@ namespace OpenSim.Framework
592 OSDArray wears = (OSDArray)(args["wearables"]); 590 OSDArray wears = (OSDArray)(args["wearables"]);
593 for (int i = 0; i < wears.Count / 2; i++) 591 for (int i = 0; i < wears.Count / 2; i++)
594 { 592 {
595 AvatarWearable awear = new AvatarWearable(wears[i*2].AsUUID(),wears[(i*2)+1].AsUUID()); 593 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
596 Appearance.SetWearable(i,awear); 594 Appearance.SetWearable(i,awear);
597 } 595 }
598 } 596 }
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs
index 7eb289b..07de27a 100644
--- a/OpenSim/Framework/Console/RemoteConsole.cs
+++ b/OpenSim/Framework/Console/RemoteConsole.cs
@@ -32,6 +32,7 @@ using System.Collections.Generic;
32using System.Diagnostics; 32using System.Diagnostics;
33using System.Reflection; 33using System.Reflection;
34using System.Text; 34using System.Text;
35using System.Text.RegularExpressions;
35using System.Threading; 36using System.Threading;
36using OpenMetaverse; 37using OpenMetaverse;
37using Nini.Config; 38using Nini.Config;
@@ -62,6 +63,7 @@ namespace OpenSim.Framework.Console
62 new Dictionary<UUID, ConsoleConnection>(); 63 new Dictionary<UUID, ConsoleConnection>();
63 private string m_UserName = String.Empty; 64 private string m_UserName = String.Empty;
64 private string m_Password = String.Empty; 65 private string m_Password = String.Empty;
66 private string m_AllowedOrigin = String.Empty;
65 67
66 public RemoteConsole(string defaultPrompt) : base(defaultPrompt) 68 public RemoteConsole(string defaultPrompt) : base(defaultPrompt)
67 { 69 {
@@ -77,6 +79,7 @@ namespace OpenSim.Framework.Console
77 79
78 m_UserName = netConfig.GetString("ConsoleUser", String.Empty); 80 m_UserName = netConfig.GetString("ConsoleUser", String.Empty);
79 m_Password = netConfig.GetString("ConsolePass", String.Empty); 81 m_Password = netConfig.GetString("ConsolePass", String.Empty);
82 m_AllowedOrigin = netConfig.GetString("ConsoleAllowedOrigin", String.Empty);
80 } 83 }
81 84
82 public void SetServer(IHttpServer server) 85 public void SetServer(IHttpServer server)
@@ -150,6 +153,29 @@ namespace OpenSim.Framework.Console
150 return cmdinput; 153 return cmdinput;
151 } 154 }
152 155
156 private Hashtable CheckOrigin(Hashtable result)
157 {
158 if (!string.IsNullOrEmpty(m_AllowedOrigin))
159 result["access_control_allow_origin"] = m_AllowedOrigin;
160 return result;
161 }
162 /* TODO: Figure out how PollServiceHTTPHandler can access the request headers
163 * in order to use m_AllowedOrigin as a regular expression
164 private Hashtable CheckOrigin(Hashtable headers, Hashtable result)
165 {
166 if (!string.IsNullOrEmpty(m_AllowedOrigin))
167 {
168 if (headers.ContainsKey("origin"))
169 {
170 string origin = headers["origin"].ToString();
171 if (Regex.IsMatch(origin, m_AllowedOrigin))
172 result["access_control_allow_origin"] = origin;
173 }
174 }
175 return result;
176 }
177 */
178
153 private void DoExpire() 179 private void DoExpire()
154 { 180 {
155 List<UUID> expired = new List<UUID>(); 181 List<UUID> expired = new List<UUID>();
@@ -235,6 +261,7 @@ namespace OpenSim.Framework.Console
235 reply["str_response_string"] = xmldoc.InnerXml; 261 reply["str_response_string"] = xmldoc.InnerXml;
236 reply["int_response_code"] = 200; 262 reply["int_response_code"] = 200;
237 reply["content_type"] = "text/xml"; 263 reply["content_type"] = "text/xml";
264 reply = CheckOrigin(reply);
238 265
239 return reply; 266 return reply;
240 } 267 }
@@ -289,6 +316,7 @@ namespace OpenSim.Framework.Console
289 reply["str_response_string"] = xmldoc.InnerXml; 316 reply["str_response_string"] = xmldoc.InnerXml;
290 reply["int_response_code"] = 200; 317 reply["int_response_code"] = 200;
291 reply["content_type"] = "text/xml"; 318 reply["content_type"] = "text/xml";
319 reply = CheckOrigin(reply);
292 320
293 return reply; 321 return reply;
294 } 322 }
@@ -344,6 +372,7 @@ namespace OpenSim.Framework.Console
344 reply["str_response_string"] = xmldoc.InnerXml; 372 reply["str_response_string"] = xmldoc.InnerXml;
345 reply["int_response_code"] = 200; 373 reply["int_response_code"] = 200;
346 reply["content_type"] = "text/xml"; 374 reply["content_type"] = "text/xml";
375 reply = CheckOrigin(reply);
347 376
348 return reply; 377 return reply;
349 } 378 }
@@ -457,6 +486,7 @@ namespace OpenSim.Framework.Console
457 result["content_type"] = "application/xml"; 486 result["content_type"] = "application/xml";
458 result["keepalive"] = false; 487 result["keepalive"] = false;
459 result["reusecontext"] = false; 488 result["reusecontext"] = false;
489 result = CheckOrigin(result);
460 490
461 return result; 491 return result;
462 } 492 }
@@ -480,6 +510,7 @@ namespace OpenSim.Framework.Console
480 result["content_type"] = "text/xml"; 510 result["content_type"] = "text/xml";
481 result["keepalive"] = false; 511 result["keepalive"] = false;
482 result["reusecontext"] = false; 512 result["reusecontext"] = false;
513 result = CheckOrigin(result);
483 514
484 return result; 515 return result;
485 } 516 }
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index ba8c194..30505f6 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -1450,6 +1450,10 @@ namespace OpenSim.Framework.Servers.HttpServer
1450 if (responsedata.ContainsKey("reusecontext")) 1450 if (responsedata.ContainsKey("reusecontext"))
1451 response.ReuseContext = (bool) responsedata["reusecontext"]; 1451 response.ReuseContext = (bool) responsedata["reusecontext"];
1452 1452
1453 // Cross-Origin Resource Sharing with simple requests
1454 if (responsedata.ContainsKey("access_control_allow_origin"))
1455 response.AddHeader("Access-Control-Allow-Origin", (string)responsedata["access_control_allow_origin"]);
1456
1453 //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this 1457 //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
1454 //and should check for NullReferenceExceptions 1458 //and should check for NullReferenceExceptions
1455 1459
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 4ae370b..f852e54 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -69,6 +69,6 @@ namespace OpenSim
69 /// of the code that is too old. 69 /// of the code that is too old.
70 /// 70 ///
71 /// </value> 71 /// </value>
72 public readonly static int MajorInterfaceVersion = 6; 72 public readonly static int MajorInterfaceVersion = 7;
73 } 73 }
74} 74}
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index edbae59..5969be0 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -264,9 +264,10 @@ namespace OpenSim
264 LoadOar); 264 LoadOar);
265 265
266 m_console.Commands.AddCommand("region", false, "save oar", 266 m_console.Commands.AddCommand("region", false, "save oar",
267 "save oar [<OAR path>]", 267 "save oar [-v|version=N] [<OAR path>]",
268 "Save a region's data to an OAR archive.", 268 "Save a region's data to an OAR archive.",
269 "The OAR path must be a filesystem path." 269 "-v|version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
270 + "The OAR path must be a filesystem path."
270 + " If this is not given then the oar is saved to region.oar in the current directory.", 271 + " If this is not given then the oar is saved to region.oar in the current directory.",
271 SaveOar); 272 SaveOar);
272 273
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index b532cd4..4c9011a 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3417,20 +3417,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3417 aw.AgentData.SerialNum = (uint)serial; 3417 aw.AgentData.SerialNum = (uint)serial;
3418 aw.AgentData.SessionID = m_sessionId; 3418 aw.AgentData.SessionID = m_sessionId;
3419 3419
3420 int count = 0;
3421 for (int i = 0; i < wearables.Length; i++)
3422 count += wearables[i].Count;
3423
3420 // TODO: don't create new blocks if recycling an old packet 3424 // TODO: don't create new blocks if recycling an old packet
3421 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; 3425 aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count];
3422 AgentWearablesUpdatePacket.WearableDataBlock awb; 3426 AgentWearablesUpdatePacket.WearableDataBlock awb;
3427 int idx = 0;
3423 for (int i = 0; i < wearables.Length; i++) 3428 for (int i = 0; i < wearables.Length; i++)
3424 { 3429 {
3425 awb = new AgentWearablesUpdatePacket.WearableDataBlock(); 3430 for (int j = 0; j < wearables[i].Count; j++)
3426 awb.WearableType = (byte)i; 3431 {
3427 awb.AssetID = wearables[i].AssetID; 3432 awb = new AgentWearablesUpdatePacket.WearableDataBlock();
3428 awb.ItemID = wearables[i].ItemID; 3433 awb.WearableType = (byte)i;
3429 aw.WearableData[i] = awb; 3434 awb.AssetID = wearables[i][j].AssetID;
3435 awb.ItemID = wearables[i][j].ItemID;
3436 aw.WearableData[idx] = awb;
3437 idx++;
3430 3438
3431// m_log.DebugFormat( 3439// m_log.DebugFormat(
3432// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", 3440// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
3433// awb.ItemID, awb.AssetID, i, Name); 3441// awb.ItemID, awb.AssetID, i, Name);
3442 }
3434 } 3443 }
3435 3444
3436 OutPacket(aw, ThrottleOutPacketType.Task); 3445 OutPacket(aw, ThrottleOutPacketType.Task);
@@ -5759,6 +5768,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5759 AvatarWearingArgs wearingArgs = new AvatarWearingArgs(); 5768 AvatarWearingArgs wearingArgs = new AvatarWearingArgs();
5760 for (int i = 0; i < nowWearing.WearableData.Length; i++) 5769 for (int i = 0; i < nowWearing.WearableData.Length; i++)
5761 { 5770 {
5771 m_log.DebugFormat("[XXX]: Wearable type {0} item {1}", nowWearing.WearableData[i].WearableType, nowWearing.WearableData[i].ItemID);
5762 AvatarWearingArgs.Wearable wearable = 5772 AvatarWearingArgs.Wearable wearable =
5763 new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID, 5773 new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID,
5764 nowWearing.WearableData[i].WearableType); 5774 nowWearing.WearableData[i].WearableType);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index e2cda6d..b8c692f 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -183,7 +183,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
183 IConfig config = configSource.Configs["ClientStack.LindenUDP"]; 183 IConfig config = configSource.Configs["ClientStack.LindenUDP"];
184 if (config != null) 184 if (config != null)
185 { 185 {
186 m_asyncPacketHandling = config.GetBoolean("async_packet_handling", false); 186 m_asyncPacketHandling = config.GetBoolean("async_packet_handling", true);
187 m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0); 187 m_recvBufferSize = config.GetInt("client_socket_rcvbuf_size", 0);
188 sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0); 188 sceneThrottleBps = config.GetInt("scene_throttle_max_bps", 0);
189 189
@@ -615,8 +615,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
615 615
616 // UseCircuitCode handling 616 // UseCircuitCode handling
617 if (packet.Type == PacketType.UseCircuitCode) 617 if (packet.Type == PacketType.UseCircuitCode)
618 { 618 {
619 m_log.Debug("[LLUDPSERVER]: Handling UseCircuitCode packet from " + buffer.RemoteEndPoint);
620 object[] array = new object[] { buffer, packet }; 619 object[] array = new object[] { buffer, packet };
621 620
622 if (m_asyncPacketHandling) 621 if (m_asyncPacketHandling)
@@ -827,9 +826,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
827 826
828 private void HandleUseCircuitCode(object o) 827 private void HandleUseCircuitCode(object o)
829 { 828 {
829 DateTime startTime = DateTime.Now;
830 object[] array = (object[])o; 830 object[] array = (object[])o;
831 UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; 831 UDPPacketBuffer buffer = (UDPPacketBuffer)array[0];
832 UseCircuitCodePacket packet = (UseCircuitCodePacket)array[1]; 832 UseCircuitCodePacket packet = (UseCircuitCodePacket)array[1];
833
834 m_log.DebugFormat("[LLUDPSERVER]: Handling UseCircuitCode request from {0}", buffer.RemoteEndPoint);
833 835
834 IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; 836 IPEndPoint remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint;
835 837
@@ -838,6 +840,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
838 840
839 // Acknowledge the UseCircuitCode packet 841 // Acknowledge the UseCircuitCode packet
840 SendAckImmediate(remoteEndPoint, packet.Header.Sequence); 842 SendAckImmediate(remoteEndPoint, packet.Header.Sequence);
843
844 m_log.DebugFormat(
845 "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
846 buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
841 } 847 }
842 848
843 private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber) 849 private void SendAckImmediate(IPEndPoint remoteEndpoint, uint sequenceNumber)
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index bfbbcf8..7f482cb 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
117 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 117 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
118 if (sp == null) 118 if (sp == null)
119 { 119 {
120 m_log.WarnFormat("[AVFACTORY] SetAppearance unable to find presence for {0}",client.AgentId); 120 m_log.WarnFormat("[AVATAR FACTORY MODULE]: SetAppearance unable to find presence for {0}", client.AgentId);
121 return false; 121 return false;
122 } 122 }
123 123
@@ -147,14 +147,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
147 /// <param name="visualParam"></param> 147 /// <param name="visualParam"></param>
148 public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) 148 public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams)
149 { 149 {
150// DEBUG ON 150// m_log.WarnFormat("[AVATAR FACTORY MODULE]: SetAppearance for {0}",client.AgentId);
151 m_log.WarnFormat("[AVFACTORY] SetAppearance for {0}",client.AgentId);
152// DEBUG OFF
153 151
154 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 152 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
155 if (sp == null) 153 if (sp == null)
156 { 154 {
157 m_log.WarnFormat("[AVFACTORY] SetAppearance unable to find presence for {0}",client.AgentId); 155 m_log.WarnFormat("[AVATAR FACTORY MODULE]: SetAppearance unable to find presence for {0}",client.AgentId);
158 return; 156 return;
159 } 157 }
160 158
@@ -212,8 +210,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
212 { 210 {
213 if (m_scene.AssetService.Get(textureID.ToString()) == null) 211 if (m_scene.AssetService.Get(textureID.ToString()) == null)
214 { 212 {
215 m_log.WarnFormat("[AVFACTORY]: Missing baked texture {0} ({1}) for avatar {2}", 213 m_log.WarnFormat("[AVATAR FACTORY MODULE]: Missing baked texture {0} ({1}) for avatar {2}",
216 textureID,idx,client.Name); 214 textureID, idx, client.Name);
217 return false; 215 return false;
218 } 216 }
219 return true; 217 return true;
@@ -223,9 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
223 221
224 public void QueueAppearanceSend(UUID agentid) 222 public void QueueAppearanceSend(UUID agentid)
225 { 223 {
226// DEBUG ON 224// m_log.WarnFormat("[AVATAR FACTORY MODULE]: Queue appearance send for {0}",agentid);
227 m_log.WarnFormat("[AVFACTORY] Queue appearance send for {0}",agentid);
228// DEBUG OFF
229 225
230 // 100 nanoseconds (ticks) we should wait 226 // 100 nanoseconds (ticks) we should wait
231 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 10000000); 227 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 10000000);
@@ -238,9 +234,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
238 234
239 public void QueueAppearanceSave(UUID agentid) 235 public void QueueAppearanceSave(UUID agentid)
240 { 236 {
241// DEBUG ON 237// m_log.WarnFormat("[AVATAR FACTORY MODULE]: Queue appearance save for {0}",agentid);
242 m_log.WarnFormat("[AVFACTORY] Queue appearance save for {0}",agentid);
243// DEBUG OFF
244 238
245 // 100 nanoseconds (ticks) we should wait 239 // 100 nanoseconds (ticks) we should wait
246 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_savetime * 10000000); 240 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_savetime * 10000000);
@@ -256,13 +250,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
256 ScenePresence sp = m_scene.GetScenePresence(agentid); 250 ScenePresence sp = m_scene.GetScenePresence(agentid);
257 if (sp == null) 251 if (sp == null)
258 { 252 {
259 m_log.WarnFormat("[AVFACTORY] Agent {0} no longer in the scene",agentid); 253 m_log.WarnFormat("[AVATAR FACTORY MODULE]: Agent {0} no longer in the scene", agentid);
260 return; 254 return;
261 } 255 }
262 256
263// DEBUG ON 257// m_log.WarnFormat("[AVATAR FACTORY MODULE]: Handle appearance send for {0}", agentid);
264 m_log.WarnFormat("[AVFACTORY] Handle appearance send for {0}",agentid);
265// DEBUG OFF
266 258
267 // Send the appearance to everyone in the scene 259 // Send the appearance to everyone in the scene
268 sp.SendAppearanceToAllOtherAgents(); 260 sp.SendAppearanceToAllOtherAgents();
@@ -288,7 +280,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
288 ScenePresence sp = m_scene.GetScenePresence(agentid); 280 ScenePresence sp = m_scene.GetScenePresence(agentid);
289 if (sp == null) 281 if (sp == null)
290 { 282 {
291 m_log.WarnFormat("[AVFACTORY] Agent {0} no longer in the scene",agentid); 283 m_log.WarnFormat("[AVATAR FACTORY MODULE]: Agent {0} no longer in the scene", agentid);
292 return; 284 return;
293 } 285 }
294 286
@@ -339,13 +331,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
339 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 331 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
340 if (sp == null) 332 if (sp == null)
341 { 333 {
342 m_log.WarnFormat("[AVFACTORY] SendWearables unable to find presence for {0}",client.AgentId); 334 m_log.WarnFormat("[AVATAR FACTORY MODULE]: SendWearables unable to find presence for {0}", client.AgentId);
343 return; 335 return;
344 } 336 }
345 337
346// DEBUG ON 338// m_log.WarnFormat("[AVATAR FACTORY MODULE]: Received request for wearables of {0}", client.AgentId);
347 m_log.WarnFormat("[AVFACTORY]: Received request for wearables of {0}", client.AgentId); 339
348// DEBUG OFF
349 client.SendWearables(sp.Appearance.Wearables,sp.Appearance.Serial++); 340 client.SendWearables(sp.Appearance.Wearables,sp.Appearance.Serial++);
350 } 341 }
351 342
@@ -359,25 +350,22 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
359 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 350 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
360 if (sp == null) 351 if (sp == null)
361 { 352 {
362 m_log.WarnFormat("[AVFACTORY] AvatarIsWearing unable to find presence for {0}",client.AgentId); 353 m_log.WarnFormat("[AVATAR FACTORY MODULE]: AvatarIsWearing unable to find presence for {0}", client.AgentId);
363 return; 354 return;
364 } 355 }
365 356
366// DEBUG ON 357// m_log.WarnFormat("[AVATAR FACTORY MODULE]: AvatarIsWearing called for {0}",client.AgentId);
367 m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}",client.AgentId);
368// DEBUG OFF
369 358
370 AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance); 359 AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false);
371 360
372 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) 361 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
373 { 362 {
374 if (wear.Type < AvatarWearable.MAX_WEARABLES) 363 if (wear.Type < AvatarWearable.MAX_WEARABLES)
375 { 364 avatAppearance.Wearables[wear.Type].Add(wear.ItemID,UUID.Zero);
376 AvatarWearable newWearable = new AvatarWearable(wear.ItemID,UUID.Zero);
377 avatAppearance.SetWearable(wear.Type, newWearable);
378 }
379 } 365 }
380 366
367 avatAppearance.GetAssetsFrom(sp.Appearance);
368
381 // This could take awhile since it needs to pull inventory 369 // This could take awhile since it needs to pull inventory
382 SetAppearanceAssets(sp.UUID, ref avatAppearance); 370 SetAppearanceAssets(sp.UUID, ref avatAppearance);
383 371
@@ -393,34 +381,35 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
393 { 381 {
394 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 382 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
395 { 383 {
396 if (appearance.Wearables[i].ItemID == UUID.Zero) 384 for (int j = 0 ; j < appearance.Wearables[j].Count ; j ++ )
397 {
398 appearance.Wearables[i].AssetID = UUID.Zero;
399 }
400 else
401 { 385 {
402 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID); 386 if (appearance.Wearables[i][j].ItemID == UUID.Zero)
387 continue;
388
389 // Ignore ruth's assets
390 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID)
391 continue;
392 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID);
403 baseItem = invService.GetItem(baseItem); 393 baseItem = invService.GetItem(baseItem);
404 394
405 if (baseItem != null) 395 if (baseItem != null)
406 { 396 {
407 appearance.Wearables[i].AssetID = baseItem.AssetID; 397 appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID);
408 } 398 }
409 else 399 else
410 { 400 {
411 m_log.ErrorFormat( 401 m_log.ErrorFormat(
412 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", 402 "[AVATAR FACTORY MODULE]: Can't find inventory item {0} for {1}, setting to default",
413 appearance.Wearables[i].ItemID, (WearableType)i); 403 appearance.Wearables[i][j].ItemID, (WearableType)i);
414 404
415 appearance.Wearables[i].ItemID = UUID.Zero; 405 appearance.Wearables[i].RemoveItem(appearance.Wearables[i][j].ItemID);
416 appearance.Wearables[i].AssetID = UUID.Zero;
417 } 406 }
418 } 407 }
419 } 408 }
420 } 409 }
421 else 410 else
422 { 411 {
423 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); 412 m_log.WarnFormat("[AVATAR FACTORY MODULE]: user {0} has no inventory, appearance isn't going to work", userID);
424 } 413 }
425 } 414 }
426 } 415 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 9080e1c..d81703a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -173,28 +173,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
173 173
174 InventoryCollection contents 174 InventoryCollection contents
175 = m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID); 175 = m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID);
176 //List<InventoryFolderImpl> childFolders = inventoryFolder.RequestListOfFolderImpls();
177 //List<InventoryItemBase> items = inventoryFolder.RequestListOfItems();
178
179 /*
180 Dictionary identicalFolderNames = new Dictionary<string, int>();
181
182 foreach (InventoryFolderImpl folder in inventories)
183 {
184 if (!identicalFolderNames.ContainsKey(folder.Name))
185 identicalFolderNames[folder.Name] = 0;
186 else
187 identicalFolderNames[folder.Name] = identicalFolderNames[folder.Name]++;
188
189 int folderNameNumber = identicalFolderName[folder.Name];
190
191 SaveInvDir(
192 folder,
193 string.Format(
194 "{0}{1}{2}/",
195 path, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, folderNameNumber));
196 }
197 */
198 176
199 foreach (InventoryFolderBase childFolder in contents.Folders) 177 foreach (InventoryFolderBase childFolder in contents.Folders)
200 { 178 {
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 2921b0d..3c7638d 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -193,10 +193,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
193 GridRegion finalDestination = GetFinalDestination(reg); 193 GridRegion finalDestination = GetFinalDestination(reg);
194 if (finalDestination == null) 194 if (finalDestination == null)
195 { 195 {
196 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport agent."); 196 m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination is having problems. Unable to teleport agent.");
197 sp.ControllingClient.SendTeleportFailed("Problem at destination"); 197 sp.ControllingClient.SendTeleportFailed("Problem at destination");
198 return; 198 return;
199 } 199 }
200
200 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", 201 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}",
201 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); 202 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID);
202 203
@@ -240,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
240 } 241 }
241 catch (Exception e) 242 catch (Exception e)
242 { 243 {
243 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0}\n{1}", e.Message, e.StackTrace); 244 m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Exception on teleport: {0}\n{1}", e.Message, e.StackTrace);
244 sp.ControllingClient.SendTeleportFailed("Internal error"); 245 sp.ControllingClient.SendTeleportFailed("Internal error");
245 } 246 }
246 } 247 }
@@ -421,7 +422,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
421 m_log.DebugFormat( 422 m_log.DebugFormat(
422 "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); 423 "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID);
423 424
424
425 if (eq != null) 425 if (eq != null)
426 { 426 {
427 eq.TeleportFinishEvent(destinationHandle, 13, endPoint, 427 eq.TeleportFinishEvent(destinationHandle, 13, endPoint,
@@ -594,7 +594,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
594 client.SendTeleportFailed("Your home region could not be found."); 594 client.SendTeleportFailed("Your home region could not be found.");
595 return false; 595 return false;
596 } 596 }
597 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", 597
598 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})",
598 regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize); 599 regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize);
599 600
600 // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point... 601 // a little eekie that this goes back to Scene and with a forced cast, will fix that at some point...
@@ -1217,7 +1218,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1217 Utils.LongToUInts(reg.RegionHandle, out x, out y); 1218 Utils.LongToUInts(reg.RegionHandle, out x, out y);
1218 x = x / Constants.RegionSize; 1219 x = x / Constants.RegionSize;
1219 y = y / Constants.RegionSize; 1220 y = y / Constants.RegionSize;
1220 m_log.Info("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); 1221 m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")");
1221 1222
1222 string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort 1223 string capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
1223 + "/CAPS/" + a.CapsPath + "0000/"; 1224 + "/CAPS/" + a.CapsPath + "0000/";
@@ -1253,7 +1254,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1253 // TODO: make Event Queue disablable! 1254 // TODO: make Event Queue disablable!
1254 } 1255 }
1255 1256
1256 m_log.Info("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); 1257 m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString());
1257 1258
1258 } 1259 }
1259 1260
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
index c23cea5..ed3e516 100644
--- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -176,44 +176,44 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
176 stream = response.GetResponseStream(); 176 stream = response.GetResponseStream();
177 if (stream != null) 177 if (stream != null)
178 { 178 {
179 Bitmap image = new Bitmap(stream);
180 Size newsize;
181
182 // TODO: make this a bit less hard coded
183 if ((image.Height < 64) && (image.Width < 64))
184 {
185 newsize = new Size(32, 32);
186 }
187 else if ((image.Height < 128) && (image.Width < 128))
188 {
189 newsize = new Size(64, 64);
190 }
191 else if ((image.Height < 256) && (image.Width < 256))
192 {
193 newsize = new Size(128, 128);
194 }
195 else if ((image.Height < 512 && image.Width < 512))
196 {
197 newsize = new Size(256, 256);
198 }
199 else if ((image.Height < 1024 && image.Width < 1024))
200 {
201 newsize = new Size(512, 512);
202 }
203 else
204 {
205 newsize = new Size(1024, 1024);
206 }
207
208 Bitmap resize = new Bitmap(image, newsize);
209
210 try 179 try
211 { 180 {
181 Bitmap image = new Bitmap(stream);
182 Size newsize;
183
184 // TODO: make this a bit less hard coded
185 if ((image.Height < 64) && (image.Width < 64))
186 {
187 newsize = new Size(32, 32);
188 }
189 else if ((image.Height < 128) && (image.Width < 128))
190 {
191 newsize = new Size(64, 64);
192 }
193 else if ((image.Height < 256) && (image.Width < 256))
194 {
195 newsize = new Size(128, 128);
196 }
197 else if ((image.Height < 512 && image.Width < 512))
198 {
199 newsize = new Size(256, 256);
200 }
201 else if ((image.Height < 1024 && image.Width < 1024))
202 {
203 newsize = new Size(512, 512);
204 }
205 else
206 {
207 newsize = new Size(1024, 1024);
208 }
209
210 Bitmap resize = new Bitmap(image, newsize);
211
212 imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 212 imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
213 } 213 }
214 catch (Exception) 214 catch (Exception)
215 { 215 {
216 m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Encode Failed. Empty byte data returned!"); 216 m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Conversion Failed. Empty byte data returned!");
217 } 217 }
218 } 218 }
219 else 219 else
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
index a64f785..6543845 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser
65 65
66 public void OnMakeRootAgent(ScenePresence sp) 66 public void OnMakeRootAgent(ScenePresence sp)
67 { 67 {
68 m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); 68// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
69 m_GridUserService.SetLastPosition(sp.UUID.ToString(), UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 69 m_GridUserService.SetLastPosition(sp.UUID.ToString(), UUID.Zero, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
70 } 70 }
71 71
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 34205e3..bd01bb9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
261 261
262 public InventoryItemBase GetItem(InventoryItemBase item) 262 public InventoryItemBase GetItem(InventoryItemBase item)
263 { 263 {
264 m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID); 264 //m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
265 if (item == null) 265 if (item == null)
266 return null; 266 return null;
267 267
@@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
272 272
273 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 273 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
274 { 274 {
275 m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); 275 //m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
276 if (folder == null) 276 if (folder == null)
277 return null; 277 return null;
278 278
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
index 62b8278..fa5b873 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -71,7 +71,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence
71 71
72 public void OnMakeRootAgent(ScenePresence sp) 72 public void OnMakeRootAgent(ScenePresence sp)
73 { 73 {
74 m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); 74// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
75 m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID); 75 m_PresenceService.ReportAgent(sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID);
76 } 76 }
77 77
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
index c062833..f8a599a 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -137,16 +137,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
137 137
138 m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); 138 m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive.");
139 139
140 Dictionary<string, object> serializationOptions = new Dictionary<string, object>(); 140
141// if (m_options.ContainsKey("version") && (string)m_options["version"] == "0")
142// serializationOptions["old-guids"] = true;
143
144 // Write out scene object metadata 141 // Write out scene object metadata
145 foreach (SceneObjectGroup sceneObject in m_sceneObjects) 142 foreach (SceneObjectGroup sceneObject in m_sceneObjects)
146 { 143 {
147 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); 144 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
148 145
149 string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions); 146 string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options);
150 m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); 147 m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject);
151 } 148 }
152 149
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 3182079..0567a82 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -187,20 +187,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver
187 /// <returns></returns> 187 /// <returns></returns>
188 public static string Create0p2ControlFile(Dictionary<string, object> options) 188 public static string Create0p2ControlFile(Dictionary<string, object> options)
189 { 189 {
190 int majorVersion = 0, minorVersion = 4; 190 int majorVersion = 0, minorVersion = 5;
191 191
192 /* 192 if (options.ContainsKey("version"))
193 if (options.ContainsKey("version") && (string)options["version"] == "0")
194 {
195 majorVersion = 0;
196 minorVersion = 3;
197 }
198 else
199 { 193 {
200 majorVersion = 1;
201 minorVersion = 0; 194 minorVersion = 0;
195 string[] parts = options["version"].ToString().Split('.');
196 if (parts.Length >= 1)
197 majorVersion = Int32.Parse(parts[0]);
198 if (parts.Length >= 2)
199 minorVersion = Int32.Parse(parts[1]);
202 } 200 }
203 */
204 201
205 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); 202 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
206// if (majorVersion == 1) 203// if (majorVersion == 1)
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
index 00b506e..6eb57eb 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
@@ -355,7 +355,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
355 if (renderMesh == null) 355 if (renderMesh == null)
356 return; 356 return;
357 357
358 warp_Vector primPos = ConvertVector(prim.AbsolutePosition); 358 warp_Vector primPos = ConvertVector(prim.GetWorldPosition());
359 warp_Quaternion primRot = ConvertQuaternion(prim.RotationOffset); 359 warp_Quaternion primRot = ConvertQuaternion(prim.RotationOffset);
360 360
361 warp_Matrix m = warp_Matrix.quaternionMatrix(primRot); 361 warp_Matrix m = warp_Matrix.quaternionMatrix(primRot);
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index a182eea..3e478b0 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -324,7 +324,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
324 if (threadrunning) return; 324 if (threadrunning) return;
325 threadrunning = true; 325 threadrunning = true;
326 326
327 m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread"); 327// m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread");
328 328
329 Watchdog.StartThread(process, "MapItemRequestThread", ThreadPriority.BelowNormal, true); 329 Watchdog.StartThread(process, "MapItemRequestThread", ThreadPriority.BelowNormal, true);
330 } 330 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index dafc1af..2a48be9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -177,7 +177,6 @@ namespace OpenSim.Region.Framework.Scenes
177 private float m_health = 100f; 177 private float m_health = 100f;
178 178
179 // Default AV Height 179 // Default AV Height
180 private float m_avHeight = 127.0f;
181 180
182 protected RegionInfo m_regionInfo; 181 protected RegionInfo m_regionInfo;
183 protected ulong crossingFromRegion; 182 protected ulong crossingFromRegion;
@@ -974,9 +973,10 @@ namespace OpenSim.Region.Framework.Scenes
974 } 973 }
975 974
976 float localAVHeight = 1.56f; 975 float localAVHeight = 1.56f;
977 if (m_avHeight != 127.0f) 976 if (m_appearance != null)
978 { 977 {
979 localAVHeight = m_avHeight; 978 if (m_appearance.AvatarHeight > 0)
979 localAVHeight = m_appearance.AvatarHeight;
980 } 980 }
981 981
982 float posZLimit = 0; 982 float posZLimit = 0;
@@ -991,17 +991,6 @@ namespace OpenSim.Region.Framework.Scenes
991 } 991 }
992 AbsolutePosition = pos; 992 AbsolutePosition = pos;
993 993
994 AddToPhysicalScene(isFlying);
995
996 if (m_forceFly)
997 {
998 m_physicsActor.Flying = true;
999 }
1000 else if (m_flyDisabled)
1001 {
1002 m_physicsActor.Flying = false;
1003 }
1004
1005 if (m_appearance != null) 994 if (m_appearance != null)
1006 { 995 {
1007 if (m_appearance.AvatarHeight > 0) 996 if (m_appearance.AvatarHeight > 0)
@@ -1014,6 +1003,23 @@ namespace OpenSim.Region.Framework.Scenes
1014 m_appearance = new AvatarAppearance(UUID); 1003 m_appearance = new AvatarAppearance(UUID);
1015 } 1004 }
1016 1005
1006 AddToPhysicalScene(isFlying);
1007
1008 if (m_appearance != null)
1009 {
1010 if (m_appearance.AvatarHeight > 0)
1011 SetHeight(m_appearance.AvatarHeight);
1012 }
1013
1014 if (m_forceFly)
1015 {
1016 m_physicsActor.Flying = true;
1017 }
1018 else if (m_flyDisabled)
1019 {
1020 m_physicsActor.Flying = false;
1021 }
1022
1017 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 1023 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
1018 // avatar to return to the standing position in mid-air. On login it looks like this is being sent 1024 // avatar to return to the standing position in mid-air. On login it looks like this is being sent
1019 // elsewhere anyway 1025 // elsewhere anyway
@@ -1200,10 +1206,9 @@ namespace OpenSim.Region.Framework.Scenes
1200 /// </summary> 1206 /// </summary>
1201 public void SetHeight(float height) 1207 public void SetHeight(float height)
1202 { 1208 {
1203 m_avHeight = height;
1204 if (PhysicsActor != null && !IsChildAgent) 1209 if (PhysicsActor != null && !IsChildAgent)
1205 { 1210 {
1206 Vector3 SetSize = new Vector3(0.45f, 0.6f, m_avHeight); 1211 Vector3 SetSize = new Vector3(0.45f, 0.6f, height);
1207 PhysicsActor.Size = SetSize; 1212 PhysicsActor.Size = SetSize;
1208 } 1213 }
1209 } 1214 }
@@ -1215,9 +1220,11 @@ namespace OpenSim.Region.Framework.Scenes
1215 /// </summary> 1220 /// </summary>
1216 public void CompleteMovement(IClientAPI client) 1221 public void CompleteMovement(IClientAPI client)
1217 { 1222 {
1218// DEBUG ON 1223 DateTime startTime = DateTime.Now;
1219 m_log.WarnFormat("[SCENE PRESENCE]: CompleteMovement for {0}",UUID); 1224
1220// DEBUG OFF 1225 m_log.DebugFormat(
1226 "[SCENE PRESENCE]: Completing movement of {0} into region {1}",
1227 client.Name, Scene.RegionInfo.RegionName);
1221 1228
1222 Vector3 look = Velocity; 1229 Vector3 look = Velocity;
1223 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1230 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@@ -1264,6 +1271,10 @@ namespace OpenSim.Region.Framework.Scenes
1264 if (friendsModule != null) 1271 if (friendsModule != null)
1265 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1272 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1266 } 1273 }
1274
1275 m_log.DebugFormat(
1276 "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1277 client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1267 } 1278 }
1268 1279
1269 /// <summary> 1280 /// <summary>
@@ -1859,9 +1870,10 @@ namespace OpenSim.Region.Framework.Scenes
1859 SendFullUpdateToAllClients(); 1870 SendFullUpdateToAllClients();
1860 m_requestedSitTargetID = 0; 1871 m_requestedSitTargetID = 0;
1861 1872
1862 if ((m_physicsActor != null) && (m_avHeight > 0)) 1873 if (m_physicsActor != null && m_appearance != null)
1863 { 1874 {
1864 SetHeight(m_avHeight); 1875 if (m_appearance.AvatarHeight > 0)
1876 SetHeight(m_appearance.AvatarHeight);
1865 } 1877 }
1866 } 1878 }
1867 Animator.TrySetMovementAnimation("STAND"); 1879 Animator.TrySetMovementAnimation("STAND");
@@ -2728,22 +2740,25 @@ namespace OpenSim.Region.Framework.Scenes
2728 if (remoteAvatar == null) 2740 if (remoteAvatar == null)
2729 return; 2741 return;
2730 2742
2731 IClientAPI cl=remoteAvatar.ControllingClient; 2743 IClientAPI cl = remoteAvatar.ControllingClient;
2732 if (cl == null) 2744 if (cl == null)
2733 return; 2745 return;
2734 2746
2735 if (m_appearance.Texture == null) 2747 if (m_appearance.Texture == null)
2736 return; 2748 return;
2737 2749
2738 if (LocalId == remoteAvatar.LocalId) 2750// MT: This is needed for sit. It's legal to send it to oneself, and the name
2739 { 2751// of the method is a misnomer
2740 m_log.WarnFormat("[SP] An agent is attempting to send data to itself; {0}",UUID); 2752//
2741 return; 2753// if (LocalId == remoteAvatar.LocalId)
2742 } 2754// {
2755// m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID);
2756// return;
2757// }
2743 2758
2744 if (IsChildAgent) 2759 if (IsChildAgent)
2745 { 2760 {
2746 m_log.WarnFormat("[SCENEPRESENCE] A child agent is attempting to send out avatar data"); 2761 m_log.WarnFormat("[SCENEPRESENCE]: A child agent is attempting to send out avatar data; {0}", UUID);
2747 return; 2762 return;
2748 } 2763 }
2749 2764
@@ -2826,14 +2841,14 @@ namespace OpenSim.Region.Framework.Scenes
2826 { 2841 {
2827 if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) 2842 if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient))
2828 { 2843 {
2829 m_log.WarnFormat("[SP] baked textures are in the ache for {0}",Name); 2844// m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
2830 m_controllingClient.SendAppearance( 2845 m_controllingClient.SendAppearance(
2831 m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes()); 2846 m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes());
2832 } 2847 }
2833 } 2848 }
2834 else 2849 else
2835 { 2850 {
2836 m_log.WarnFormat("[SP] AvatarFactory not set"); 2851 m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name);
2837 } 2852 }
2838 2853
2839 SendInitialFullUpdateToAllClients(); 2854 SendInitialFullUpdateToAllClients();
@@ -2845,7 +2860,7 @@ namespace OpenSim.Region.Framework.Scenes
2845 public void SendAppearanceToAllOtherAgents() 2860 public void SendAppearanceToAllOtherAgents()
2846 { 2861 {
2847// DEBUG ON 2862// DEBUG ON
2848 m_log.WarnFormat("[SP] Send appearance from {0} to all other agents",m_uuid); 2863// m_log.WarnFormat("[SCENEPRESENCE]: Send appearance from {0} to all other agents", m_uuid);
2849// DEBUG OFF 2864// DEBUG OFF
2850 m_perfMonMS = Util.EnvironmentTickCount(); 2865 m_perfMonMS = Util.EnvironmentTickCount();
2851 2866
@@ -2868,7 +2883,7 @@ namespace OpenSim.Region.Framework.Scenes
2868 { 2883 {
2869 if (LocalId == avatar.LocalId) 2884 if (LocalId == avatar.LocalId)
2870 { 2885 {
2871 m_log.WarnFormat("[SP] An agent is attempting to send data to itself; {0}",UUID); 2886 m_log.WarnFormat("[SCENE PRESENCE]: An agent is attempting to send appearance data to itself; {0}", UUID);
2872 return; 2887 return;
2873 } 2888 }
2874 2889
@@ -2920,7 +2935,7 @@ namespace OpenSim.Region.Framework.Scenes
2920 cadu.ActiveGroupID = UUID.Zero.Guid; 2935 cadu.ActiveGroupID = UUID.Zero.Guid;
2921 cadu.AgentID = UUID.Guid; 2936 cadu.AgentID = UUID.Guid;
2922 cadu.alwaysrun = m_setAlwaysRun; 2937 cadu.alwaysrun = m_setAlwaysRun;
2923 cadu.AVHeight = m_avHeight; 2938 cadu.AVHeight = m_appearance.AvatarHeight;;
2924 Vector3 tempCameraCenter = m_CameraCenter; 2939 Vector3 tempCameraCenter = m_CameraCenter;
2925 cadu.cameraPosition = tempCameraCenter; 2940 cadu.cameraPosition = tempCameraCenter;
2926 cadu.drawdistance = m_DrawDistance; 2941 cadu.drawdistance = m_DrawDistance;
@@ -3256,7 +3271,6 @@ namespace OpenSim.Region.Framework.Scenes
3256 3271
3257 m_CameraCenter = cAgentData.Center + offset; 3272 m_CameraCenter = cAgentData.Center + offset;
3258 3273
3259 m_avHeight = cAgentData.Size.Z;
3260 //SetHeight(cAgentData.AVHeight); 3274 //SetHeight(cAgentData.AVHeight);
3261 3275
3262 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) 3276 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
@@ -3281,8 +3295,6 @@ namespace OpenSim.Region.Framework.Scenes
3281 cAgent.Position = AbsolutePosition; 3295 cAgent.Position = AbsolutePosition;
3282 cAgent.Velocity = m_velocity; 3296 cAgent.Velocity = m_velocity;
3283 cAgent.Center = m_CameraCenter; 3297 cAgent.Center = m_CameraCenter;
3284 // Don't copy the size; it is inferred from apearance parameters
3285 //cAgent.Size = new Vector3(0, 0, m_avHeight);
3286 cAgent.AtAxis = m_CameraAtAxis; 3298 cAgent.AtAxis = m_CameraAtAxis;
3287 cAgent.LeftAxis = m_CameraLeftAxis; 3299 cAgent.LeftAxis = m_CameraLeftAxis;
3288 cAgent.UpAxis = m_CameraUpAxis; 3300 cAgent.UpAxis = m_CameraUpAxis;
@@ -3401,7 +3413,6 @@ namespace OpenSim.Region.Framework.Scenes
3401 3413
3402 m_velocity = cAgent.Velocity; 3414 m_velocity = cAgent.Velocity;
3403 m_CameraCenter = cAgent.Center; 3415 m_CameraCenter = cAgent.Center;
3404 //m_avHeight = cAgent.Size.Z;
3405 m_CameraAtAxis = cAgent.AtAxis; 3416 m_CameraAtAxis = cAgent.AtAxis;
3406 m_CameraLeftAxis = cAgent.LeftAxis; 3417 m_CameraLeftAxis = cAgent.LeftAxis;
3407 m_CameraUpAxis = cAgent.UpAxis; 3418 m_CameraUpAxis = cAgent.UpAxis;
@@ -3562,17 +3573,8 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju
3562 3573
3563 Vector3 pVec = AbsolutePosition; 3574 Vector3 pVec = AbsolutePosition;
3564 3575
3565 // Old bug where the height was in centimeters instead of meters 3576 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
3566 if (m_avHeight == 127.0f) 3577 new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying);
3567 {
3568 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, 1.56f),
3569 isFlying);
3570 }
3571 else
3572 {
3573 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
3574 new Vector3(0f, 0f, m_avHeight), isFlying);
3575 }
3576 scene.AddPhysicsActorTaint(m_physicsActor); 3578 scene.AddPhysicsActorTaint(m_physicsActor);
3577 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3579 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3578 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3580 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 4aadfdb..a398dfd 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1135,7 +1135,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1135 writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); 1135 writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
1136 writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString()); 1136 writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString());
1137 writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); 1137 writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
1138 writer.WriteElementString("Flags", sop.Flags.ToString()); 1138 WriteFlags(writer, "Flags", sop.Flags.ToString(), options);
1139 WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); 1139 WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
1140 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); 1140 writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
1141 if (sop.MediaUrl != null) 1141 if (sop.MediaUrl != null)
@@ -1188,6 +1188,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1188 1188
1189 } 1189 }
1190 1190
1191 static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
1192 {
1193 // Older versions of serialization can't cope with commas
1194 if (options.ContainsKey("version"))
1195 {
1196 float version = 0.5F;
1197 float.TryParse(options["version"].ToString(), out version);
1198 if (version < 0.5)
1199 flagsStr = flagsStr.Replace(",", "");
1200 }
1201
1202 writer.WriteElementString(name, flagsStr);
1203 }
1204
1191 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options) 1205 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options)
1192 { 1206 {
1193 if (tinv.Count > 0) // otherwise skip this 1207 if (tinv.Count > 0) // otherwise skip this
@@ -1275,8 +1289,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1275 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); 1289 writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString());
1276 writer.WriteElementString("State", shp.State.ToString()); 1290 writer.WriteElementString("State", shp.State.ToString());
1277 1291
1278 writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString()); 1292 WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options);
1279 writer.WriteElementString("HollowShape", shp.HollowShape.ToString()); 1293 WriteFlags(writer, "HollowShape", shp.HollowShape.ToString(), options);
1280 1294
1281 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); 1295 WriteUUID(writer, "SculptTexture", shp.SculptTexture, options);
1282 writer.WriteElementString("SculptType", shp.SculptType.ToString()); 1296 writer.WriteElementString("SculptType", shp.SculptType.ToString());
diff --git a/OpenSim/Services/AvatarService/AvatarService.cs b/OpenSim/Services/AvatarService/AvatarService.cs
index a8ad413..53ca7c8 100644
--- a/OpenSim/Services/AvatarService/AvatarService.cs
+++ b/OpenSim/Services/AvatarService/AvatarService.cs
@@ -51,8 +51,6 @@ 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) 54 public AvatarAppearance GetAppearance(UUID principalID)
57 { 55 {
58 AvatarData avatar = GetAvatar(principalID); 56 AvatarData avatar = GetAvatar(principalID);
@@ -68,12 +66,15 @@ namespace OpenSim.Services.AvatarService
68 public AvatarData GetAvatar(UUID principalID) 66 public AvatarData GetAvatar(UUID principalID)
69 { 67 {
70 AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString()); 68 AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString());
71 if (av.Length == 0)
72 return null;
73
74 AvatarData ret = new AvatarData(); 69 AvatarData ret = new AvatarData();
75 ret.Data = new Dictionary<string,string>(); 70 ret.Data = new Dictionary<string,string>();
76 71
72 if (av.Length == 0)
73 {
74 ret.AvatarType = 1; // SL avatar
75 return ret;
76 }
77
77 foreach (AvatarBaseData b in av) 78 foreach (AvatarBaseData b in av)
78 { 79 {
79 if (b.Data["Name"] == "AvatarType") 80 if (b.Data["Name"] == "AvatarType")
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index ea9b4b4..7a28c2b 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -265,32 +265,33 @@ namespace OpenSim.Services.Connectors.SimianGrid
265 265
266 map["Height"] = OSD.FromReal(appearance.AvatarHeight); 266 map["Height"] = OSD.FromReal(appearance.AvatarHeight);
267 267
268 map["ShapeItem"] = OSD.FromUUID(appearance.BodyItem); 268 map["BodyItem"] = appearance.Wearables[AvatarWearable.BODY][0].ItemID.ToString();
269 map["ShapeAsset"] = OSD.FromUUID(appearance.BodyAsset); 269 map["EyesItem"] = appearance.Wearables[AvatarWearable.EYES][0].ItemID.ToString();
270 map["SkinItem"] = OSD.FromUUID(appearance.SkinItem); 270 map["GlovesItem"] = appearance.Wearables[AvatarWearable.GLOVES][0].ItemID.ToString();
271 map["SkinAsset"] = OSD.FromUUID(appearance.SkinAsset); 271 map["HairItem"] = appearance.Wearables[AvatarWearable.HAIR][0].ItemID.ToString();
272 map["HairItem"] = OSD.FromUUID(appearance.HairItem); 272 map["JacketItem"] = appearance.Wearables[AvatarWearable.JACKET][0].ItemID.ToString();
273 map["HairAsset"] = OSD.FromUUID(appearance.HairAsset); 273 map["PantsItem"] = appearance.Wearables[AvatarWearable.PANTS][0].ItemID.ToString();
274 map["EyesItem"] = OSD.FromUUID(appearance.EyesItem); 274 map["ShirtItem"] = appearance.Wearables[AvatarWearable.SHIRT][0].ItemID.ToString();
275 map["EyesAsset"] = OSD.FromUUID(appearance.EyesAsset); 275 map["ShoesItem"] = appearance.Wearables[AvatarWearable.SHOES][0].ItemID.ToString();
276 map["ShirtItem"] = OSD.FromUUID(appearance.ShirtItem); 276 map["SkinItem"] = appearance.Wearables[AvatarWearable.SKIN][0].ItemID.ToString();
277 map["ShirtAsset"] = OSD.FromUUID(appearance.ShirtAsset); 277 map["SkirtItem"] = appearance.Wearables[AvatarWearable.SKIRT][0].ItemID.ToString();
278 map["PantsItem"] = OSD.FromUUID(appearance.PantsItem); 278 map["SocksItem"] = appearance.Wearables[AvatarWearable.SOCKS][0].ItemID.ToString();
279 map["PantsAsset"] = OSD.FromUUID(appearance.PantsAsset); 279 map["UnderPantsItem"] = appearance.Wearables[AvatarWearable.UNDERPANTS][0].ItemID.ToString();
280 map["ShoesItem"] = OSD.FromUUID(appearance.ShoesItem); 280 map["UnderShirtItem"] = appearance.Wearables[AvatarWearable.UNDERSHIRT][0].ItemID.ToString();
281 map["ShoesAsset"] = OSD.FromUUID(appearance.ShoesAsset); 281 map["BodyAsset"] = appearance.Wearables[AvatarWearable.BODY][0].AssetID.ToString();
282 map["SocksItem"] = OSD.FromUUID(appearance.SocksItem); 282 map["EyesAsset"] = appearance.Wearables[AvatarWearable.EYES][0].AssetID.ToString();
283 map["SocksAsset"] = OSD.FromUUID(appearance.SocksAsset); 283 map["GlovesAsset"] = appearance.Wearables[AvatarWearable.GLOVES][0].AssetID.ToString();
284 map["JacketItem"] = OSD.FromUUID(appearance.JacketItem); 284 map["HairAsset"] = appearance.Wearables[AvatarWearable.HAIR][0].AssetID.ToString();
285 map["JacketAsset"] = OSD.FromUUID(appearance.JacketAsset); 285 map["JacketAsset"] = appearance.Wearables[AvatarWearable.JACKET][0].AssetID.ToString();
286 map["GlovesItem"] = OSD.FromUUID(appearance.GlovesItem); 286 map["PantsAsset"] = appearance.Wearables[AvatarWearable.PANTS][0].AssetID.ToString();
287 map["GlovesAsset"] = OSD.FromUUID(appearance.GlovesAsset); 287 map["ShirtAsset"] = appearance.Wearables[AvatarWearable.SHIRT][0].AssetID.ToString();
288 map["UndershirtItem"] = OSD.FromUUID(appearance.UnderShirtItem); 288 map["ShoesAsset"] = appearance.Wearables[AvatarWearable.SHOES][0].AssetID.ToString();
289 map["UndershirtAsset"] = OSD.FromUUID(appearance.UnderShirtAsset); 289 map["SkinAsset"] = appearance.Wearables[AvatarWearable.SKIN][0].AssetID.ToString();
290 map["UnderpantsItem"] = OSD.FromUUID(appearance.UnderPantsItem); 290 map["SkirtAsset"] = appearance.Wearables[AvatarWearable.SKIRT][0].AssetID.ToString();
291 map["UnderpantsAsset"] = OSD.FromUUID(appearance.UnderPantsAsset); 291 map["SocksAsset"] = appearance.Wearables[AvatarWearable.SOCKS][0].AssetID.ToString();
292 map["SkirtItem"] = OSD.FromUUID(appearance.SkirtItem); 292 map["UnderPantsAsset"] = appearance.Wearables[AvatarWearable.UNDERPANTS][0].AssetID.ToString();
293 map["SkirtAsset"] = OSD.FromUUID(appearance.SkirtAsset); 293 map["UnderShirtAsset"] = appearance.Wearables[AvatarWearable.UNDERSHIRT][0].AssetID.ToString();
294
294 295
295 OSDMap items = new OSDMap(); 296 OSDMap items = new OSDMap();
296 foreach (KeyValuePair<string, string> kvp in avatar.Data) 297 foreach (KeyValuePair<string, string> kvp in avatar.Data)
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 385ba31..0626ebe 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -117,7 +117,7 @@ namespace OpenSim.Services.Connectors.Simulation
117 } 117 }
118 catch (Exception e) 118 catch (Exception e)
119 { 119 {
120 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); 120 m_log.Error("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message);
121 reason = e.Message; 121 reason = e.Message;
122 return false; 122 return false;
123 } 123 }
@@ -158,13 +158,13 @@ namespace OpenSim.Services.Connectors.Simulation
158 AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send 158 AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send
159 os = AgentCreateRequest.GetRequestStream(); 159 os = AgentCreateRequest.GetRequestStream();
160 os.Write(buffer, 0, strBuffer.Length); //Send it 160 os.Write(buffer, 0, strBuffer.Length); //Send it
161 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateAgent request to remote sim {0}, region {1}, x={2} y={3}", 161 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateAgent request to remote sim {0}, region {1}, x={2} y={3}",
162 uri, destination.RegionName, destination.RegionLocX, destination.RegionLocY); 162 uri, destination.RegionName, destination.RegionLocX, destination.RegionLocY);
163 } 163 }
164 //catch (WebException ex) 164 //catch (WebException ex)
165 catch 165 catch
166 { 166 {
167 //m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on ChildAgentUpdate {0}", ex.Message); 167 //m_log.ErrorFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on ChildAgentUpdate {0}", ex.Message);
168 reason = "cannot contact remote region"; 168 reason = "cannot contact remote region";
169 return false; 169 return false;
170 } 170 }
@@ -191,19 +191,19 @@ namespace OpenSim.Services.Connectors.Simulation
191 webResponse = AgentCreateRequest.GetResponse(); 191 webResponse = AgentCreateRequest.GetResponse();
192 if (webResponse == null) 192 if (webResponse == null)
193 { 193 {
194 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on DoCreateChildAgentCall post"); 194 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on DoCreateChildAgentCall post");
195 } 195 }
196 else 196 else
197 { 197 {
198 198
199 sr = new StreamReader(webResponse.GetResponseStream()); 199 sr = new StreamReader(webResponse.GetResponseStream());
200 response = sr.ReadToEnd().Trim(); 200 response = sr.ReadToEnd().Trim();
201 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response); 201 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response);
202 } 202 }
203 } 203 }
204 catch (WebException ex) 204 catch (WebException ex)
205 { 205 {
206 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); 206 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message);
207 reason = "Destination did not reply"; 207 reason = "Destination did not reply";
208 return string.Empty; 208 return string.Empty;
209 } 209 }
@@ -231,7 +231,7 @@ namespace OpenSim.Services.Connectors.Simulation
231 } 231 }
232 catch (NullReferenceException e) 232 catch (NullReferenceException e)
233 { 233 {
234 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message); 234 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message);
235 235
236 // check for old style response 236 // check for old style response
237 if (response.ToLower().StartsWith("true")) 237 if (response.ToLower().StartsWith("true"))
@@ -251,7 +251,7 @@ namespace OpenSim.Services.Connectors.Simulation
251 } 251 }
252 catch (Exception e) 252 catch (Exception e)
253 { 253 {
254 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); 254 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
255 return null; 255 return null;
256 } 256 }
257 // Add the input arguments 257 // Add the input arguments
@@ -284,7 +284,7 @@ namespace OpenSim.Services.Connectors.Simulation
284 } 284 }
285 catch (Exception e) 285 catch (Exception e)
286 { 286 {
287 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); 287 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message);
288 return false; 288 return false;
289 } 289 }
290 //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); 290 //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri);
@@ -303,7 +303,7 @@ namespace OpenSim.Services.Connectors.Simulation
303 } 303 }
304 catch (Exception e) 304 catch (Exception e)
305 { 305 {
306 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: PackUpdateMessage failed with exception: " + e.Message); 306 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: PackUpdateMessage failed with exception: " + e.Message);
307 } 307 }
308 // Add the input arguments 308 // Add the input arguments
309 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); 309 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
@@ -332,12 +332,12 @@ namespace OpenSim.Services.Connectors.Simulation
332 ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send 332 ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send
333 os = ChildUpdateRequest.GetRequestStream(); 333 os = ChildUpdateRequest.GetRequestStream();
334 os.Write(buffer, 0, strBuffer.Length); //Send it 334 os.Write(buffer, 0, strBuffer.Length); //Send it
335 //m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted AgentUpdate request to remote sim {0}", uri); 335 //m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Posted AgentUpdate request to remote sim {0}", uri);
336 } 336 }
337 catch (WebException ex) 337 catch (WebException ex)
338 //catch 338 //catch
339 { 339 {
340 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on AgentUpdate {0}", ex.Message); 340 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on AgentUpdate {0}", ex.Message);
341 341
342 return false; 342 return false;
343 } 343 }
@@ -348,7 +348,7 @@ namespace OpenSim.Services.Connectors.Simulation
348 } 348 }
349 349
350 // Let's wait for the response 350 // Let's wait for the response
351 //m_log.Info("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after ChildAgentUpdate"); 351 //m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Waiting for a reply after ChildAgentUpdate");
352 352
353 WebResponse webResponse = null; 353 WebResponse webResponse = null;
354 StreamReader sr = null; 354 StreamReader sr = null;
@@ -357,19 +357,19 @@ namespace OpenSim.Services.Connectors.Simulation
357 webResponse = ChildUpdateRequest.GetResponse(); 357 webResponse = ChildUpdateRequest.GetResponse();
358 if (webResponse == null) 358 if (webResponse == null)
359 { 359 {
360 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on ChilAgentUpdate post"); 360 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on ChilAgentUpdate post");
361 } 361 }
362 362
363 sr = new StreamReader(webResponse.GetResponseStream()); 363 sr = new StreamReader(webResponse.GetResponseStream());
364 //reply = sr.ReadToEnd().Trim(); 364 //reply = sr.ReadToEnd().Trim();
365 sr.ReadToEnd().Trim(); 365 sr.ReadToEnd().Trim();
366 sr.Close(); 366 sr.Close();
367 //m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was {0} ", reply); 367 //m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was {0} ", reply);
368 368
369 } 369 }
370 catch (WebException ex) 370 catch (WebException ex)
371 { 371 {
372 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of ChilAgentUpdate from {0}: {1}", uri, ex.Message); 372 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of ChilAgentUpdate from {0}: {1}", uri, ex.Message);
373 // ignore, really 373 // ignore, really
374 } 374 }
375 finally 375 finally
@@ -403,7 +403,7 @@ namespace OpenSim.Services.Connectors.Simulation
403 webResponse = (HttpWebResponse)request.GetResponse(); 403 webResponse = (HttpWebResponse)request.GetResponse();
404 if (webResponse == null) 404 if (webResponse == null)
405 { 405 {
406 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on agent get "); 406 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent get ");
407 } 407 }
408 408
409 sr = new StreamReader(webResponse.GetResponseStream()); 409 sr = new StreamReader(webResponse.GetResponseStream());
@@ -414,7 +414,7 @@ namespace OpenSim.Services.Connectors.Simulation
414 } 414 }
415 catch (WebException ex) 415 catch (WebException ex)
416 { 416 {
417 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent get {0}", ex.Message); 417 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent get {0}", ex.Message);
418 // ignore, really 418 // ignore, really
419 return false; 419 return false;
420 } 420 }
@@ -455,7 +455,7 @@ namespace OpenSim.Services.Connectors.Simulation
455 WebResponse webResponse = request.GetResponse(); 455 WebResponse webResponse = request.GetResponse();
456 if (webResponse == null) 456 if (webResponse == null)
457 { 457 {
458 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on ReleaseAgent"); 458 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on ReleaseAgent");
459 } 459 }
460 460
461 sr = new StreamReader(webResponse.GetResponseStream()); 461 sr = new StreamReader(webResponse.GetResponseStream());
@@ -467,7 +467,7 @@ namespace OpenSim.Services.Connectors.Simulation
467 } 467 }
468 catch (WebException ex) 468 catch (WebException ex)
469 { 469 {
470 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of ReleaseAgent {0}", ex.Message); 470 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of ReleaseAgent {0}", ex.Message);
471 return false; 471 return false;
472 } 472 }
473 finally 473 finally
@@ -488,7 +488,7 @@ namespace OpenSim.Services.Connectors.Simulation
488 } 488 }
489 catch (Exception e) 489 catch (Exception e)
490 { 490 {
491 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); 491 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message);
492 return false; 492 return false;
493 } 493 }
494 494
@@ -506,7 +506,7 @@ namespace OpenSim.Services.Connectors.Simulation
506 WebResponse webResponse = request.GetResponse(); 506 WebResponse webResponse = request.GetResponse();
507 if (webResponse == null) 507 if (webResponse == null)
508 { 508 {
509 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on agent delete "); 509 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Null reply on agent delete ");
510 } 510 }
511 511
512 sr = new StreamReader(webResponse.GetResponseStream()); 512 sr = new StreamReader(webResponse.GetResponseStream());
@@ -518,7 +518,7 @@ namespace OpenSim.Services.Connectors.Simulation
518 } 518 }
519 catch (WebException ex) 519 catch (WebException ex)
520 { 520 {
521 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent delete from {0}: {1}", destination.RegionName, ex.Message); 521 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent delete from {0}: {1}", destination.RegionName, ex.Message);
522 return false; 522 return false;
523 } 523 }
524 finally 524 finally
@@ -595,11 +595,11 @@ namespace OpenSim.Services.Connectors.Simulation
595 ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send 595 ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send
596 os = ObjectCreateRequest.GetRequestStream(); 596 os = ObjectCreateRequest.GetRequestStream();
597 os.Write(buffer, 0, strBuffer.Length); //Send it 597 os.Write(buffer, 0, strBuffer.Length); //Send it
598 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateObject request to remote sim {0}", uri); 598 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Posted CreateObject request to remote sim {0}", uri);
599 } 599 }
600 catch (WebException ex) 600 catch (WebException ex)
601 { 601 {
602 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on CreateObject {0}", ex.Message); 602 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: Bad send on CreateObject {0}", ex.Message);
603 return false; 603 return false;
604 } 604 }
605 finally 605 finally
@@ -617,7 +617,7 @@ namespace OpenSim.Services.Connectors.Simulation
617 WebResponse webResponse = ObjectCreateRequest.GetResponse(); 617 WebResponse webResponse = ObjectCreateRequest.GetResponse();
618 if (webResponse == null) 618 if (webResponse == null)
619 { 619 {
620 m_log.Info("[REMOTE SIMULATION CONNECTOR]: Null reply on CreateObject post"); 620 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: Null reply on CreateObject post");
621 return false; 621 return false;
622 } 622 }
623 623
@@ -629,7 +629,7 @@ namespace OpenSim.Services.Connectors.Simulation
629 } 629 }
630 catch (WebException ex) 630 catch (WebException ex)
631 { 631 {
632 m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of CreateObject {0}", ex.Message); 632 m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of CreateObject {0}", ex.Message);
633 return false; 633 return false;
634 } 634 }
635 finally 635 finally
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs
index eaa6534..d7af562 100644
--- a/OpenSim/Services/Interfaces/IAvatarService.cs
+++ b/OpenSim/Services/Interfaces/IAvatarService.cs
@@ -149,33 +149,28 @@ namespace OpenSim.Services.Interfaces
149 Data["Serial"] = appearance.Serial.ToString(); 149 Data["Serial"] = appearance.Serial.ToString();
150 // Wearables 150 // Wearables
151 Data["AvatarHeight"] = appearance.AvatarHeight.ToString(); 151 Data["AvatarHeight"] = appearance.AvatarHeight.ToString();
152 Data["BodyItem"] = appearance.BodyItem.ToString(); 152
153 Data["EyesItem"] = appearance.EyesItem.ToString(); 153 for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++)
154 Data["GlovesItem"] = appearance.GlovesItem.ToString(); 154 {
155 Data["HairItem"] = appearance.HairItem.ToString(); 155 for (int j = 0 ; j < appearance.Wearables[i].Count ; j++)
156 Data["JacketItem"] = appearance.JacketItem.ToString(); 156 {
157 Data["PantsItem"] = appearance.PantsItem.ToString(); 157 string fieldName = String.Format("Wearable {0}:{1}", i, j);
158 Data["ShirtItem"] = appearance.ShirtItem.ToString(); 158 Data[fieldName] = String.Format("{0}:{1}",
159 Data["ShoesItem"] = appearance.ShoesItem.ToString(); 159 appearance.Wearables[i][j].ItemID.ToString(),
160 Data["SkinItem"] = appearance.SkinItem.ToString(); 160 appearance.Wearables[i][j].AssetID.ToString());
161 Data["SkirtItem"] = appearance.SkirtItem.ToString(); 161 }
162 Data["SocksItem"] = appearance.SocksItem.ToString(); 162 }
163 Data["UnderPantsItem"] = appearance.UnderPantsItem.ToString(); 163
164 Data["UnderShirtItem"] = appearance.UnderShirtItem.ToString(); 164 // Visual Params
165 165 string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT];
166 Data["BodyAsset"] = appearance.BodyAsset.ToString(); 166 byte[] binary = appearance.VisualParams;
167 Data["EyesAsset"] = appearance.EyesAsset.ToString(); 167
168 Data["GlovesAsset"] = appearance.GlovesAsset.ToString(); 168 for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++)
169 Data["HairAsset"] = appearance.HairAsset.ToString(); 169 {
170 Data["JacketAsset"] = appearance.JacketAsset.ToString(); 170 vps[i] = binary[i].ToString();
171 Data["PantsAsset"] = appearance.PantsAsset.ToString(); 171 }
172 Data["ShirtAsset"] = appearance.ShirtAsset.ToString(); 172
173 Data["ShoesAsset"] = appearance.ShoesAsset.ToString(); 173 Data["VisualParams"] = String.Join(",", vps);
174 Data["SkinAsset"] = appearance.SkinAsset.ToString();
175 Data["SkirtAsset"] = appearance.SkirtAsset.ToString();
176 Data["SocksAsset"] = appearance.SocksAsset.ToString();
177 Data["UnderPantsAsset"] = appearance.UnderPantsAsset.ToString();
178 Data["UnderShirtAsset"] = appearance.UnderShirtAsset.ToString();
179 174
180 // Attachments 175 // Attachments
181 List<AvatarAttachment> attachments = appearance.GetAttachments(); 176 List<AvatarAttachment> attachments = appearance.GetAttachments();
@@ -188,38 +183,114 @@ namespace OpenSim.Services.Interfaces
188 public AvatarAppearance ToAvatarAppearance(UUID owner) 183 public AvatarAppearance ToAvatarAppearance(UUID owner)
189 { 184 {
190 AvatarAppearance appearance = new AvatarAppearance(owner); 185 AvatarAppearance appearance = new AvatarAppearance(owner);
186
187 if (Data.Count == 0)
188 return appearance;
189
190 appearance.ClearWearables();
191 try 191 try
192 { 192 {
193 appearance.Serial = Int32.Parse(Data["Serial"]); 193 if (Data.ContainsKey("Serial"))
194 194 appearance.Serial = Int32.Parse(Data["Serial"]);
195 // Wearables 195
196 appearance.BodyItem = UUID.Parse(Data["BodyItem"]); 196 if (Data.ContainsKey("AvatarHeight"))
197 appearance.EyesItem = UUID.Parse(Data["EyesItem"]); 197 appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]);
198 appearance.GlovesItem = UUID.Parse(Data["GlovesItem"]); 198
199 appearance.HairItem = UUID.Parse(Data["HairItem"]); 199 // Legacy Wearables
200 appearance.JacketItem = UUID.Parse(Data["JacketItem"]); 200 if (Data.ContainsKey("BodyItem"))
201 appearance.PantsItem = UUID.Parse(Data["PantsItem"]); 201 appearance.Wearables[AvatarWearable.BODY].Wear(
202 appearance.ShirtItem = UUID.Parse(Data["ShirtItem"]); 202 UUID.Parse(Data["BodyItem"]),
203 appearance.ShoesItem = UUID.Parse(Data["ShoesItem"]); 203 UUID.Parse(Data["BodyAsset"]));
204 appearance.SkinItem = UUID.Parse(Data["SkinItem"]); 204
205 appearance.SkirtItem = UUID.Parse(Data["SkirtItem"]); 205 if (Data.ContainsKey("SkinItem"))
206 appearance.SocksItem = UUID.Parse(Data["SocksItem"]); 206 appearance.Wearables[AvatarWearable.SKIN].Wear(
207 appearance.UnderPantsItem = UUID.Parse(Data["UnderPantsItem"]); 207 UUID.Parse(Data["SkinItem"]),
208 appearance.UnderShirtItem = UUID.Parse(Data["UnderShirtItem"]); 208 UUID.Parse(Data["SkinAsset"]));
209 209
210 appearance.BodyAsset = UUID.Parse(Data["BodyAsset"]); 210 if (Data.ContainsKey("HairItem"))
211 appearance.EyesAsset = UUID.Parse(Data["EyesAsset"]); 211 appearance.Wearables[AvatarWearable.HAIR].Wear(
212 appearance.GlovesAsset = UUID.Parse(Data["GlovesAsset"]); 212 UUID.Parse(Data["HairItem"]),
213 appearance.HairAsset = UUID.Parse(Data["HairAsset"]); 213 UUID.Parse(Data["HairAsset"]));
214 appearance.JacketAsset = UUID.Parse(Data["JacketAsset"]); 214
215 appearance.PantsAsset = UUID.Parse(Data["PantsAsset"]); 215 if (Data.ContainsKey("EyesItem"))
216 appearance.ShirtAsset = UUID.Parse(Data["ShirtAsset"]); 216 appearance.Wearables[AvatarWearable.EYES].Wear(
217 appearance.ShoesAsset = UUID.Parse(Data["ShoesAsset"]); 217 UUID.Parse(Data["EyesItem"]),
218 appearance.SkinAsset = UUID.Parse(Data["SkinAsset"]); 218 UUID.Parse(Data["EyesAsset"]));
219 appearance.SkirtAsset = UUID.Parse(Data["SkirtAsset"]); 219
220 appearance.SocksAsset = UUID.Parse(Data["SocksAsset"]); 220 if (Data.ContainsKey("ShirtItem"))
221 appearance.UnderPantsAsset = UUID.Parse(Data["UnderPantsAsset"]); 221 appearance.Wearables[AvatarWearable.SHIRT].Wear(
222 appearance.UnderShirtAsset = UUID.Parse(Data["UnderShirtAsset"]); 222 UUID.Parse(Data["ShirtItem"]),
223 UUID.Parse(Data["ShirtAsset"]));
224
225 if (Data.ContainsKey("PantsItem"))
226 appearance.Wearables[AvatarWearable.PANTS].Wear(
227 UUID.Parse(Data["PantsItem"]),
228 UUID.Parse(Data["PantsAsset"]));
229
230 if (Data.ContainsKey("ShoesItem"))
231 appearance.Wearables[AvatarWearable.SHOES].Wear(
232 UUID.Parse(Data["ShoesItem"]),
233 UUID.Parse(Data["ShoesAsset"]));
234
235 if (Data.ContainsKey("SocksItem"))
236 appearance.Wearables[AvatarWearable.SOCKS].Wear(
237 UUID.Parse(Data["SocksItem"]),
238 UUID.Parse(Data["SocksAsset"]));
239
240 if (Data.ContainsKey("JacketItem"))
241 appearance.Wearables[AvatarWearable.JACKET].Wear(
242 UUID.Parse(Data["JacketItem"]),
243 UUID.Parse(Data["JacketAsset"]));
244
245 if (Data.ContainsKey("GlovesItem"))
246 appearance.Wearables[AvatarWearable.GLOVES].Wear(
247 UUID.Parse(Data["GlovesItem"]),
248 UUID.Parse(Data["GlovesAsset"]));
249
250 if (Data.ContainsKey("UnderShirtItem"))
251 appearance.Wearables[AvatarWearable.UNDERSHIRT].Wear(
252 UUID.Parse(Data["UnderShirtItem"]),
253 UUID.Parse(Data["UnderShirtAsset"]));
254
255 if (Data.ContainsKey("UnderPantsItem"))
256 appearance.Wearables[AvatarWearable.UNDERPANTS].Wear(
257 UUID.Parse(Data["UnderPantsItem"]),
258 UUID.Parse(Data["UnderPantsAsset"]));
259
260 if (Data.ContainsKey("SkirtItem"))
261 appearance.Wearables[AvatarWearable.SKIRT].Wear(
262 UUID.Parse(Data["SkirtItem"]),
263 UUID.Parse(Data["SkirtAsset"]));
264
265
266 if (Data.ContainsKey("VisualParams"))
267 {
268 string[] vps = Data["VisualParams"].Split(new char[] {','});
269 byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT];
270
271 for (int i = 0 ; i < vps.Length && i < binary.Length ; i++)
272 binary[i] = (byte)Convert.ToInt32(vps[i]);
273
274 appearance.VisualParams = binary;
275 }
276
277 // New style wearables
278 foreach (KeyValuePair<string, string> _kvp in Data)
279 {
280 if (_kvp.Key.StartsWith("Wearable "))
281 {
282 string wearIndex = _kvp.Key.Substring(9);
283 string[] wearIndices = wearIndex.Split(new char[] {':'});
284 int index = Convert.ToInt32(wearIndices[0]);
285
286 string[] ids = _kvp.Value.Split(new char[] {':'});
287 UUID itemID = new UUID(ids[0]);
288 UUID assetID = new UUID(ids[1]);
289
290 appearance.Wearables[index].Add(itemID, assetID);
291 }
292 }
293
223 294
224 // Attachments 295 // Attachments
225 Dictionary<string, string> attchs = new Dictionary<string, string>(); 296 Dictionary<string, string> attchs = new Dictionary<string, string>();
@@ -239,6 +310,26 @@ namespace OpenSim.Services.Interfaces
239 310
240 appearance.SetAttachment(point,uuid,UUID.Zero); 311 appearance.SetAttachment(point,uuid,UUID.Zero);
241 } 312 }
313
314 if (appearance.Wearables[AvatarWearable.BODY].Count == 0)
315 appearance.Wearables[AvatarWearable.BODY].Wear(
316 AvatarWearable.DefaultWearables[
317 AvatarWearable.BODY][0]);
318
319 if (appearance.Wearables[AvatarWearable.SKIN].Count == 0)
320 appearance.Wearables[AvatarWearable.SKIN].Wear(
321 AvatarWearable.DefaultWearables[
322 AvatarWearable.SKIN][0]);
323
324 if (appearance.Wearables[AvatarWearable.HAIR].Count == 0)
325 appearance.Wearables[AvatarWearable.HAIR].Wear(
326 AvatarWearable.DefaultWearables[
327 AvatarWearable.HAIR][0]);
328
329 if (appearance.Wearables[AvatarWearable.EYES].Count == 0)
330 appearance.Wearables[AvatarWearable.EYES].Wear(
331 AvatarWearable.DefaultWearables[
332 AvatarWearable.EYES][0]);
242 } 333 }
243 catch 334 catch
244 { 335 {
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index cce8f2c..8cf846b 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Services.Interfaces
97 int GetRegionFlags(UUID scopeID, UUID regionID); 97 int GetRegionFlags(UUID scopeID, UUID regionID);
98 } 98 }
99 99
100 public class GridRegion 100 public class GridRegion : Object
101 { 101 {
102 102
103 /// <summary> 103 /// <summary>
@@ -225,6 +225,33 @@ namespace OpenSim.Services.Interfaces
225 EstateOwner = ConvertFrom.EstateOwner; 225 EstateOwner = ConvertFrom.EstateOwner;
226 } 226 }
227 227
228 # region Definition of equality
229
230 /// <summary>
231 /// Define equality as two regions having the same, non-zero UUID.
232 /// </summary>
233 public bool Equals(GridRegion region)
234 {
235 if ((object)region == null)
236 return false;
237 // Return true if the non-zero UUIDs are equal:
238 return (RegionID != UUID.Zero) && RegionID.Equals(region.RegionID);
239 }
240
241 public override bool Equals(Object obj)
242 {
243 if (obj == null)
244 return false;
245 return Equals(obj as GridRegion);
246 }
247
248 public override int GetHashCode()
249 {
250 return RegionID.GetHashCode() ^ TerrainImage.GetHashCode();
251 }
252
253 #endregion
254
228 /// <value> 255 /// <value>
229 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. 256 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
230 /// 257 ///
diff --git a/OpenSim/Services/PresenceService/PresenceService.cs b/OpenSim/Services/PresenceService/PresenceService.cs
index 976153f..09c31c3 100644
--- a/OpenSim/Services/PresenceService/PresenceService.cs
+++ b/OpenSim/Services/PresenceService/PresenceService.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Services.PresenceService
88 88
89 public bool ReportAgent(UUID sessionID, UUID regionID) 89 public bool ReportAgent(UUID sessionID, UUID regionID)
90 { 90 {
91 m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID); 91// m_log.DebugFormat("[PRESENCE SERVICE]: ReportAgent with session {0} in region {1}", sessionID, regionID);
92 try 92 try
93 { 93 {
94 PresenceData pdata = m_Database.Get(sessionID); 94 PresenceData pdata = m_Database.Get(sessionID);