diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Framework/AvatarAppearance.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Framework/AvatarAppearance.cs')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 335 |
1 files changed, 267 insertions, 68 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 95e9667..26dd5df 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -40,8 +40,17 @@ namespace OpenSim.Framework | |||
40 | /// </summary> | 40 | /// </summary> |
41 | public class AvatarAppearance | 41 | public class AvatarAppearance |
42 | { | 42 | { |
43 | // SL box diferent to size | ||
44 | const float AVBOXAJUST = 0.2f; | ||
45 | // constrains for ubitode physics | ||
46 | const float AVBOXMINX = 0.2f; | ||
47 | const float AVBOXMINY = 0.3f; | ||
48 | const float AVBOXMINZ = 1.2f; | ||
49 | |||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 51 | ||
52 | // this is viewer capabilities and weared things dependent | ||
53 | // should be only used as initial default value ( V1 viewers ) | ||
45 | public readonly static int VISUALPARAM_COUNT = 218; | 54 | public readonly static int VISUALPARAM_COUNT = 218; |
46 | 55 | ||
47 | public readonly static int TEXTURE_COUNT = 21; | 56 | public readonly static int TEXTURE_COUNT = 21; |
@@ -53,7 +62,15 @@ namespace OpenSim.Framework | |||
53 | protected AvatarWearable[] m_wearables; | 62 | protected AvatarWearable[] m_wearables; |
54 | protected Dictionary<int, List<AvatarAttachment>> m_attachments; | 63 | protected Dictionary<int, List<AvatarAttachment>> m_attachments; |
55 | protected float m_avatarHeight = 0; | 64 | protected float m_avatarHeight = 0; |
65 | protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); // sl Z cloud value | ||
66 | protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f); | ||
67 | protected float m_avatarFeetOffset = 0; | ||
68 | protected float m_avatarAnimOffset = 0; | ||
69 | protected WearableCacheItem[] m_cacheitems; | ||
70 | protected bool m_cacheItemsDirty = true; | ||
71 | |||
56 | 72 | ||
73 | public bool PackLegacyWearables {get; set; } | ||
57 | public virtual int Serial | 74 | public virtual int Serial |
58 | { | 75 | { |
59 | get { return m_serial; } | 76 | get { return m_serial; } |
@@ -66,6 +83,21 @@ namespace OpenSim.Framework | |||
66 | set { m_visualparams = value; } | 83 | set { m_visualparams = value; } |
67 | } | 84 | } |
68 | 85 | ||
86 | public virtual Vector3 AvatarSize | ||
87 | { | ||
88 | get { return m_avatarSize; } | ||
89 | } | ||
90 | |||
91 | public virtual Vector3 AvatarBoxSize | ||
92 | { | ||
93 | get { return m_avatarBoxSize; } | ||
94 | } | ||
95 | |||
96 | public virtual float AvatarFeetOffset | ||
97 | { | ||
98 | get { return m_avatarFeetOffset + m_avatarAnimOffset; } | ||
99 | } | ||
100 | |||
69 | public virtual Primitive.TextureEntry Texture | 101 | public virtual Primitive.TextureEntry Texture |
70 | { | 102 | { |
71 | get { return m_texture; } | 103 | get { return m_texture; } |
@@ -87,16 +119,29 @@ namespace OpenSim.Framework | |||
87 | get { return m_avatarHeight; } | 119 | get { return m_avatarHeight; } |
88 | set { m_avatarHeight = value; } | 120 | set { m_avatarHeight = value; } |
89 | } | 121 | } |
122 | |||
123 | public virtual WearableCacheItem[] WearableCacheItems | ||
124 | { | ||
125 | get { return m_cacheitems; } | ||
126 | set { m_cacheitems = value; } | ||
127 | } | ||
128 | |||
129 | public virtual bool WearableCacheItemsDirty | ||
130 | { | ||
131 | get { return m_cacheItemsDirty; } | ||
132 | set { m_cacheItemsDirty = value; } | ||
133 | } | ||
90 | 134 | ||
91 | public AvatarAppearance() | 135 | public AvatarAppearance() |
92 | { | 136 | { |
93 | // m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); | 137 | // m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); |
94 | 138 | PackLegacyWearables = false; | |
95 | m_serial = 0; | 139 | m_serial = 0; |
96 | SetDefaultWearables(); | 140 | SetDefaultWearables(); |
97 | SetDefaultTexture(); | 141 | SetDefaultTexture(); |
98 | SetDefaultParams(); | 142 | SetDefaultParams(); |
99 | SetHeight(); | 143 | // SetHeight(); |
144 | SetSize(new Vector3(0.45f,0.6f,1.9f)); | ||
100 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 145 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
101 | } | 146 | } |
102 | 147 | ||
@@ -105,7 +150,7 @@ namespace OpenSim.Framework | |||
105 | // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); | 150 | // m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); |
106 | 151 | ||
107 | Unpack(map); | 152 | Unpack(map); |
108 | SetHeight(); | 153 | // SetHeight(); done in Unpack |
109 | } | 154 | } |
110 | 155 | ||
111 | public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) | 156 | public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) |
@@ -129,7 +174,9 @@ namespace OpenSim.Framework | |||
129 | else | 174 | else |
130 | SetDefaultParams(); | 175 | SetDefaultParams(); |
131 | 176 | ||
132 | SetHeight(); | 177 | // SetHeight(); |
178 | if(m_avatarHeight == 0) | ||
179 | SetSize(new Vector3(0.45f,0.6f,1.9f)); | ||
133 | 180 | ||
134 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 181 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
135 | } | 182 | } |
@@ -148,7 +195,8 @@ namespace OpenSim.Framework | |||
148 | SetDefaultWearables(); | 195 | SetDefaultWearables(); |
149 | SetDefaultTexture(); | 196 | SetDefaultTexture(); |
150 | SetDefaultParams(); | 197 | SetDefaultParams(); |
151 | SetHeight(); | 198 | // SetHeight(); |
199 | SetSize(new Vector3(0.45f, 0.6f, 1.9f)); | ||
152 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 200 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
153 | 201 | ||
154 | return; | 202 | return; |
@@ -162,7 +210,10 @@ namespace OpenSim.Framework | |||
162 | 210 | ||
163 | if (copyWearables && (appearance.Wearables != null)) | 211 | if (copyWearables && (appearance.Wearables != null)) |
164 | { | 212 | { |
165 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 213 | int len = appearance.Wearables.Length; |
214 | if(len > AvatarWearable.MAX_WEARABLES) | ||
215 | len = AvatarWearable.MAX_WEARABLES; | ||
216 | for (int i = 0; i < len; i++) | ||
166 | SetWearable(i,appearance.Wearables[i]); | 217 | SetWearable(i,appearance.Wearables[i]); |
167 | } | 218 | } |
168 | 219 | ||
@@ -177,7 +228,8 @@ namespace OpenSim.Framework | |||
177 | if (appearance.VisualParams != null) | 228 | if (appearance.VisualParams != null) |
178 | m_visualparams = (byte[])appearance.VisualParams.Clone(); | 229 | m_visualparams = (byte[])appearance.VisualParams.Clone(); |
179 | 230 | ||
180 | m_avatarHeight = appearance.m_avatarHeight; | 231 | // m_avatarHeight = appearance.m_avatarHeight; |
232 | SetSize(appearance.AvatarSize); | ||
181 | 233 | ||
182 | // Copy the attachment, force append mode since that ensures consistency | 234 | // Copy the attachment, force append mode since that ensures consistency |
183 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); | 235 | m_attachments = new Dictionary<int, List<AvatarAttachment>>(); |
@@ -240,6 +292,21 @@ namespace OpenSim.Framework | |||
240 | // } | 292 | // } |
241 | } | 293 | } |
242 | 294 | ||
295 | /// <summary> | ||
296 | /// Invalidate all of the baked textures in the appearance, useful | ||
297 | /// if you know that none are valid | ||
298 | /// </summary> | ||
299 | public virtual void ResetBakedTextures() | ||
300 | { | ||
301 | SetDefaultTexture(); | ||
302 | |||
303 | //for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
304 | // { | ||
305 | // int idx = BAKE_INDICES[i]; | ||
306 | // m_texture.FaceTextures[idx].TextureID = UUID.Zero; | ||
307 | // } | ||
308 | } | ||
309 | |||
243 | protected virtual void SetDefaultTexture() | 310 | protected virtual void SetDefaultTexture() |
244 | { | 311 | { |
245 | m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); | 312 | m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); |
@@ -304,22 +371,33 @@ namespace OpenSim.Framework | |||
304 | // made. We determine if any of the visual parameters actually | 371 | // made. We determine if any of the visual parameters actually |
305 | // changed to know if the appearance should be saved later | 372 | // changed to know if the appearance should be saved later |
306 | bool changed = false; | 373 | bool changed = false; |
307 | for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++) | 374 | |
375 | int newsize = visualParams.Length; | ||
376 | |||
377 | if (newsize != m_visualparams.Length) | ||
308 | { | 378 | { |
309 | if (visualParams[i] != m_visualparams[i]) | 379 | changed = true; |
380 | m_visualparams = (byte[])visualParams.Clone(); | ||
381 | } | ||
382 | else | ||
383 | { | ||
384 | |||
385 | for (int i = 0; i < newsize; i++) | ||
310 | { | 386 | { |
311 | // DEBUG ON | 387 | if (visualParams[i] != m_visualparams[i]) |
312 | // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", | 388 | { |
313 | // i,m_visualparams[i],visualParams[i]); | 389 | // DEBUG ON |
314 | // DEBUG OFF | 390 | // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", |
315 | m_visualparams[i] = visualParams[i]; | 391 | // i,m_visualparams[i],visualParams[i]); |
316 | changed = true; | 392 | // DEBUG OFF |
393 | m_visualparams[i] = visualParams[i]; | ||
394 | changed = true; | ||
395 | } | ||
317 | } | 396 | } |
318 | } | 397 | } |
319 | |||
320 | // Reset the height if the visual parameters actually changed | 398 | // Reset the height if the visual parameters actually changed |
321 | if (changed) | 399 | // if (changed) |
322 | SetHeight(); | 400 | // SetHeight(); |
323 | 401 | ||
324 | return changed; | 402 | return changed; |
325 | } | 403 | } |
@@ -335,6 +413,7 @@ namespace OpenSim.Framework | |||
335 | /// </summary> | 413 | /// </summary> |
336 | public virtual void SetHeight() | 414 | public virtual void SetHeight() |
337 | { | 415 | { |
416 | /* | ||
338 | // Start with shortest possible female avatar height | 417 | // Start with shortest possible female avatar height |
339 | m_avatarHeight = 1.14597f; | 418 | m_avatarHeight = 1.14597f; |
340 | // Add offset for male avatars | 419 | // Add offset for male avatars |
@@ -347,6 +426,35 @@ namespace OpenSim.Framework | |||
347 | + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f | 426 | + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f |
348 | + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f | 427 | + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f |
349 | + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; | 428 | + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; |
429 | */ | ||
430 | } | ||
431 | |||
432 | public void SetSize(Vector3 avSize) | ||
433 | { | ||
434 | if (avSize.X > 32f) | ||
435 | avSize.X = 32f; | ||
436 | else if (avSize.X < 0.1f) | ||
437 | avSize.X = 0.1f; | ||
438 | |||
439 | if (avSize.Y > 32f) | ||
440 | avSize.Y = 32f; | ||
441 | else if (avSize.Y < 0.1f) | ||
442 | avSize.Y = 0.1f; | ||
443 | if (avSize.Z > 32f) | ||
444 | avSize.Z = 32f; | ||
445 | else if (avSize.Z < 0.1f) | ||
446 | avSize.Z = 0.1f; | ||
447 | |||
448 | m_avatarSize = avSize; | ||
449 | m_avatarBoxSize = avSize; | ||
450 | m_avatarBoxSize.Z += AVBOXAJUST; | ||
451 | if (m_avatarBoxSize.X < AVBOXMINX) | ||
452 | m_avatarBoxSize.X = AVBOXMINX; | ||
453 | if (m_avatarBoxSize.Y < AVBOXMINY) | ||
454 | m_avatarBoxSize.Y = AVBOXMINY; | ||
455 | if (m_avatarBoxSize.Z < AVBOXMINZ) | ||
456 | m_avatarBoxSize.Z = AVBOXMINZ; | ||
457 | m_avatarHeight = m_avatarSize.Z; | ||
350 | } | 458 | } |
351 | 459 | ||
352 | public virtual void SetWearable(int wearableId, AvatarWearable wearable) | 460 | public virtual void SetWearable(int wearableId, AvatarWearable wearable) |
@@ -355,8 +463,11 @@ namespace OpenSim.Framework | |||
355 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); | 463 | // m_log.WarnFormat("[AVATARAPPEARANCE] set wearable {0} --> {1}:{2}",wearableId,wearable.ItemID,wearable.AssetID); |
356 | // DEBUG OFF | 464 | // DEBUG OFF |
357 | m_wearables[wearableId].Clear(); | 465 | m_wearables[wearableId].Clear(); |
358 | for (int i = 0; i < wearable.Count; i++) | 466 | int count = wearable.Count; |
359 | m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); | 467 | if (count > AvatarWearable.MAX_WEARABLES) |
468 | count = AvatarWearable.MAX_WEARABLES; | ||
469 | for (int i = 0; i < count; i++) | ||
470 | m_wearables[wearableId].Add(wearable[i].ItemID, wearable[i].AssetID); | ||
360 | } | 471 | } |
361 | 472 | ||
362 | // DEBUG ON | 473 | // DEBUG ON |
@@ -377,7 +488,8 @@ namespace OpenSim.Framework | |||
377 | } | 488 | } |
378 | 489 | ||
379 | s += "Visual Params: "; | 490 | s += "Visual Params: "; |
380 | for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) | 491 | // for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) |
492 | for (uint j = 0; j < m_visualparams.Length; j++) | ||
381 | s += String.Format("{0},",m_visualparams[j]); | 493 | s += String.Format("{0},",m_visualparams[j]); |
382 | s += "\n"; | 494 | s += "\n"; |
383 | 495 | ||
@@ -393,18 +505,16 @@ namespace OpenSim.Framework | |||
393 | /// </remarks> | 505 | /// </remarks> |
394 | public List<AvatarAttachment> GetAttachments() | 506 | public List<AvatarAttachment> GetAttachments() |
395 | { | 507 | { |
396 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | ||
397 | |||
398 | lock (m_attachments) | 508 | lock (m_attachments) |
399 | { | 509 | { |
510 | List<AvatarAttachment> alist = new List<AvatarAttachment>(); | ||
400 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) | 511 | foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) |
401 | { | 512 | { |
402 | foreach (AvatarAttachment attach in kvp.Value) | 513 | foreach (AvatarAttachment attach in kvp.Value) |
403 | alist.Add(new AvatarAttachment(attach)); | 514 | alist.Add(new AvatarAttachment(attach)); |
404 | } | 515 | } |
405 | } | 516 | return alist; |
406 | 517 | } | |
407 | return alist; | ||
408 | } | 518 | } |
409 | 519 | ||
410 | internal void AppendAttachment(AvatarAttachment attach) | 520 | internal void AppendAttachment(AvatarAttachment attach) |
@@ -418,6 +528,12 @@ namespace OpenSim.Framework | |||
418 | if (!m_attachments.ContainsKey(attach.AttachPoint)) | 528 | if (!m_attachments.ContainsKey(attach.AttachPoint)) |
419 | m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); | 529 | m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); |
420 | 530 | ||
531 | foreach (AvatarAttachment prev in m_attachments[attach.AttachPoint]) | ||
532 | { | ||
533 | if (prev.ItemID == attach.ItemID) | ||
534 | return; | ||
535 | } | ||
536 | |||
421 | m_attachments[attach.AttachPoint].Add(attach); | 537 | m_attachments[attach.AttachPoint].Add(attach); |
422 | } | 538 | } |
423 | } | 539 | } |
@@ -459,45 +575,59 @@ namespace OpenSim.Framework | |||
459 | if (attachpoint == 0) | 575 | if (attachpoint == 0) |
460 | return false; | 576 | return false; |
461 | 577 | ||
462 | if (item == UUID.Zero) | 578 | lock (m_attachments) |
463 | { | 579 | { |
464 | lock (m_attachments) | 580 | if (item == UUID.Zero) |
465 | { | 581 | { |
466 | if (m_attachments.ContainsKey(attachpoint)) | 582 | if (m_attachments.ContainsKey(attachpoint)) |
467 | { | 583 | { |
468 | m_attachments.Remove(attachpoint); | 584 | m_attachments.Remove(attachpoint); |
469 | return true; | 585 | return true; |
470 | } | 586 | } |
587 | |||
588 | return false; | ||
471 | } | 589 | } |
472 | |||
473 | return false; | ||
474 | } | ||
475 | 590 | ||
476 | // When a user logs in, the attachment item ids are pulled from persistence in the Avatars table. However, | 591 | // When a user logs in, the attachment item ids are pulled from persistence in the Avatars table. However, |
477 | // the asset ids are not saved. When the avatar enters a simulator the attachments are set again. If | 592 | // the asset ids are not saved. When the avatar enters a simulator the attachments are set again. If |
478 | // we simply perform an item check here then the asset ids (which are now present) are never set, and NPC attachments | 593 | // we simply perform an item check here then the asset ids (which are now present) are never set, and NPC attachments |
479 | // later fail unless the attachment is detached and reattached. | 594 | // later fail unless the attachment is detached and reattached. |
480 | // | 595 | // |
481 | // Therefore, we will carry on with the set if the existing attachment has no asset id. | 596 | // Therefore, we will carry on with the set if the existing attachment has no asset id. |
482 | AvatarAttachment existingAttachment = GetAttachmentForItem(item); | 597 | AvatarAttachment existingAttachment = GetAttachmentForItem(item); |
483 | if (existingAttachment != null | 598 | if (existingAttachment != null) |
484 | && existingAttachment.AssetID != UUID.Zero | 599 | { |
485 | && existingAttachment.AttachPoint == (attachpoint & 0x7F)) | 600 | // m_log.DebugFormat( |
486 | { | 601 | // "[AVATAR APPEARANCE]: Found existing attachment for {0}, asset {1} at point {2}", |
487 | // m_log.DebugFormat("[AVATAR APPEARANCE] attempt to attach an already attached item {0}",item); | 602 | // existingAttachment.ItemID, existingAttachment.AssetID, existingAttachment.AttachPoint); |
488 | return false; | 603 | |
489 | } | 604 | if (existingAttachment.AssetID != UUID.Zero && existingAttachment.AttachPoint == (attachpoint & 0x7F)) |
490 | 605 | { | |
491 | // check if this is an append or a replace, 0x80 marks it as an append | 606 | m_log.DebugFormat( |
492 | if ((attachpoint & 0x80) > 0) | 607 | "[AVATAR APPEARANCE]: Ignoring attempt to attach an already attached item {0} at point {1}", |
493 | { | 608 | item, attachpoint); |
494 | // strip the append bit | 609 | |
495 | int point = attachpoint & 0x7F; | 610 | return false; |
496 | AppendAttachment(new AvatarAttachment(point, item, asset)); | 611 | } |
497 | } | 612 | else |
498 | else | 613 | { |
499 | { | 614 | // Remove it here so that the later append does not add a second attachment but we still update |
500 | ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset)); | 615 | // the assetID |
616 | DetachAttachment(existingAttachment.ItemID); | ||
617 | } | ||
618 | } | ||
619 | |||
620 | // check if this is an append or a replace, 0x80 marks it as an append | ||
621 | if ((attachpoint & 0x80) > 0) | ||
622 | { | ||
623 | // strip the append bit | ||
624 | int point = attachpoint & 0x7F; | ||
625 | AppendAttachment(new AvatarAttachment(point, item, asset)); | ||
626 | } | ||
627 | else | ||
628 | { | ||
629 | ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset)); | ||
630 | } | ||
501 | } | 631 | } |
502 | 632 | ||
503 | return true; | 633 | return true; |
@@ -534,7 +664,6 @@ namespace OpenSim.Framework | |||
534 | return kvp.Key; | 664 | return kvp.Key; |
535 | } | 665 | } |
536 | } | 666 | } |
537 | |||
538 | return 0; | 667 | return 0; |
539 | } | 668 | } |
540 | 669 | ||
@@ -547,6 +676,10 @@ namespace OpenSim.Framework | |||
547 | int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); | 676 | int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); |
548 | if (index >= 0) | 677 | if (index >= 0) |
549 | { | 678 | { |
679 | // m_log.DebugFormat( | ||
680 | // "[AVATAR APPEARANCE]: Detaching attachment {0}, index {1}, point {2}", | ||
681 | // m_attachments[kvp.Key][index].ItemID, index, m_attachments[kvp.Key][index].AttachPoint); | ||
682 | |||
550 | // Remove it from the list of attachments at that attach point | 683 | // Remove it from the list of attachments at that attach point |
551 | m_attachments[kvp.Key].RemoveAt(index); | 684 | m_attachments[kvp.Key].RemoveAt(index); |
552 | 685 | ||
@@ -581,8 +714,15 @@ namespace OpenSim.Framework | |||
581 | data["height"] = OSD.FromReal(m_avatarHeight); | 714 | data["height"] = OSD.FromReal(m_avatarHeight); |
582 | 715 | ||
583 | // Wearables | 716 | // Wearables |
584 | OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); | 717 | |
585 | for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) | 718 | int wearsCount; |
719 | if(PackLegacyWearables) | ||
720 | wearsCount = AvatarWearable.LEGACY_VERSION_MAX_WEARABLES; | ||
721 | else | ||
722 | wearsCount = AvatarWearable.MAX_WEARABLES; | ||
723 | |||
724 | OSDArray wears = new OSDArray(wearsCount); | ||
725 | for (int i = 0; i < wearsCount; i++) | ||
586 | wears.Add(m_wearables[i].Pack()); | 726 | wears.Add(m_wearables[i].Pack()); |
587 | data["wearables"] = wears; | 727 | data["wearables"] = wears; |
588 | 728 | ||
@@ -601,12 +741,14 @@ namespace OpenSim.Framework | |||
601 | OSDBinary visualparams = new OSDBinary(m_visualparams); | 741 | OSDBinary visualparams = new OSDBinary(m_visualparams); |
602 | data["visualparams"] = visualparams; | 742 | data["visualparams"] = visualparams; |
603 | 743 | ||
604 | // Attachments | 744 | lock (m_attachments) |
605 | List<AvatarAttachment> attachments = GetAttachments(); | 745 | { |
606 | OSDArray attachs = new OSDArray(attachments.Count); | 746 | // Attachments |
607 | foreach (AvatarAttachment attach in GetAttachments()) | 747 | OSDArray attachs = new OSDArray(m_attachments.Count); |
608 | attachs.Add(attach.Pack()); | 748 | foreach (AvatarAttachment attach in GetAttachments()) |
609 | data["attachments"] = attachs; | 749 | attachs.Add(attach.Pack()); |
750 | data["attachments"] = attachs; | ||
751 | } | ||
610 | 752 | ||
611 | return data; | 753 | return data; |
612 | } | 754 | } |
@@ -620,7 +762,8 @@ namespace OpenSim.Framework | |||
620 | if ((data != null) && (data["serial"] != null)) | 762 | if ((data != null) && (data["serial"] != null)) |
621 | m_serial = data["serial"].AsInteger(); | 763 | m_serial = data["serial"].AsInteger(); |
622 | if ((data != null) && (data["height"] != null)) | 764 | if ((data != null) && (data["height"] != null)) |
623 | m_avatarHeight = (float)data["height"].AsReal(); | 765 | // m_avatarHeight = (float)data["height"].AsReal(); |
766 | SetSize(new Vector3(0.45f,0.6f, (float)data["height"].AsReal())); | ||
624 | 767 | ||
625 | try | 768 | try |
626 | { | 769 | { |
@@ -629,7 +772,12 @@ namespace OpenSim.Framework | |||
629 | if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) | 772 | if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) |
630 | { | 773 | { |
631 | OSDArray wears = (OSDArray)(data["wearables"]); | 774 | OSDArray wears = (OSDArray)(data["wearables"]); |
632 | for (int i = 0; i < wears.Count; i++) | 775 | |
776 | int count = wears.Count; | ||
777 | if (count > AvatarWearable.MAX_WEARABLES) | ||
778 | count = AvatarWearable.MAX_WEARABLES; | ||
779 | |||
780 | for (int i = 0; i < count; i++) | ||
633 | m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); | 781 | m_wearables[i] = new AvatarWearable((OSDArray)wears[i]); |
634 | } | 782 | } |
635 | else | 783 | else |
@@ -1453,7 +1601,58 @@ namespace OpenSim.Framework | |||
1453 | SHAPE_EYELID_INNER_CORNER_UP = 214, | 1601 | SHAPE_EYELID_INNER_CORNER_UP = 214, |
1454 | SKIRT_SKIRT_RED = 215, | 1602 | SKIRT_SKIRT_RED = 215, |
1455 | SKIRT_SKIRT_GREEN = 216, | 1603 | SKIRT_SKIRT_GREEN = 216, |
1456 | SKIRT_SKIRT_BLUE = 217 | 1604 | SKIRT_SKIRT_BLUE = 217, |
1605 | |||
1606 | /// <summary> | ||
1607 | /// Avatar Physics section. These are 0 type visual params which get transmitted. | ||
1608 | /// </summary> | ||
1609 | |||
1610 | /// <summary> | ||
1611 | /// Breast Part 1 | ||
1612 | /// </summary> | ||
1613 | BREAST_PHYSICS_MASS = 218, | ||
1614 | BREAST_PHYSICS_GRAVITY = 219, | ||
1615 | BREAST_PHYSICS_DRAG = 220, | ||
1616 | BREAST_PHYSICS_UPDOWN_MAX_EFFECT = 221, | ||
1617 | BREAST_PHYSICS_UPDOWN_SPRING = 222, | ||
1618 | BREAST_PHYSICS_UPDOWN_GAIN = 223, | ||
1619 | BREAST_PHYSICS_UPDOWN_DAMPING = 224, | ||
1620 | BREAST_PHYSICS_INOUT_MAX_EFFECT = 225, | ||
1621 | BREAST_PHYSICS_INOUT_SPRING = 226, | ||
1622 | BREAST_PHYSICS_INOUT_GAIN = 227, | ||
1623 | BREAST_PHYSICS_INOUT_DAMPING = 228, | ||
1624 | /// <summary> | ||
1625 | /// Belly | ||
1626 | /// </summary> | ||
1627 | BELLY_PHYISCS_MASS = 229, | ||
1628 | BELLY_PHYSICS_GRAVITY = 230, | ||
1629 | BELLY_PHYSICS_DRAG = 231, | ||
1630 | BELLY_PHYISCS_UPDOWN_MAX_EFFECT = 232, | ||
1631 | BELLY_PHYSICS_UPDOWN_SPRING = 233, | ||
1632 | BELLY_PHYSICS_UPDOWN_GAIN = 234, | ||
1633 | BELLY_PHYSICS_UPDOWN_DAMPING = 235, | ||
1634 | |||
1635 | /// <summary> | ||
1636 | /// Butt | ||
1637 | /// </summary> | ||
1638 | BUTT_PHYSICS_MASS = 236, | ||
1639 | BUTT_PHYSICS_GRAVITY = 237, | ||
1640 | BUTT_PHYSICS_DRAG = 238, | ||
1641 | BUTT_PHYSICS_UPDOWN_MAX_EFFECT = 239, | ||
1642 | BUTT_PHYSICS_UPDOWN_SPRING = 240, | ||
1643 | BUTT_PHYSICS_UPDOWN_GAIN = 241, | ||
1644 | BUTT_PHYSICS_UPDOWN_DAMPING = 242, | ||
1645 | BUTT_PHYSICS_LEFTRIGHT_MAX_EFFECT = 243, | ||
1646 | BUTT_PHYSICS_LEFTRIGHT_SPRING = 244, | ||
1647 | BUTT_PHYSICS_LEFTRIGHT_GAIN = 245, | ||
1648 | BUTT_PHYSICS_LEFTRIGHT_DAMPING = 246, | ||
1649 | /// <summary> | ||
1650 | /// Breast Part 2 | ||
1651 | /// </summary> | ||
1652 | BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247, | ||
1653 | BREAST_PHYSICS_LEFTRIGHT_SPRING= 248, | ||
1654 | BREAST_PHYSICS_LEFTRIGHT_GAIN = 249, | ||
1655 | BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250 | ||
1457 | } | 1656 | } |
1458 | #endregion | 1657 | #endregion |
1459 | } | 1658 | } |