diff options
author | Jonathan Freedman | 2010-10-30 14:10:13 -0400 |
---|---|---|
committer | Jonathan Freedman | 2010-10-30 14:10:13 -0400 |
commit | e371d3208cdda87f8ea86adb591ed6225f0aa442 (patch) | |
tree | f481acfbafcb7134c00ff519c0c12b41e7815d02 /OpenSim/Framework | |
parent | Merge branch 'master' into mantis5110 (diff) | |
parent | Logins work now, but avatars are green ugly gnomes. (diff) | |
download | opensim-SC-e371d3208cdda87f8ea86adb591ed6225f0aa442.zip opensim-SC-e371d3208cdda87f8ea86adb591ed6225f0aa442.tar.gz opensim-SC-e371d3208cdda87f8ea86adb591ed6225f0aa442.tar.bz2 opensim-SC-e371d3208cdda87f8ea86adb591ed6225f0aa442.tar.xz |
Merge branch 'master' into mantis5110
Conflicts:
OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AgentCircuitData.cs | 53 | ||||
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 248 | ||||
-rw-r--r-- | OpenSim/Framework/AvatarWearable.cs | 157 | ||||
-rw-r--r-- | OpenSim/Framework/ChildAgentDataUpdate.cs | 10 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/VersionInfo.cs | 2 |
5 files changed, 151 insertions, 319 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 9494410..1e003f7 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; } |
@@ -339,6 +111,10 @@ namespace OpenSim.Framework | |||
339 | SetDefaultParams(); | 111 | SetDefaultParams(); |
340 | SetHeight(); | 112 | SetHeight(); |
341 | 113 | ||
114 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; | ||
115 | for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) | ||
116 | m_wearables[i] = new AvatarWearable(); | ||
117 | |||
342 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 118 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
343 | } | 119 | } |
344 | 120 | ||
@@ -400,10 +176,11 @@ namespace OpenSim.Framework | |||
400 | m_serial = appearance.Serial; | 176 | m_serial = appearance.Serial; |
401 | m_owner = appearance.Owner; | 177 | m_owner = appearance.Owner; |
402 | 178 | ||
403 | m_wearables = null; | 179 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; |
180 | for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ ) | ||
181 | m_wearables[i] = new AvatarWearable(); | ||
404 | if (appearance.Wearables != null) | 182 | if (appearance.Wearables != null) |
405 | { | 183 | { |
406 | m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 13 of these | ||
407 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 184 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) |
408 | SetWearable(i,appearance.Wearables[i]); | 185 | SetWearable(i,appearance.Wearables[i]); |
409 | } | 186 | } |
@@ -547,7 +324,9 @@ namespace OpenSim.Framework | |||
547 | // DEBUG ON | 324 | // DEBUG ON |
548 | // 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); |
549 | // DEBUG OFF | 326 | // DEBUG OFF |
550 | 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); | ||
551 | } | 330 | } |
552 | 331 | ||
553 | 332 | ||
@@ -563,7 +342,10 @@ namespace OpenSim.Framework | |||
563 | 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); |
564 | 343 | ||
565 | foreach (AvatarWearable awear in m_wearables) | 344 | foreach (AvatarWearable awear in m_wearables) |
566 | 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 | } | ||
567 | 349 | ||
568 | s += "Visual Params: "; | 350 | s += "Visual Params: "; |
569 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) | 351 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) |
@@ -733,7 +515,7 @@ namespace OpenSim.Framework | |||
733 | { | 515 | { |
734 | OSDArray wears = (OSDArray)(data["wearables"]); | 516 | OSDArray wears = (OSDArray)(data["wearables"]); |
735 | for (int i = 0; i < wears.Count; i++) | 517 | for (int i = 0; i < wears.Count; i++) |
736 | m_wearables[i] = new AvatarWearable((OSDMap)wears[i]); | 518 | m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); |
737 | } | 519 | } |
738 | else | 520 | else |
739 | { | 521 | { |
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 87098bf..0a02dcf 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs | |||
@@ -26,11 +26,24 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | using OpenMetaverse.StructuredData; | 31 | using OpenMetaverse.StructuredData; |
31 | 32 | ||
32 | namespace OpenSim.Framework | 33 | namespace 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,158 @@ 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 | |||
92 | protected Dictionary<UUID, UUID> m_items = new Dictionary<UUID, UUID>(); | ||
93 | protected List<UUID> m_ids = new List<UUID>(); | ||
72 | 94 | ||
73 | public AvatarWearable() | 95 | public AvatarWearable() |
74 | { | 96 | { |
75 | } | 97 | } |
76 | 98 | ||
77 | public AvatarWearable(UUID itemId, UUID assetId) | 99 | public AvatarWearable(UUID itemID, UUID assetID) |
78 | { | 100 | { |
79 | AssetID = assetId; | 101 | Wear(itemID, assetID); |
80 | ItemID = itemId; | ||
81 | } | 102 | } |
82 | 103 | ||
83 | public AvatarWearable(OSDMap args) | 104 | public AvatarWearable(OSDArray args) |
84 | { | 105 | { |
85 | Unpack(args); | 106 | Unpack(args); |
86 | } | 107 | } |
87 | 108 | ||
88 | public OSDMap Pack() | 109 | public OSD Pack() |
110 | { | ||
111 | OSDArray wearlist = new OSDArray(); | ||
112 | |||
113 | foreach (UUID id in m_ids) | ||
114 | { | ||
115 | OSDMap weardata = new OSDMap(); | ||
116 | weardata["item"] = OSD.FromUUID(id); | ||
117 | weardata["asset"] = OSD.FromUUID(m_items[id]); | ||
118 | wearlist.Add(weardata); | ||
119 | } | ||
120 | |||
121 | return wearlist; | ||
122 | } | ||
123 | |||
124 | public void Unpack(OSDArray args) | ||
125 | { | ||
126 | Clear(); | ||
127 | |||
128 | foreach (OSDMap weardata in args) | ||
129 | { | ||
130 | Add(weardata["item"].AsUUID(), weardata["asset"].AsUUID()); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | public int Count | ||
135 | { | ||
136 | get { return m_ids.Count; } | ||
137 | } | ||
138 | |||
139 | public void Add(UUID itemID, UUID assetID) | ||
140 | { | ||
141 | if (itemID == UUID.Zero) | ||
142 | return; | ||
143 | if (m_items.ContainsKey(itemID)) | ||
144 | { | ||
145 | m_items[itemID] = assetID; | ||
146 | return; | ||
147 | } | ||
148 | if (m_ids.Count >= 5) | ||
149 | return; | ||
150 | |||
151 | m_ids.Add(itemID); | ||
152 | m_items[itemID] = assetID; | ||
153 | } | ||
154 | |||
155 | public void Wear(UUID itemID, UUID assetID) | ||
89 | { | 156 | { |
90 | OSDMap weardata = new OSDMap(); | 157 | Clear(); |
91 | weardata["item"] = OSD.FromUUID(ItemID); | 158 | Add(itemID, assetID); |
92 | weardata["asset"] = OSD.FromUUID(AssetID); | 159 | } |
93 | 160 | ||
94 | return weardata; | 161 | public void Clear() |
162 | { | ||
163 | m_ids.Clear(); | ||
164 | m_items.Clear(); | ||
95 | } | 165 | } |
96 | 166 | ||
97 | public void Unpack(OSDMap args) | 167 | public void RemoveItem(UUID itemID) |
98 | { | 168 | { |
99 | ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero; | 169 | if (m_items.ContainsKey(itemID)) |
100 | AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero; | 170 | { |
171 | m_ids.Remove(itemID); | ||
172 | m_items.Remove(itemID); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | public void RemoveAsset(UUID assetID) | ||
177 | { | ||
178 | UUID itemID = UUID.Zero; | ||
179 | |||
180 | foreach (KeyValuePair<UUID, UUID> kvp in m_items) | ||
181 | { | ||
182 | if (kvp.Value == assetID) | ||
183 | { | ||
184 | itemID = kvp.Key; | ||
185 | break; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | if (itemID != UUID.Zero) | ||
190 | { | ||
191 | m_ids.Remove(itemID); | ||
192 | m_items.Remove(itemID); | ||
193 | } | ||
194 | } | ||
195 | |||
196 | public WearableItem this [int idx] | ||
197 | { | ||
198 | get | ||
199 | { | ||
200 | if (idx >= m_ids.Count || idx < 0) | ||
201 | return new WearableItem(UUID.Zero, UUID.Zero); | ||
202 | |||
203 | return new WearableItem(m_ids[idx], m_items[m_ids[idx]]); | ||
204 | } | ||
101 | } | 205 | } |
102 | 206 | ||
103 | public static AvatarWearable[] DefaultWearables | 207 | public static AvatarWearable[] DefaultWearables |
104 | { | 208 | { |
105 | get | 209 | get |
106 | { | 210 | { |
107 | AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 13 of these | 211 | AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these |
108 | for (int i = 0; i < MAX_WEARABLES; i++) | 212 | for (int i = 0; i < MAX_WEARABLES; i++) |
109 | { | 213 | { |
110 | defaultWearables[i] = new AvatarWearable(); | 214 | defaultWearables[i] = new AvatarWearable(); |
111 | } | 215 | } |
112 | 216 | ||
113 | // Body | 217 | // Body |
114 | defaultWearables[0].ItemID = DEFAULT_BODY_ITEM; | 218 | defaultWearables[BODY].Add(DEFAULT_BODY_ITEM, DEFAULT_BODY_ASSET); |
115 | defaultWearables[0].AssetID = DEFAULT_BODY_ASSET; | ||
116 | 219 | ||
117 | // Hair | 220 | // Hair |
118 | defaultWearables[2].ItemID = DEFAULT_HAIR_ITEM; | 221 | defaultWearables[HAIR].Add(DEFAULT_HAIR_ITEM, DEFAULT_HAIR_ASSET); |
119 | defaultWearables[2].AssetID = DEFAULT_HAIR_ASSET; | ||
120 | 222 | ||
121 | // Skin | 223 | // Skin |
122 | defaultWearables[1].ItemID = DEFAULT_SKIN_ITEM; | 224 | defaultWearables[SKIN].Add(DEFAULT_SKIN_ITEM, DEFAULT_SKIN_ASSET); |
123 | defaultWearables[1].AssetID = DEFAULT_SKIN_ASSET; | ||
124 | 225 | ||
125 | // Shirt | 226 | // Shirt |
126 | defaultWearables[4].ItemID = DEFAULT_SHIRT_ITEM; | 227 | defaultWearables[SHIRT].Add(DEFAULT_SHIRT_ITEM, DEFAULT_SHIRT_ASSET); |
127 | defaultWearables[4].AssetID = DEFAULT_SHIRT_ASSET; | ||
128 | 228 | ||
129 | // Pants | 229 | // Pants |
130 | defaultWearables[5].ItemID = DEFAULT_PANTS_ITEM; | 230 | defaultWearables[PANTS].Add(DEFAULT_PANTS_ITEM, DEFAULT_PANTS_ASSET); |
131 | defaultWearables[5].AssetID = DEFAULT_PANTS_ASSET; | 231 | |
232 | // Alpha | ||
233 | defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET); | ||
234 | |||
235 | // Tattoo | ||
236 | defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); | ||
132 | 237 | ||
133 | return defaultWearables; | 238 | return defaultWearables; |
134 | } | 239 | } |
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/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index c88e0d1..c9d4c93 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 | } |