diff options
author | Justin Clark-Casey (justincc) | 2010-10-30 03:07:45 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-10-30 03:07:45 +0100 |
commit | f9227977f8190ff1cf094e4adb025a822645371f (patch) | |
tree | 5afbce81eb5359f8beaeaef3f7c30518e689f4f6 /OpenSim/Framework/AvatarAppearance.cs | |
parent | minor: remove some old commented out code (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-f9227977f8190ff1cf094e4adb025a822645371f.zip opensim-SC-f9227977f8190ff1cf094e4adb025a822645371f.tar.gz opensim-SC-f9227977f8190ff1cf094e4adb025a822645371f.tar.bz2 opensim-SC-f9227977f8190ff1cf094e4adb025a822645371f.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Framework/AvatarAppearance.cs')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 241 |
1 files changed, 9 insertions, 232 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 9494410..ee60622 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -35,104 +35,6 @@ using log4net; | |||
35 | 35 | ||
36 | namespace OpenSim.Framework | 36 | namespace 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; } |
@@ -403,7 +175,7 @@ namespace OpenSim.Framework | |||
403 | m_wearables = null; | 175 | m_wearables = null; |
404 | if (appearance.Wearables != null) | 176 | if (appearance.Wearables != null) |
405 | { | 177 | { |
406 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 13 of these | 178 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 15 of these |
407 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 179 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) |
408 | SetWearable(i,appearance.Wearables[i]); | 180 | SetWearable(i,appearance.Wearables[i]); |
409 | } | 181 | } |
@@ -547,7 +319,9 @@ namespace OpenSim.Framework | |||
547 | // DEBUG ON | 319 | // DEBUG ON |
548 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); | 320 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); |
549 | // DEBUG OFF | 321 | // DEBUG OFF |
550 | m_wearables[wearableId] = new AvatarWearable(wearable.ItemID,wearable.AssetID); | 322 | m_wearables[wearableId].Clear(); |
323 | for (int i = 0 ; i < wearable.Count ; i++) | ||
324 | m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); | ||
551 | } | 325 | } |
552 | 326 | ||
553 | 327 | ||
@@ -563,7 +337,10 @@ namespace OpenSim.Framework | |||
563 | s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID); | 337 | s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID); |
564 | 338 | ||
565 | foreach (AvatarWearable awear in m_wearables) | 339 | foreach (AvatarWearable awear in m_wearables) |
566 | s += String.Format("Wearable: item={0}, asset={1}\n",awear.ItemID,awear.AssetID); | 340 | { |
341 | for ( int i = 0 ; i < awear.Count ; i++ ) | ||
342 | s += String.Format("Wearable: item={0}, asset={1}\n",awear[i].ItemID,awear[i].AssetID); | ||
343 | } | ||
567 | 344 | ||
568 | s += "Visual Params: "; | 345 | s += "Visual Params: "; |
569 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) | 346 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) |
@@ -733,7 +510,7 @@ namespace OpenSim.Framework | |||
733 | { | 510 | { |
734 | OSDArray wears = (OSDArray)(data["wearables"]); | 511 | OSDArray wears = (OSDArray)(data["wearables"]); |
735 | for (int i = 0; i < wears.Count; i++) | 512 | for (int i = 0; i < wears.Count; i++) |
736 | m_wearables[i] = new AvatarWearable((OSDMap)wears[i]); | 513 | m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); |
737 | } | 514 | } |
738 | else | 515 | else |
739 | { | 516 | { |