diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 73 |
1 files changed, 51 insertions, 22 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 95e9667..1638541 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -42,6 +42,8 @@ namespace OpenSim.Framework | |||
42 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | // this is viewer capabilities and weared things dependent | ||
46 | // should be only used as initial default value ( V1 viewers ) | ||
45 | public readonly static int VISUALPARAM_COUNT = 218; | 47 | public readonly static int VISUALPARAM_COUNT = 218; |
46 | 48 | ||
47 | public readonly static int TEXTURE_COUNT = 21; | 49 | public readonly static int TEXTURE_COUNT = 21; |
@@ -240,6 +242,21 @@ namespace OpenSim.Framework | |||
240 | // } | 242 | // } |
241 | } | 243 | } |
242 | 244 | ||
245 | /// <summary> | ||
246 | /// Invalidate all of the baked textures in the appearance, useful | ||
247 | /// if you know that none are valid | ||
248 | /// </summary> | ||
249 | public virtual void ResetBakedTextures() | ||
250 | { | ||
251 | SetDefaultTexture(); | ||
252 | |||
253 | //for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
254 | // { | ||
255 | // int idx = BAKE_INDICES[i]; | ||
256 | // m_texture.FaceTextures[idx].TextureID = UUID.Zero; | ||
257 | // } | ||
258 | } | ||
259 | |||
243 | protected virtual void SetDefaultTexture() | 260 | protected virtual void SetDefaultTexture() |
244 | { | 261 | { |
245 | m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); | 262 | m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); |
@@ -304,19 +321,30 @@ namespace OpenSim.Framework | |||
304 | // made. We determine if any of the visual parameters actually | 321 | // made. We determine if any of the visual parameters actually |
305 | // changed to know if the appearance should be saved later | 322 | // changed to know if the appearance should be saved later |
306 | bool changed = false; | 323 | bool changed = false; |
307 | for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++) | 324 | |
325 | int newsize = visualParams.Length; | ||
326 | |||
327 | if (newsize != m_visualparams.Length) | ||
308 | { | 328 | { |
309 | if (visualParams[i] != m_visualparams[i]) | 329 | changed = true; |
330 | m_visualparams = (byte[])visualParams.Clone(); | ||
331 | } | ||
332 | else | ||
333 | { | ||
334 | |||
335 | for (int i = 0; i < newsize; i++) | ||
310 | { | 336 | { |
311 | // DEBUG ON | 337 | if (visualParams[i] != m_visualparams[i]) |
312 | // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", | 338 | { |
313 | // i,m_visualparams[i],visualParams[i]); | 339 | // DEBUG ON |
314 | // DEBUG OFF | 340 | // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", |
315 | m_visualparams[i] = visualParams[i]; | 341 | // i,m_visualparams[i],visualParams[i]); |
316 | changed = true; | 342 | // DEBUG OFF |
343 | m_visualparams[i] = visualParams[i]; | ||
344 | changed = true; | ||
345 | } | ||
317 | } | 346 | } |
318 | } | 347 | } |
319 | |||
320 | // Reset the height if the visual parameters actually changed | 348 | // Reset the height if the visual parameters actually changed |
321 | if (changed) | 349 | if (changed) |
322 | SetHeight(); | 350 | SetHeight(); |
@@ -377,7 +405,8 @@ namespace OpenSim.Framework | |||
377 | } | 405 | } |
378 | 406 | ||
379 | s += "Visual Params: "; | 407 | s += "Visual Params: "; |
380 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) | 408 | // for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) |
409 | for (uint j = 0; j < m_visualparams.Length; j++) | ||
381 | s += String.Format("{0},",m_visualparams[j]); | 410 | s += String.Format("{0},",m_visualparams[j]); |
382 | s += "\n"; | 411 | s += "\n"; |
383 | 412 | ||
@@ -393,19 +422,18 @@ namespace OpenSim.Framework | |||
393 | /// </remarks> | 422 | /// </remarks> |
394 | public List<AvatarAttachment> GetAttachments() | 423 | public List<AvatarAttachment> GetAttachments() |
395 | { | 424 | { |
396 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | 425 | |
397 | 426 | ||
398 | lock (m_attachments) | 427 | lock (m_attachments) |
399 | { | 428 | { |
429 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | ||
400 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | 430 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
401 | { | 431 | { |
402 | foreach (AvatarAttachment attach in kvp.Value) | 432 | foreach (AvatarAttachment attach in kvp.Value) |
403 | alist.Add(new AvatarAttachment(attach)); | 433 | alist.Add(new AvatarAttachment(attach)); |
404 | } | 434 | } |
405 | } | 435 | return alist; |
406 | 436 | } } | |
407 | return alist; | ||
408 | } | ||
409 | 437 | ||
410 | internal void AppendAttachment(AvatarAttachment attach) | 438 | internal void AppendAttachment(AvatarAttachment attach) |
411 | { | 439 | { |
@@ -534,7 +562,6 @@ namespace OpenSim.Framework | |||
534 | return kvp.Key; | 562 | return kvp.Key; |
535 | } | 563 | } |
536 | } | 564 | } |
537 | |||
538 | return 0; | 565 | return 0; |
539 | } | 566 | } |
540 | 567 | ||
@@ -601,12 +628,14 @@ namespace OpenSim.Framework | |||
601 | OSDBinary visualparams = new OSDBinary(m_visualparams); | 628 | OSDBinary visualparams = new OSDBinary(m_visualparams); |
602 | data["visualparams"] = visualparams; | 629 | data["visualparams"] = visualparams; |
603 | 630 | ||
604 | // Attachments | 631 | lock (m_attachments) |
605 | List<AvatarAttachment> attachments = GetAttachments(); | 632 | { |
606 | OSDArray attachs = new OSDArray(attachments.Count); | 633 | // Attachments |
607 | foreach (AvatarAttachment attach in GetAttachments()) | 634 | OSDArray attachs = new OSDArray(m_attachments.Count); |
608 | attachs.Add(attach.Pack()); | 635 | foreach (AvatarAttachment attach in GetAttachments()) |
609 | data["attachments"] = attachs; | 636 | attachs.Add(attach.Pack()); |
637 | data["attachments"] = attachs; | ||
638 | } | ||
610 | 639 | ||
611 | return data; | 640 | return data; |
612 | } | 641 | } |