diff options
author | Melanie | 2010-10-29 18:58:22 +0100 |
---|---|---|
committer | Melanie | 2010-10-29 18:58:22 +0100 |
commit | 9c829c0410da89fdbb873f706d7ba63cf26b088f (patch) | |
tree | 8a3e4ec547afdec79c832d645208ba21e6a6c98e /OpenSim/Framework/AvatarAppearance.cs | |
parent | HypergridLinker optimizations and enable use of owner_uuid/EstateOwner with l... (diff) | |
download | opensim-SC_OLD-9c829c0410da89fdbb873f706d7ba63cf26b088f.zip opensim-SC_OLD-9c829c0410da89fdbb873f706d7ba63cf26b088f.tar.gz opensim-SC_OLD-9c829c0410da89fdbb873f706d7ba63cf26b088f.tar.bz2 opensim-SC_OLD-9c829c0410da89fdbb873f706d7ba63cf26b088f.tar.xz |
Preliminary work on appearance layers. No user functionality yet.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 451 |
1 files changed, 193 insertions, 258 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 5da8ba1..829ad79 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -32,6 +32,125 @@ using OpenMetaverse; | |||
32 | 32 | ||
33 | namespace OpenSim.Framework | 33 | namespace 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 | |||
35 | /// <summary> | 154 | /// <summary> |
36 | /// Contains the Avatar's Appearance and methods to manipulate the appearance. | 155 | /// Contains the Avatar's Appearance and methods to manipulate the appearance. |
37 | /// </summary> | 156 | /// </summary> |
@@ -39,25 +158,6 @@ namespace OpenSim.Framework | |||
39 | { | 158 | { |
40 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 159 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | 160 | ||
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 | |||
61 | private static UUID BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); | 161 | private static UUID BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); |
62 | private static UUID BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); | 162 | private static UUID BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); |
63 | private static UUID SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); | 163 | private static UUID SKIN_ASSET = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); |
@@ -68,6 +168,10 @@ namespace OpenSim.Framework | |||
68 | private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); | 168 | private static UUID PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); |
69 | private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); | 169 | private static UUID HAIR_ASSET = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66"); |
70 | private static UUID HAIR_ITEM = new UUID("d342e6c1-b9d2-11dc-95ff-0800200c9a66"); | 170 | 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"); | ||
71 | 175 | ||
72 | public readonly static int VISUALPARAM_COUNT = 218; | 176 | public readonly static int VISUALPARAM_COUNT = 218; |
73 | 177 | ||
@@ -103,152 +207,156 @@ namespace OpenSim.Framework | |||
103 | } | 207 | } |
104 | 208 | ||
105 | public virtual UUID BodyItem { | 209 | public virtual UUID BodyItem { |
106 | get { return m_wearables[BODY].ItemID; } | 210 | get { return m_wearables[(int)AppearanceLayer.BODY].ItemID; } |
107 | set { m_wearables[BODY].ItemID = value; } | 211 | set { m_wearables[(int)AppearanceLayer.BODY].ItemID = value; } |
108 | } | 212 | } |
109 | 213 | ||
110 | public virtual UUID BodyAsset { | 214 | public virtual UUID BodyAsset { |
111 | get { return m_wearables[BODY].AssetID; } | 215 | get { return m_wearables[(int)AppearanceLayer.BODY].AssetID; } |
112 | set { m_wearables[BODY].AssetID = value; } | 216 | set { m_wearables[(int)AppearanceLayer.BODY].AssetID = value; } |
113 | } | 217 | } |
114 | 218 | ||
115 | public virtual UUID SkinItem { | 219 | public virtual UUID SkinItem { |
116 | get { return m_wearables[SKIN].ItemID; } | 220 | get { return m_wearables[(int)AppearanceLayer.SKIN].ItemID; } |
117 | set { m_wearables[SKIN].ItemID = value; } | 221 | set { m_wearables[(int)AppearanceLayer.SKIN].ItemID = value; } |
118 | } | 222 | } |
119 | 223 | ||
120 | public virtual UUID SkinAsset { | 224 | public virtual UUID SkinAsset { |
121 | get { return m_wearables[SKIN].AssetID; } | 225 | get { return m_wearables[(int)AppearanceLayer.SKIN].AssetID; } |
122 | set { m_wearables[SKIN].AssetID = value; } | 226 | set { m_wearables[(int)AppearanceLayer.SKIN].AssetID = value; } |
123 | } | 227 | } |
124 | 228 | ||
125 | public virtual UUID HairItem { | 229 | public virtual UUID HairItem { |
126 | get { return m_wearables[HAIR].ItemID; } | 230 | get { return m_wearables[(int)AppearanceLayer.HAIR].ItemID; } |
127 | set { m_wearables[HAIR].ItemID = value; } | 231 | set { m_wearables[(int)AppearanceLayer.HAIR].ItemID = value; } |
128 | } | 232 | } |
129 | 233 | ||
130 | public virtual UUID HairAsset { | 234 | public virtual UUID HairAsset { |
131 | get { return m_wearables[HAIR].AssetID; } | 235 | get { return m_wearables[(int)AppearanceLayer.HAIR].AssetID; } |
132 | set { m_wearables[HAIR].AssetID = value; } | 236 | set { m_wearables[(int)AppearanceLayer.HAIR].AssetID = value; } |
133 | } | 237 | } |
134 | 238 | ||
135 | public virtual UUID EyesItem { | 239 | public virtual UUID EyesItem { |
136 | get { return m_wearables[EYES].ItemID; } | 240 | get { return m_wearables[(int)AppearanceLayer.EYES].ItemID; } |
137 | set { m_wearables[EYES].ItemID = value; } | 241 | set { m_wearables[(int)AppearanceLayer.EYES].ItemID = value; } |
138 | } | 242 | } |
139 | 243 | ||
140 | public virtual UUID EyesAsset { | 244 | public virtual UUID EyesAsset { |
141 | get { return m_wearables[EYES].AssetID; } | 245 | get { return m_wearables[(int)AppearanceLayer.EYES].AssetID; } |
142 | set { m_wearables[EYES].AssetID = value; } | 246 | set { m_wearables[(int)AppearanceLayer.EYES].AssetID = value; } |
143 | } | 247 | } |
144 | 248 | ||
145 | public virtual UUID ShirtItem { | 249 | public virtual UUID ShirtItem { |
146 | get { return m_wearables[SHIRT].ItemID; } | 250 | get { return m_wearables[(int)AppearanceLayer.SHIRT].ItemID; } |
147 | set { m_wearables[SHIRT].ItemID = value; } | 251 | set { m_wearables[(int)AppearanceLayer.SHIRT].ItemID = value; } |
148 | } | 252 | } |
149 | 253 | ||
150 | public virtual UUID ShirtAsset { | 254 | public virtual UUID ShirtAsset { |
151 | get { return m_wearables[SHIRT].AssetID; } | 255 | get { return m_wearables[(int)AppearanceLayer.SHIRT].AssetID; } |
152 | set { m_wearables[SHIRT].AssetID = value; } | 256 | set { m_wearables[(int)AppearanceLayer.SHIRT].AssetID = value; } |
153 | } | 257 | } |
154 | 258 | ||
155 | public virtual UUID PantsItem { | 259 | public virtual UUID PantsItem { |
156 | get { return m_wearables[PANTS].ItemID; } | 260 | get { return m_wearables[(int)AppearanceLayer.PANTS].ItemID; } |
157 | set { m_wearables[PANTS].ItemID = value; } | 261 | set { m_wearables[(int)AppearanceLayer.PANTS].ItemID = value; } |
158 | } | 262 | } |
159 | 263 | ||
160 | public virtual UUID PantsAsset { | 264 | public virtual UUID PantsAsset { |
161 | get { return m_wearables[PANTS].AssetID; } | 265 | get { return m_wearables[(int)AppearanceLayer.PANTS].AssetID; } |
162 | set { m_wearables[PANTS].AssetID = value; } | 266 | set { m_wearables[(int)AppearanceLayer.PANTS].AssetID = value; } |
163 | } | 267 | } |
164 | 268 | ||
165 | public virtual UUID ShoesItem { | 269 | public virtual UUID ShoesItem { |
166 | get { return m_wearables[SHOES].ItemID; } | 270 | get { return m_wearables[(int)AppearanceLayer.SHOES].ItemID; } |
167 | set { m_wearables[SHOES].ItemID = value; } | 271 | set { m_wearables[(int)AppearanceLayer.SHOES].ItemID = value; } |
168 | } | 272 | } |
169 | 273 | ||
170 | public virtual UUID ShoesAsset { | 274 | public virtual UUID ShoesAsset { |
171 | get { return m_wearables[SHOES].AssetID; } | 275 | get { return m_wearables[(int)AppearanceLayer.SHOES].AssetID; } |
172 | set { m_wearables[SHOES].AssetID = value; } | 276 | set { m_wearables[(int)AppearanceLayer.SHOES].AssetID = value; } |
173 | } | 277 | } |
174 | 278 | ||
175 | public virtual UUID SocksItem { | 279 | public virtual UUID SocksItem { |
176 | get { return m_wearables[SOCKS].ItemID; } | 280 | get { return m_wearables[(int)AppearanceLayer.SOCKS].ItemID; } |
177 | set { m_wearables[SOCKS].ItemID = value; } | 281 | set { m_wearables[(int)AppearanceLayer.SOCKS].ItemID = value; } |
178 | } | 282 | } |
179 | 283 | ||
180 | public virtual UUID SocksAsset { | 284 | public virtual UUID SocksAsset { |
181 | get { return m_wearables[SOCKS].AssetID; } | 285 | get { return m_wearables[(int)AppearanceLayer.SOCKS].AssetID; } |
182 | set { m_wearables[SOCKS].AssetID = value; } | 286 | set { m_wearables[(int)AppearanceLayer.SOCKS].AssetID = value; } |
183 | } | 287 | } |
184 | 288 | ||
185 | public virtual UUID JacketItem { | 289 | public virtual UUID JacketItem { |
186 | get { return m_wearables[JACKET].ItemID; } | 290 | get { return m_wearables[(int)AppearanceLayer.JACKET].ItemID; } |
187 | set { m_wearables[JACKET].ItemID = value; } | 291 | set { m_wearables[(int)AppearanceLayer.JACKET].ItemID = value; } |
188 | } | 292 | } |
189 | 293 | ||
190 | public virtual UUID JacketAsset { | 294 | public virtual UUID JacketAsset { |
191 | get { return m_wearables[JACKET].AssetID; } | 295 | get { return m_wearables[(int)AppearanceLayer.JACKET].AssetID; } |
192 | set { m_wearables[JACKET].AssetID = value; } | 296 | set { m_wearables[(int)AppearanceLayer.JACKET].AssetID = value; } |
193 | } | 297 | } |
194 | 298 | ||
195 | public virtual UUID GlovesItem { | 299 | public virtual UUID GlovesItem { |
196 | get { return m_wearables[GLOVES].ItemID; } | 300 | get { return m_wearables[(int)AppearanceLayer.GLOVES].ItemID; } |
197 | set { m_wearables[GLOVES].ItemID = value; } | 301 | set { m_wearables[(int)AppearanceLayer.GLOVES].ItemID = value; } |
198 | } | 302 | } |
199 | 303 | ||
200 | public virtual UUID GlovesAsset { | 304 | public virtual UUID GlovesAsset { |
201 | get { return m_wearables[GLOVES].AssetID; } | 305 | get { return m_wearables[(int)AppearanceLayer.GLOVES].AssetID; } |
202 | set { m_wearables[GLOVES].AssetID = value; } | 306 | set { m_wearables[(int)AppearanceLayer.GLOVES].AssetID = value; } |
203 | } | 307 | } |
204 | 308 | ||
205 | public virtual UUID UnderShirtItem { | 309 | public virtual UUID UnderShirtItem { |
206 | get { return m_wearables[UNDERSHIRT].ItemID; } | 310 | get { return m_wearables[(int)AppearanceLayer.UNDERSHIRT].ItemID; } |
207 | set { m_wearables[UNDERSHIRT].ItemID = value; } | 311 | set { m_wearables[(int)AppearanceLayer.UNDERSHIRT].ItemID = value; } |
208 | } | 312 | } |
209 | 313 | ||
210 | public virtual UUID UnderShirtAsset { | 314 | public virtual UUID UnderShirtAsset { |
211 | get { return m_wearables[UNDERSHIRT].AssetID; } | 315 | get { return m_wearables[(int)AppearanceLayer.UNDERSHIRT].AssetID; } |
212 | set { m_wearables[UNDERSHIRT].AssetID = value; } | 316 | set { m_wearables[(int)AppearanceLayer.UNDERSHIRT].AssetID = value; } |
213 | } | 317 | } |
214 | 318 | ||
215 | public virtual UUID UnderPantsItem { | 319 | public virtual UUID UnderPantsItem { |
216 | get { return m_wearables[UNDERPANTS].ItemID; } | 320 | get { return m_wearables[(int)AppearanceLayer.UNDERPANTS].ItemID; } |
217 | set { m_wearables[UNDERPANTS].ItemID = value; } | 321 | set { m_wearables[(int)AppearanceLayer.UNDERPANTS].ItemID = value; } |
218 | } | 322 | } |
219 | 323 | ||
220 | public virtual UUID UnderPantsAsset { | 324 | public virtual UUID UnderPantsAsset { |
221 | get { return m_wearables[UNDERPANTS].AssetID; } | 325 | get { return m_wearables[(int)AppearanceLayer.UNDERPANTS].AssetID; } |
222 | set { m_wearables[UNDERPANTS].AssetID = value; } | 326 | set { m_wearables[(int)AppearanceLayer.UNDERPANTS].AssetID = value; } |
223 | } | 327 | } |
224 | 328 | ||
225 | public virtual UUID SkirtItem { | 329 | public virtual UUID SkirtItem { |
226 | get { return m_wearables[SKIRT].ItemID; } | 330 | get { return m_wearables[(int)AppearanceLayer.SKIRT].ItemID; } |
227 | set { m_wearables[SKIRT].ItemID = value; } | 331 | set { m_wearables[(int)AppearanceLayer.SKIRT].ItemID = value; } |
228 | } | 332 | } |
229 | 333 | ||
230 | public virtual UUID SkirtAsset { | 334 | public virtual UUID SkirtAsset { |
231 | get { return m_wearables[SKIRT].AssetID; } | 335 | get { return m_wearables[(int)AppearanceLayer.SKIRT].AssetID; } |
232 | set { m_wearables[SKIRT].AssetID = value; } | 336 | set { m_wearables[(int)AppearanceLayer.SKIRT].AssetID = value; } |
233 | } | 337 | } |
234 | 338 | ||
235 | public virtual void SetDefaultWearables() | 339 | public virtual void SetDefaultWearables() |
236 | { | 340 | { |
237 | m_wearables[BODY].AssetID = BODY_ASSET; | 341 | m_wearables[(int)AppearanceLayer.BODY].AssetID = BODY_ASSET; |
238 | m_wearables[BODY].ItemID = BODY_ITEM; | 342 | m_wearables[(int)AppearanceLayer.BODY].ItemID = BODY_ITEM; |
239 | m_wearables[SKIN].AssetID = SKIN_ASSET; | 343 | m_wearables[(int)AppearanceLayer.SKIN].AssetID = SKIN_ASSET; |
240 | m_wearables[SKIN].ItemID = SKIN_ITEM; | 344 | m_wearables[(int)AppearanceLayer.SKIN].ItemID = SKIN_ITEM; |
241 | m_wearables[HAIR].AssetID = HAIR_ASSET; | 345 | m_wearables[(int)AppearanceLayer.HAIR].AssetID = HAIR_ASSET; |
242 | m_wearables[HAIR].ItemID = HAIR_ITEM; | 346 | m_wearables[(int)AppearanceLayer.HAIR].ItemID = HAIR_ITEM; |
243 | m_wearables[SHIRT].AssetID = SHIRT_ASSET; | 347 | m_wearables[(int)AppearanceLayer.SHIRT].AssetID = SHIRT_ASSET; |
244 | m_wearables[SHIRT].ItemID = SHIRT_ITEM; | 348 | m_wearables[(int)AppearanceLayer.SHIRT].ItemID = SHIRT_ITEM; |
245 | m_wearables[PANTS].AssetID = PANTS_ASSET; | 349 | m_wearables[(int)AppearanceLayer.PANTS].AssetID = PANTS_ASSET; |
246 | m_wearables[PANTS].ItemID = PANTS_ITEM; | 350 | m_wearables[(int)AppearanceLayer.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; | ||
247 | } | 355 | } |
248 | 356 | ||
249 | public virtual void ClearWearables() | 357 | public virtual void ClearWearables() |
250 | { | 358 | { |
251 | for (int i = 0; i < 13; i++) | 359 | for (int i = 0; i < m_wearables.Length ; i++) |
252 | { | 360 | { |
253 | m_wearables[i].AssetID = UUID.Zero; | 361 | m_wearables[i].AssetID = UUID.Zero; |
254 | m_wearables[i].ItemID = UUID.Zero; | 362 | m_wearables[i].ItemID = UUID.Zero; |
@@ -286,70 +394,12 @@ namespace OpenSim.Framework | |||
286 | get { return m_hipOffset; } | 394 | get { return m_hipOffset; } |
287 | } | 395 | } |
288 | 396 | ||
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 | |||
347 | public AvatarAppearance() : this(UUID.Zero) {} | 397 | public AvatarAppearance() : this(UUID.Zero) {} |
348 | 398 | ||
349 | public AvatarAppearance(UUID owner) | 399 | public AvatarAppearance(UUID owner) |
350 | { | 400 | { |
351 | m_wearables = new AvatarWearable[MAX_WEARABLES]; | 401 | m_wearables = new AvatarWearable[(int)AppearanceLayer.MAX_WEARABLES]; |
352 | for (int i = 0; i < MAX_WEARABLES; i++) | 402 | for (int i = 0; i < (int)AppearanceLayer.MAX_WEARABLES; i++) |
353 | { | 403 | { |
354 | // this makes them all null | 404 | // this makes them all null |
355 | m_wearables[i] = new AvatarWearable(); | 405 | m_wearables[i] = new AvatarWearable(); |
@@ -442,121 +492,6 @@ namespace OpenSim.Framework | |||
442 | return visualParams; | 492 | return visualParams; |
443 | } | 493 | } |
444 | 494 | ||
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 | |||
560 | private Dictionary<int, UUID[]> m_attachments = new Dictionary<int, UUID[]>(); | 495 | private Dictionary<int, UUID[]> m_attachments = new Dictionary<int, UUID[]>(); |
561 | 496 | ||
562 | public void SetAttachments(AttachmentData[] data) | 497 | public void SetAttachments(AttachmentData[] data) |
@@ -1489,4 +1424,4 @@ namespace OpenSim.Framework | |||
1489 | SKIRT_SKIRT_BLUE = 217 | 1424 | SKIRT_SKIRT_BLUE = 217 |
1490 | } | 1425 | } |
1491 | } | 1426 | } |
1492 | } \ No newline at end of file | 1427 | } |