aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMelanie2010-10-29 20:17:59 +0100
committerMelanie2010-10-29 20:17:59 +0100
commite6fe83cd93691f5ecfbc00e4e140ffe98aa3ee1d (patch)
tree0da4c93e1005205668dffd9f0063175e933584c5 /OpenSim/Framework
parentPreliminary work on appearance layers. No user functionality yet. (diff)
downloadopensim-SC-e6fe83cd93691f5ecfbc00e4e140ffe98aa3ee1d.zip
opensim-SC-e6fe83cd93691f5ecfbc00e4e140ffe98aa3ee1d.tar.gz
opensim-SC-e6fe83cd93691f5ecfbc00e4e140ffe98aa3ee1d.tar.bz2
opensim-SC-e6fe83cd93691f5ecfbc00e4e140ffe98aa3ee1d.tar.xz
Revert "Preliminary work on appearance layers. No user functionality yet."
This work conflicts with cmickeyb's more extensive, related work This reverts commit 9c829c0410da89fdbb873f706d7ba63cf26b088f.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs451
1 files changed, 258 insertions, 193 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 829ad79..5da8ba1 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -32,125 +32,6 @@ using OpenMetaverse;
32 32
33namespace OpenSim.Framework 33namespace OpenSim.Framework
34{ 34{
35 // A special dictionary for avatar appearance
36 public struct LayerItem
37 {
38 public UUID ItemID;
39 public UUID AssetID;
40
41 public LayerItem(UUID itemID, UUID assetID)
42 {
43 ItemID = itemID;
44 AssetID = assetID;
45 }
46 }
47
48 public class Layer
49 {
50 protected int m_layerType;
51 protected Dictionary<UUID, UUID> m_items = new Dictionary<UUID, UUID>();
52 protected List<UUID> m_ids = new List<UUID>();
53
54 public Layer(int type)
55 {
56 m_layerType = type;
57 }
58
59 public int LayerType
60 {
61 get { return m_layerType; }
62 }
63
64 public int Count
65 {
66 get { return m_ids.Count; }
67 }
68
69 public void Add(UUID itemID, UUID assetID)
70 {
71 if (m_items.ContainsKey(itemID))
72 return;
73 if (m_ids.Count >= 5)
74 return;
75
76 m_ids.Add(itemID);
77 m_items[itemID] = assetID;
78 }
79
80 public void Wear(UUID itemID, UUID assetID)
81 {
82 Clear();
83 Add(itemID, assetID);
84 }
85
86 public void Clear()
87 {
88 m_ids.Clear();
89 m_items.Clear();
90 }
91
92 public void RemoveItem(UUID itemID)
93 {
94 if (m_items.ContainsKey(itemID))
95 {
96 m_ids.Remove(itemID);
97 m_items.Remove(itemID);
98 }
99 }
100
101 public void RemoveAsset(UUID assetID)
102 {
103 UUID itemID = UUID.Zero;
104
105 foreach (KeyValuePair<UUID, UUID> kvp in m_items)
106 {
107 if (kvp.Value == assetID)
108 {
109 itemID = kvp.Key;
110 break;
111 }
112 }
113
114 if (itemID != UUID.Zero)
115 {
116 m_ids.Remove(itemID);
117 m_items.Remove(itemID);
118 }
119 }
120
121 public LayerItem this [int idx]
122 {
123 get
124 {
125 if (idx >= m_ids.Count || idx < 0)
126 return new LayerItem(UUID.Zero, UUID.Zero);
127
128 return new LayerItem(m_ids[idx], m_items[m_ids[idx]]);
129 }
130 }
131 }
132
133 public enum AppearanceLayer
134 {
135 BODY = 0,
136 SKIN = 1,
137 HAIR = 2,
138 EYES = 3,
139 SHIRT = 4,
140 PANTS = 5,
141 SHOES = 6,
142 SOCKS = 7,
143 JACKET = 8,
144 GLOVES = 9,
145 UNDERSHIRT = 10,
146 UNDERPANTS = 11,
147 SKIRT = 12,
148 ALPHA = 13,
149 TATTOO = 14,
150
151 MAX_WEARABLES = 15
152 }
153
154 /// <summary> 35 /// <summary>
155 /// Contains the Avatar's Appearance and methods to manipulate the appearance. 36 /// Contains the Avatar's Appearance and methods to manipulate the appearance.
156 /// </summary> 37 /// </summary>
@@ -158,6 +39,25 @@ namespace OpenSim.Framework
158 { 39 {
159 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 40 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
160 41
42 // these are guessed at by the list here -
43 // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll
44 // correct them over time for when were are wrong.
45 public readonly static int BODY = 0;
46 public readonly static int SKIN = 1;
47 public readonly static int HAIR = 2;
48 public readonly static int EYES = 3;
49 public readonly static int SHIRT = 4;
50 public readonly static int PANTS = 5;
51 public readonly static int SHOES = 6;
52 public readonly static int SOCKS = 7;
53 public readonly static int JACKET = 8;
54 public readonly static int GLOVES = 9;
55 public readonly static int UNDERSHIRT = 10;
56 public readonly static int UNDERPANTS = 11;
57 public readonly static int SKIRT = 12;
58
59 private readonly static int MAX_WEARABLES = 13;
60
161 private static UUID BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); 61 private static UUID BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
162 private static UUID BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); 62 private static UUID BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
163 private static UUID SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); 63 private static UUID SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb");
@@ -168,10 +68,6 @@ namespace OpenSim.Framework
168 private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); 68 private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111");
169 private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); 69 private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66");
170 private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66"); 70 private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66");
171 private static UUID ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594");
172 private static UUID TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007");
173 private static UUID ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8");
174 private static UUID TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1");
175 71
176 public readonly static int VISUALPARAM_COUNT = 218; 72 public readonly static int VISUALPARAM_COUNT = 218;
177 73
@@ -207,156 +103,152 @@ namespace OpenSim.Framework
207 } 103 }
208 104
209 public virtual UUID BodyItem { 105 public virtual UUID BodyItem {
210 get { return m_wearables[(int)AppearanceLayer.BODY].ItemID; } 106 get { return m_wearables[BODY].ItemID; }
211 set { m_wearables[(int)AppearanceLayer.BODY].ItemID = value; } 107 set { m_wearables[BODY].ItemID = value; }
212 } 108 }
213 109
214 public virtual UUID BodyAsset { 110 public virtual UUID BodyAsset {
215 get { return m_wearables[(int)AppearanceLayer.BODY].AssetID; } 111 get { return m_wearables[BODY].AssetID; }
216 set { m_wearables[(int)AppearanceLayer.BODY].AssetID = value; } 112 set { m_wearables[BODY].AssetID = value; }
217 } 113 }
218 114
219 public virtual UUID SkinItem { 115 public virtual UUID SkinItem {
220 get { return m_wearables[(int)AppearanceLayer.SKIN].ItemID; } 116 get { return m_wearables[SKIN].ItemID; }
221 set { m_wearables[(int)AppearanceLayer.SKIN].ItemID = value; } 117 set { m_wearables[SKIN].ItemID = value; }
222 } 118 }
223 119
224 public virtual UUID SkinAsset { 120 public virtual UUID SkinAsset {
225 get { return m_wearables[(int)AppearanceLayer.SKIN].AssetID; } 121 get { return m_wearables[SKIN].AssetID; }
226 set { m_wearables[(int)AppearanceLayer.SKIN].AssetID = value; } 122 set { m_wearables[SKIN].AssetID = value; }
227 } 123 }
228 124
229 public virtual UUID HairItem { 125 public virtual UUID HairItem {
230 get { return m_wearables[(int)AppearanceLayer.HAIR].ItemID; } 126 get { return m_wearables[HAIR].ItemID; }
231 set { m_wearables[(int)AppearanceLayer.HAIR].ItemID = value; } 127 set { m_wearables[HAIR].ItemID = value; }
232 } 128 }
233 129
234 public virtual UUID HairAsset { 130 public virtual UUID HairAsset {
235 get { return m_wearables[(int)AppearanceLayer.HAIR].AssetID; } 131 get { return m_wearables[HAIR].AssetID; }
236 set { m_wearables[(int)AppearanceLayer.HAIR].AssetID = value; } 132 set { m_wearables[HAIR].AssetID = value; }
237 } 133 }
238 134
239 public virtual UUID EyesItem { 135 public virtual UUID EyesItem {
240 get { return m_wearables[(int)AppearanceLayer.EYES].ItemID; } 136 get { return m_wearables[EYES].ItemID; }
241 set { m_wearables[(int)AppearanceLayer.EYES].ItemID = value; } 137 set { m_wearables[EYES].ItemID = value; }
242 } 138 }
243 139
244 public virtual UUID EyesAsset { 140 public virtual UUID EyesAsset {
245 get { return m_wearables[(int)AppearanceLayer.EYES].AssetID; } 141 get { return m_wearables[EYES].AssetID; }
246 set { m_wearables[(int)AppearanceLayer.EYES].AssetID = value; } 142 set { m_wearables[EYES].AssetID = value; }
247 } 143 }
248 144
249 public virtual UUID ShirtItem { 145 public virtual UUID ShirtItem {
250 get { return m_wearables[(int)AppearanceLayer.SHIRT].ItemID; } 146 get { return m_wearables[SHIRT].ItemID; }
251 set { m_wearables[(int)AppearanceLayer.SHIRT].ItemID = value; } 147 set { m_wearables[SHIRT].ItemID = value; }
252 } 148 }
253 149
254 public virtual UUID ShirtAsset { 150 public virtual UUID ShirtAsset {
255 get { return m_wearables[(int)AppearanceLayer.SHIRT].AssetID; } 151 get { return m_wearables[SHIRT].AssetID; }
256 set { m_wearables[(int)AppearanceLayer.SHIRT].AssetID = value; } 152 set { m_wearables[SHIRT].AssetID = value; }
257 } 153 }
258 154
259 public virtual UUID PantsItem { 155 public virtual UUID PantsItem {
260 get { return m_wearables[(int)AppearanceLayer.PANTS].ItemID; } 156 get { return m_wearables[PANTS].ItemID; }
261 set { m_wearables[(int)AppearanceLayer.PANTS].ItemID = value; } 157 set { m_wearables[PANTS].ItemID = value; }
262 } 158 }
263 159
264 public virtual UUID PantsAsset { 160 public virtual UUID PantsAsset {
265 get { return m_wearables[(int)AppearanceLayer.PANTS].AssetID; } 161 get { return m_wearables[PANTS].AssetID; }
266 set { m_wearables[(int)AppearanceLayer.PANTS].AssetID = value; } 162 set { m_wearables[PANTS].AssetID = value; }
267 } 163 }
268 164
269 public virtual UUID ShoesItem { 165 public virtual UUID ShoesItem {
270 get { return m_wearables[(int)AppearanceLayer.SHOES].ItemID; } 166 get { return m_wearables[SHOES].ItemID; }
271 set { m_wearables[(int)AppearanceLayer.SHOES].ItemID = value; } 167 set { m_wearables[SHOES].ItemID = value; }
272 } 168 }
273 169
274 public virtual UUID ShoesAsset { 170 public virtual UUID ShoesAsset {
275 get { return m_wearables[(int)AppearanceLayer.SHOES].AssetID; } 171 get { return m_wearables[SHOES].AssetID; }
276 set { m_wearables[(int)AppearanceLayer.SHOES].AssetID = value; } 172 set { m_wearables[SHOES].AssetID = value; }
277 } 173 }
278 174
279 public virtual UUID SocksItem { 175 public virtual UUID SocksItem {
280 get { return m_wearables[(int)AppearanceLayer.SOCKS].ItemID; } 176 get { return m_wearables[SOCKS].ItemID; }
281 set { m_wearables[(int)AppearanceLayer.SOCKS].ItemID = value; } 177 set { m_wearables[SOCKS].ItemID = value; }
282 } 178 }
283 179
284 public virtual UUID SocksAsset { 180 public virtual UUID SocksAsset {
285 get { return m_wearables[(int)AppearanceLayer.SOCKS].AssetID; } 181 get { return m_wearables[SOCKS].AssetID; }
286 set { m_wearables[(int)AppearanceLayer.SOCKS].AssetID = value; } 182 set { m_wearables[SOCKS].AssetID = value; }
287 } 183 }
288 184
289 public virtual UUID JacketItem { 185 public virtual UUID JacketItem {
290 get { return m_wearables[(int)AppearanceLayer.JACKET].ItemID; } 186 get { return m_wearables[JACKET].ItemID; }
291 set { m_wearables[(int)AppearanceLayer.JACKET].ItemID = value; } 187 set { m_wearables[JACKET].ItemID = value; }
292 } 188 }
293 189
294 public virtual UUID JacketAsset { 190 public virtual UUID JacketAsset {
295 get { return m_wearables[(int)AppearanceLayer.JACKET].AssetID; } 191 get { return m_wearables[JACKET].AssetID; }
296 set { m_wearables[(int)AppearanceLayer.JACKET].AssetID = value; } 192 set { m_wearables[JACKET].AssetID = value; }
297 } 193 }
298 194
299 public virtual UUID GlovesItem { 195 public virtual UUID GlovesItem {
300 get { return m_wearables[(int)AppearanceLayer.GLOVES].ItemID; } 196 get { return m_wearables[GLOVES].ItemID; }
301 set { m_wearables[(int)AppearanceLayer.GLOVES].ItemID = value; } 197 set { m_wearables[GLOVES].ItemID = value; }
302 } 198 }
303 199
304 public virtual UUID GlovesAsset { 200 public virtual UUID GlovesAsset {
305 get { return m_wearables[(int)AppearanceLayer.GLOVES].AssetID; } 201 get { return m_wearables[GLOVES].AssetID; }
306 set { m_wearables[(int)AppearanceLayer.GLOVES].AssetID = value; } 202 set { m_wearables[GLOVES].AssetID = value; }
307 } 203 }
308 204
309 public virtual UUID UnderShirtItem { 205 public virtual UUID UnderShirtItem {
310 get { return m_wearables[(int)AppearanceLayer.UNDERSHIRT].ItemID; } 206 get { return m_wearables[UNDERSHIRT].ItemID; }
311 set { m_wearables[(int)AppearanceLayer.UNDERSHIRT].ItemID = value; } 207 set { m_wearables[UNDERSHIRT].ItemID = value; }
312 } 208 }
313 209
314 public virtual UUID UnderShirtAsset { 210 public virtual UUID UnderShirtAsset {
315 get { return m_wearables[(int)AppearanceLayer.UNDERSHIRT].AssetID; } 211 get { return m_wearables[UNDERSHIRT].AssetID; }
316 set { m_wearables[(int)AppearanceLayer.UNDERSHIRT].AssetID = value; } 212 set { m_wearables[UNDERSHIRT].AssetID = value; }
317 } 213 }
318 214
319 public virtual UUID UnderPantsItem { 215 public virtual UUID UnderPantsItem {
320 get { return m_wearables[(int)AppearanceLayer.UNDERPANTS].ItemID; } 216 get { return m_wearables[UNDERPANTS].ItemID; }
321 set { m_wearables[(int)AppearanceLayer.UNDERPANTS].ItemID = value; } 217 set { m_wearables[UNDERPANTS].ItemID = value; }
322 } 218 }
323 219
324 public virtual UUID UnderPantsAsset { 220 public virtual UUID UnderPantsAsset {
325 get { return m_wearables[(int)AppearanceLayer.UNDERPANTS].AssetID; } 221 get { return m_wearables[UNDERPANTS].AssetID; }
326 set { m_wearables[(int)AppearanceLayer.UNDERPANTS].AssetID = value; } 222 set { m_wearables[UNDERPANTS].AssetID = value; }
327 } 223 }
328 224
329 public virtual UUID SkirtItem { 225 public virtual UUID SkirtItem {
330 get { return m_wearables[(int)AppearanceLayer.SKIRT].ItemID; } 226 get { return m_wearables[SKIRT].ItemID; }
331 set { m_wearables[(int)AppearanceLayer.SKIRT].ItemID = value; } 227 set { m_wearables[SKIRT].ItemID = value; }
332 } 228 }
333 229
334 public virtual UUID SkirtAsset { 230 public virtual UUID SkirtAsset {
335 get { return m_wearables[(int)AppearanceLayer.SKIRT].AssetID; } 231 get { return m_wearables[SKIRT].AssetID; }
336 set { m_wearables[(int)AppearanceLayer.SKIRT].AssetID = value; } 232 set { m_wearables[SKIRT].AssetID = value; }
337 } 233 }
338 234
339 public virtual void SetDefaultWearables() 235 public virtual void SetDefaultWearables()
340 { 236 {
341 m_wearables[(int)AppearanceLayer.BODY].AssetID = BODY_ASSET; 237 m_wearables[BODY].AssetID = BODY_ASSET;
342 m_wearables[(int)AppearanceLayer.BODY].ItemID = BODY_ITEM; 238 m_wearables[BODY].ItemID = BODY_ITEM;
343 m_wearables[(int)AppearanceLayer.SKIN].AssetID = SKIN_ASSET; 239 m_wearables[SKIN].AssetID = SKIN_ASSET;
344 m_wearables[(int)AppearanceLayer.SKIN].ItemID = SKIN_ITEM; 240 m_wearables[SKIN].ItemID = SKIN_ITEM;
345 m_wearables[(int)AppearanceLayer.HAIR].AssetID = HAIR_ASSET; 241 m_wearables[HAIR].AssetID = HAIR_ASSET;
346 m_wearables[(int)AppearanceLayer.HAIR].ItemID = HAIR_ITEM; 242 m_wearables[HAIR].ItemID = HAIR_ITEM;
347 m_wearables[(int)AppearanceLayer.SHIRT].AssetID = SHIRT_ASSET; 243 m_wearables[SHIRT].AssetID = SHIRT_ASSET;
348 m_wearables[(int)AppearanceLayer.SHIRT].ItemID = SHIRT_ITEM; 244 m_wearables[SHIRT].ItemID = SHIRT_ITEM;
349 m_wearables[(int)AppearanceLayer.PANTS].AssetID = PANTS_ASSET; 245 m_wearables[PANTS].AssetID = PANTS_ASSET;
350 m_wearables[(int)AppearanceLayer.PANTS].ItemID = PANTS_ITEM; 246 m_wearables[PANTS].ItemID = PANTS_ITEM;
351 m_wearables[(int)AppearanceLayer.ALPHA].AssetID = ALPHA_ASSET;
352 m_wearables[(int)AppearanceLayer.ALPHA].ItemID = ALPHA_ITEM;
353 m_wearables[(int)AppearanceLayer.TATTOO].AssetID = TATTOO_ASSET;
354 m_wearables[(int)AppearanceLayer.TATTOO].ItemID = TATTOO_ITEM;
355 } 247 }
356 248
357 public virtual void ClearWearables() 249 public virtual void ClearWearables()
358 { 250 {
359 for (int i = 0; i < m_wearables.Length ; i++) 251 for (int i = 0; i < 13; i++)
360 { 252 {
361 m_wearables[i].AssetID = UUID.Zero; 253 m_wearables[i].AssetID = UUID.Zero;
362 m_wearables[i].ItemID = UUID.Zero; 254 m_wearables[i].ItemID = UUID.Zero;
@@ -394,12 +286,70 @@ namespace OpenSim.Framework
394 get { return m_hipOffset; } 286 get { return m_hipOffset; }
395 } 287 }
396 288
289 //Builds the VisualParam Enum using LIBOMV's Visual Param NameValues
290 /*
291 public void BuildVisualParamEnum()
292 {
293 Dictionary<string, int> IndexedParams = new Dictionary<string, int>();
294 int vpIndex = 0;
295 IndexedParams = new Dictionary<string, int>();
296
297 System.Text.StringBuilder sb = new System.Text.StringBuilder();
298
299 sb.Append("public enum VPElement: int\n");
300 sb.Append("{\n");
301 foreach (KeyValuePair<int, VisualParam> kvp in OpenMetaverse.VisualParams.Params)
302 {
303 VisualParam vp = kvp.Value;
304
305 // Only Group-0 parameters are sent in AgentSetAppearance packets
306 if (kvp.Value.Group == 0)
307 {
308
309 if (!IndexedParams.ContainsKey(vp.Name))
310 {
311
312 if (vp.Label.Length > 0 || vp.LabelMin.Length > 0 || vp.LabelMax.Length > 0)
313 {
314
315 sb.Append("/// <summary>\n");
316 if (vp.LabelMin.Length > 0 && vp.LabelMax.Length > 0)
317 sb.Append(string.Format("/// {0} - {1} 0--+255 {2}\n", vp.Label, vp.LabelMin,
318 vp.LabelMax));
319
320 else
321 sb.Append(string.Format("/// {0}\n", vp.Label));
322
323 sb.Append("/// </summary>\n");
324 }
325 sb.Append(string.Format(" {0}_{1} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"),vpIndex));
326
327 IndexedParams.Add(vp.Name, vpIndex++);
328 }
329 else
330 {
331 sb.Append(string.Format(" {0}_{1}_{2} = {2}", vp.Wearable.ToUpper(), vp.Name.ToUpper().Replace(" ", "_"), vpIndex));
332 vpIndex++;
333 //int i = 0;
334 }
335 }
336 if (vpIndex < 217)
337 sb.Append(",\n");
338 else
339 sb.Append("\n");
340
341 }
342 sb.Append("}\n");
343
344 }
345 */
346
397 public AvatarAppearance() : this(UUID.Zero) {} 347 public AvatarAppearance() : this(UUID.Zero) {}
398 348
399 public AvatarAppearance(UUID owner) 349 public AvatarAppearance(UUID owner)
400 { 350 {
401 m_wearables = new AvatarWearable[(int)AppearanceLayer.MAX_WEARABLES]; 351 m_wearables = new AvatarWearable[MAX_WEARABLES];
402 for (int i = 0; i < (int)AppearanceLayer.MAX_WEARABLES; i++) 352 for (int i = 0; i < MAX_WEARABLES; i++)
403 { 353 {
404 // this makes them all null 354 // this makes them all null
405 m_wearables[i] = new AvatarWearable(); 355 m_wearables[i] = new AvatarWearable();
@@ -492,6 +442,121 @@ namespace OpenSim.Framework
492 return visualParams; 442 return visualParams;
493 } 443 }
494 444
445 public override String ToString()
446 {
447 String s = "[Wearables] =>";
448 s += " Body Item: " + BodyItem.ToString() + ";";
449 s += " Skin Item: " + SkinItem.ToString() + ";";
450 s += " Shirt Item: " + ShirtItem.ToString() + ";";
451 s += " Pants Item: " + PantsItem.ToString() + ";";
452 return s;
453 }
454
455 // this is used for OGS1
456 public virtual Hashtable ToHashTable()
457 {
458 Hashtable h = new Hashtable();
459 h["owner"] = Owner.ToString();
460 h["serial"] = Serial.ToString();
461 h["visual_params"] = VisualParams;
462 h["texture"] = Texture.GetBytes();
463 h["avatar_height"] = AvatarHeight.ToString();
464 h["body_item"] = BodyItem.ToString();
465 h["body_asset"] = BodyAsset.ToString();
466 h["skin_item"] = SkinItem.ToString();
467 h["skin_asset"] = SkinAsset.ToString();
468 h["hair_item"] = HairItem.ToString();
469 h["hair_asset"] = HairAsset.ToString();
470 h["eyes_item"] = EyesItem.ToString();
471 h["eyes_asset"] = EyesAsset.ToString();
472 h["shirt_item"] = ShirtItem.ToString();
473 h["shirt_asset"] = ShirtAsset.ToString();
474 h["pants_item"] = PantsItem.ToString();
475 h["pants_asset"] = PantsAsset.ToString();
476 h["shoes_item"] = ShoesItem.ToString();
477 h["shoes_asset"] = ShoesAsset.ToString();
478 h["socks_item"] = SocksItem.ToString();
479 h["socks_asset"] = SocksAsset.ToString();
480 h["jacket_item"] = JacketItem.ToString();
481 h["jacket_asset"] = JacketAsset.ToString();
482 h["gloves_item"] = GlovesItem.ToString();
483 h["gloves_asset"] = GlovesAsset.ToString();
484 h["undershirt_item"] = UnderShirtItem.ToString();
485 h["undershirt_asset"] = UnderShirtAsset.ToString();
486 h["underpants_item"] = UnderPantsItem.ToString();
487 h["underpants_asset"] = UnderPantsAsset.ToString();
488 h["skirt_item"] = SkirtItem.ToString();
489 h["skirt_asset"] = SkirtAsset.ToString();
490
491 string attachments = GetAttachmentsString();
492 if (attachments != String.Empty)
493 h["attachments"] = attachments;
494
495 return h;
496 }
497
498 public AvatarAppearance(Hashtable h)
499 {
500 Owner = new UUID((string)h["owner"]);
501 Serial = Convert.ToInt32((string)h["serial"]);
502 VisualParams = (byte[])h["visual_params"];
503
504 if (h.Contains("texture"))
505 {
506 byte[] te = h["texture"] as byte[];
507 if (te != null && te.Length > 0)
508 Texture = new Primitive.TextureEntry(te, 0, te.Length);
509 }
510 else
511 {
512 // We shouldn't be receiving appearance hashtables without a TextureEntry,
513 // but in case we do this will prevent a failure when saving to the database
514 Texture = GetDefaultTexture();
515 }
516
517
518 AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]);
519
520 m_wearables = new AvatarWearable[MAX_WEARABLES];
521 for (int i = 0; i < MAX_WEARABLES; i++)
522 {
523 // this makes them all null
524 m_wearables[i] = new AvatarWearable();
525 }
526
527 BodyItem = new UUID((string)h["body_item"]);
528 BodyAsset = new UUID((string)h["body_asset"]);
529 SkinItem = new UUID((string)h["skin_item"]);
530 SkinAsset = new UUID((string)h["skin_asset"]);
531 HairItem = new UUID((string)h["hair_item"]);
532 HairAsset = new UUID((string)h["hair_asset"]);
533 EyesItem = new UUID((string)h["eyes_item"]);
534 EyesAsset = new UUID((string)h["eyes_asset"]);
535 ShirtItem = new UUID((string)h["shirt_item"]);
536 ShirtAsset = new UUID((string)h["shirt_asset"]);
537 PantsItem = new UUID((string)h["pants_item"]);
538 PantsAsset = new UUID((string)h["pants_asset"]);
539 ShoesItem = new UUID((string)h["shoes_item"]);
540 ShoesAsset = new UUID((string)h["shoes_asset"]);
541 SocksItem = new UUID((string)h["socks_item"]);
542 SocksAsset = new UUID((string)h["socks_asset"]);
543 JacketItem = new UUID((string)h["jacket_item"]);
544 JacketAsset = new UUID((string)h["jacket_asset"]);
545 GlovesItem = new UUID((string)h["gloves_item"]);
546 GlovesAsset = new UUID((string)h["gloves_asset"]);
547 UnderShirtItem = new UUID((string)h["undershirt_item"]);
548 UnderShirtAsset = new UUID((string)h["undershirt_asset"]);
549 UnderPantsItem = new UUID((string)h["underpants_item"]);
550 UnderPantsAsset = new UUID((string)h["underpants_asset"]);
551 SkirtItem = new UUID((string)h["skirt_item"]);
552 SkirtAsset = new UUID((string)h["skirt_asset"]);
553
554 if (h.ContainsKey("attachments"))
555 {
556 SetAttachmentsString(h["attachments"].ToString());
557 }
558 }
559
495 private Dictionary<int, UUID[]> m_attachments = new Dictionary<int, UUID[]>(); 560 private Dictionary<int, UUID[]> m_attachments = new Dictionary<int, UUID[]>();
496 561
497 public void SetAttachments(AttachmentData[] data) 562 public void SetAttachments(AttachmentData[] data)
@@ -1424,4 +1489,4 @@ namespace OpenSim.Framework
1424 SKIRT_SKIRT_BLUE = 217 1489 SKIRT_SKIRT_BLUE = 217
1425 } 1490 }
1426 } 1491 }
1427} 1492} \ No newline at end of file