aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/AvatarAppearance.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/AvatarAppearance.cs')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs76
1 files changed, 43 insertions, 33 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index c0bc47e..a68de57 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -47,7 +47,6 @@ namespace OpenSim.Framework
47 public readonly static int TEXTURE_COUNT = 21; 47 public readonly static int TEXTURE_COUNT = 21;
48 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; 48 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
49 49
50 protected UUID m_owner;
51 protected int m_serial = 0; 50 protected int m_serial = 0;
52 protected byte[] m_visualparams; 51 protected byte[] m_visualparams;
53 protected Primitive.TextureEntry m_texture; 52 protected Primitive.TextureEntry m_texture;
@@ -56,12 +55,6 @@ namespace OpenSim.Framework
56 protected float m_avatarHeight = 0; 55 protected float m_avatarHeight = 0;
57 protected float m_hipOffset = 0; 56 protected float m_hipOffset = 0;
58 57
59 public virtual UUID Owner
60 {
61 get { return m_owner; }
62 set { m_owner = value; }
63 }
64
65 public virtual int Serial 58 public virtual int Serial
66 { 59 {
67 get { return m_serial; } 60 get { return m_serial; }
@@ -77,7 +70,11 @@ namespace OpenSim.Framework
77 public virtual Primitive.TextureEntry Texture 70 public virtual Primitive.TextureEntry Texture
78 { 71 {
79 get { return m_texture; } 72 get { return m_texture; }
80 set { m_texture = value; } 73 set
74 {
75// m_log.DebugFormat("[AVATAR APPEARANCE]: Set TextureEntry to {0}", value);
76 m_texture = value;
77 }
81 } 78 }
82 79
83 public virtual AvatarWearable[] Wearables 80 public virtual AvatarWearable[] Wearables
@@ -97,38 +94,31 @@ namespace OpenSim.Framework
97 get { return m_hipOffset; } 94 get { return m_hipOffset; }
98 } 95 }
99 96
100 public AvatarAppearance() : this(UUID.Zero) {} 97 public AvatarAppearance()
101
102 public AvatarAppearance(UUID owner)
103 { 98 {
104// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner); 99// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance");
105 100
106 m_serial = 0; 101 m_serial = 0;
107 m_owner = owner;
108
109 SetDefaultWearables(); 102 SetDefaultWearables();
110 SetDefaultTexture(); 103 SetDefaultTexture();
111 SetDefaultParams(); 104 SetDefaultParams();
112 SetHeight(); 105 SetHeight();
113
114 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 106 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
115 } 107 }
116 108
117 public AvatarAppearance(UUID avatarID, OSDMap map) 109 public AvatarAppearance(OSDMap map)
118 { 110 {
119// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance for {0} from OSDMap",avatarID); 111// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap");
120 112
121 m_owner = avatarID;
122 Unpack(map); 113 Unpack(map);
123 SetHeight(); 114 SetHeight();
124 } 115 }
125 116
126 public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) 117 public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
127 { 118 {
128// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); 119// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance");
129 120
130 m_serial = 0; 121 m_serial = 0;
131 m_owner = avatarID;
132 122
133 if (wearables != null) 123 if (wearables != null)
134 m_wearables = wearables; 124 m_wearables = wearables;
@@ -161,24 +151,21 @@ namespace OpenSim.Framework
161 if (appearance == null) 151 if (appearance == null)
162 { 152 {
163 m_serial = 0; 153 m_serial = 0;
164 m_owner = UUID.Zero;
165
166 SetDefaultWearables(); 154 SetDefaultWearables();
167 SetDefaultTexture(); 155 SetDefaultTexture();
168 SetDefaultParams(); 156 SetDefaultParams();
169 SetHeight(); 157 SetHeight();
170
171 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 158 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
172 159
173 return; 160 return;
174 } 161 }
175 162
176 m_serial = appearance.Serial; 163 m_serial = appearance.Serial;
177 m_owner = appearance.Owner;
178 164
179 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; 165 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
180 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 166 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
181 m_wearables[i] = new AvatarWearable(); 167 m_wearables[i] = new AvatarWearable();
168
182 if (copyWearables && (appearance.Wearables != null)) 169 if (copyWearables && (appearance.Wearables != null))
183 { 170 {
184 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 171 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
@@ -196,6 +183,9 @@ namespace OpenSim.Framework
196 if (appearance.VisualParams != null) 183 if (appearance.VisualParams != null)
197 m_visualparams = (byte[])appearance.VisualParams.Clone(); 184 m_visualparams = (byte[])appearance.VisualParams.Clone();
198 185
186 m_avatarHeight = appearance.m_avatarHeight;
187 m_hipOffset = appearance.m_hipOffset;
188
199 // Copy the attachment, force append mode since that ensures consistency 189 // Copy the attachment, force append mode since that ensures consistency
200 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 190 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
201 foreach (AvatarAttachment attachment in appearance.GetAttachments()) 191 foreach (AvatarAttachment attachment in appearance.GetAttachments())
@@ -237,7 +227,6 @@ namespace OpenSim.Framework
237 { 227 {
238 m_serial = 0; 228 m_serial = 0;
239 229
240 SetDefaultParams();
241 SetDefaultTexture(); 230 SetDefaultTexture();
242 231
243 //for (int i = 0; i < BAKE_INDICES.Length; i++) 232 //for (int i = 0; i < BAKE_INDICES.Length; i++)
@@ -409,9 +398,11 @@ namespace OpenSim.Framework
409// DEBUG OFF 398// DEBUG OFF
410 399
411 /// <summary> 400 /// <summary>
412 /// Get a list of the attachments, note that there may be 401 /// Get a list of the attachments.
413 /// duplicate attachpoints
414 /// </summary> 402 /// </summary>
403 /// <remarks>
404 /// There may be duplicate attachpoints
405 /// </remarks>
415 public List<AvatarAttachment> GetAttachments() 406 public List<AvatarAttachment> GetAttachments()
416 { 407 {
417 lock (m_attachments) 408 lock (m_attachments)
@@ -447,17 +438,29 @@ namespace OpenSim.Framework
447 } 438 }
448 439
449 /// <summary> 440 /// <summary>
450 /// Add an attachment, if the attachpoint has the 441 /// Add an attachment
442 /// </summary>
443 /// <remarks>
444 /// If the attachpoint has the
451 /// 0x80 bit set then we assume this is an append 445 /// 0x80 bit set then we assume this is an append
452 /// operation otherwise we replace whatever is 446 /// operation otherwise we replace whatever is
453 /// currently attached at the attachpoint 447 /// currently attached at the attachpoint
448 /// </remarks>
449 /// <param name="attachpoint"></param>
450 /// <param name="item">If UUID.Zero, then an any attachment at the attachpoint is removed.</param>
451 /// <param name="asset"></param>
452 /// <returns>
454 /// return true if something actually changed 453 /// return true if something actually changed
455 /// </summary> 454 /// </returns>
456 public bool SetAttachment(int attachpoint, UUID item, UUID asset) 455 public bool SetAttachment(int attachpoint, UUID item, UUID asset)
457 { 456 {
458 if (attachpoint == 0) 457 if (attachpoint == 0)
459 return false; 458 return false;
460 459
460// m_log.DebugFormat(
461// "[AVATAR APPEARANCE]: Setting attachment at {0} with item ID {1}, asset ID {2}",
462// attachpoint, item, asset);
463
461 if (item == UUID.Zero) 464 if (item == UUID.Zero)
462 { 465 {
463 lock (m_attachments) 466 lock (m_attachments)
@@ -487,7 +490,7 @@ namespace OpenSim.Framework
487 } 490 }
488 else 491 else
489 { 492 {
490 ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); 493 ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset));
491 } 494 }
492 return true; 495 return true;
493 } 496 }
@@ -589,7 +592,7 @@ namespace OpenSim.Framework
589 /// </summary> 592 /// </summary>
590 public void Unpack(OSDMap data) 593 public void Unpack(OSDMap data)
591 { 594 {
592 if ((data != null) && (data["serial"] != null)) 595 if ((data != null) && (data["serial"] != null))
593 m_serial = data["serial"].AsInteger(); 596 m_serial = data["serial"].AsInteger();
594 if ((data != null) && (data["height"] != null)) 597 if ((data != null) && (data["height"] != null))
595 m_avatarHeight = (float)data["height"].AsReal(); 598 m_avatarHeight = (float)data["height"].AsReal();
@@ -647,7 +650,14 @@ namespace OpenSim.Framework
647 { 650 {
648 OSDArray attachs = (OSDArray)(data["attachments"]); 651 OSDArray attachs = (OSDArray)(data["attachments"]);
649 for (int i = 0; i < attachs.Count; i++) 652 for (int i = 0; i < attachs.Count; i++)
650 AppendAttachment(new AvatarAttachment((OSDMap)attachs[i])); 653 {
654 AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);
655 AppendAttachment(att);
656
657// m_log.DebugFormat(
658// "[AVATAR APPEARANCE]: Unpacked attachment itemID {0}, assetID {1}, point {2}",
659// att.ItemID, att.AssetID, att.AttachPoint);
660 }
651 } 661 }
652 } 662 }
653 catch (Exception e) 663 catch (Exception e)