diff options
author | Melanie | 2010-10-30 00:41:36 +0100 |
---|---|---|
committer | Melanie | 2010-10-30 00:41:36 +0100 |
commit | 818ed2032aa4e6c0a9ede3598d64f0c7960135c4 (patch) | |
tree | eceb29a75d784b083cdf721418a13fe8ea372963 /OpenSim/Framework/AvatarAppearance.cs | |
parent | Rename the new default texture to be consistent with the others (diff) | |
download | opensim-SC_OLD-818ed2032aa4e6c0a9ede3598d64f0c7960135c4.zip opensim-SC_OLD-818ed2032aa4e6c0a9ede3598d64f0c7960135c4.tar.gz opensim-SC_OLD-818ed2032aa4e6c0a9ede3598d64f0c7960135c4.tar.bz2 opensim-SC_OLD-818ed2032aa4e6c0a9ede3598d64f0c7960135c4.tar.xz |
READ CAREFULLY!!! This is a BROKEN commit. It is UNTESTED and INCOMPLETE.
It contains a major interface version bump and will NOT work with earlier grid
services. This is preliminary work that will lead to layers support.
Rest appearance services are commented out completely, they will have to be
adapted by someone who actually uses them. Remote admin is working, but has
no layers support. There is no layers support in the database. Login likely
won't work. You have been warned.
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 a4bb765..f378e96 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; } |
@@ -407,7 +179,7 @@ namespace OpenSim.Framework | |||
407 | m_wearables = null; | 179 | m_wearables = null; |
408 | if (appearance.Wearables != null) | 180 | if (appearance.Wearables != null) |
409 | { | 181 | { |
410 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 13 of these | 182 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 15 of these |
411 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 183 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) |
412 | SetWearable(i,appearance.Wearables[i]); | 184 | SetWearable(i,appearance.Wearables[i]); |
413 | } | 185 | } |
@@ -552,7 +324,9 @@ namespace OpenSim.Framework | |||
552 | // DEBUG ON | 324 | // DEBUG ON |
553 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); | 325 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); |
554 | // DEBUG OFF | 326 | // DEBUG OFF |
555 | m_wearables[wearableId] = new AvatarWearable(wearable.ItemID,wearable.AssetID); | 327 | m_wearables[wearableId].Clear(); |
328 | for (int i = 0 ; i < wearable.Count ; i++) | ||
329 | m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); | ||
556 | } | 330 | } |
557 | 331 | ||
558 | 332 | ||
@@ -568,7 +342,10 @@ namespace OpenSim.Framework | |||
568 | s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID); | 342 | s += String.Format("Texture: {0} --> {1}\n",i,m_texture.FaceTextures[i].TextureID); |
569 | 343 | ||
570 | foreach (AvatarWearable awear in m_wearables) | 344 | foreach (AvatarWearable awear in m_wearables) |
571 | s += String.Format("Wearable: item={0}, asset={1}\n",awear.ItemID,awear.AssetID); | 345 | { |
346 | for ( int i = 0 ; i < awear.Count ; i++ ) | ||
347 | s += String.Format("Wearable: item={0}, asset={1}\n",awear[i].ItemID,awear[i].AssetID); | ||
348 | } | ||
572 | 349 | ||
573 | s += "Visual Params: "; | 350 | s += "Visual Params: "; |
574 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) | 351 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) |
@@ -738,7 +515,7 @@ namespace OpenSim.Framework | |||
738 | { | 515 | { |
739 | OSDArray wears = (OSDArray)(data["wearables"]); | 516 | OSDArray wears = (OSDArray)(data["wearables"]); |
740 | for (int i = 0; i < wears.Count; i++) | 517 | for (int i = 0; i < wears.Count; i++) |
741 | m_wearables[i] = new AvatarWearable((OSDMap)wears[i]); | 518 | m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); |
742 | } | 519 | } |
743 | else | 520 | else |
744 | { | 521 | { |