aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMelanie2010-11-02 22:58:33 +0000
committerMelanie2010-11-02 22:58:33 +0000
commit26f12f479f17aef37451fb30f9b1de376c8676ac (patch)
treeecaf084da6ca491301450c0f8a8460a8b1dc981a /OpenSim/Framework
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentFix default club feet (diff)
downloadopensim-SC_OLD-26f12f479f17aef37451fb30f9b1de376c8676ac.zip
opensim-SC_OLD-26f12f479f17aef37451fb30f9b1de376c8676ac.tar.gz
opensim-SC_OLD-26f12f479f17aef37451fb30f9b1de376c8676ac.tar.bz2
opensim-SC_OLD-26f12f479f17aef37451fb30f9b1de376c8676ac.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Framework')
-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
8 files changed, 244 insertions, 349 deletions
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}