aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Interfaces/IAvatarService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Interfaces/IAvatarService.cs')
-rw-r--r--OpenSim/Services/Interfaces/IAvatarService.cs81
1 files changed, 38 insertions, 43 deletions
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs
index b4dc511..ef8d158 100644
--- a/OpenSim/Services/Interfaces/IAvatarService.cs
+++ b/OpenSim/Services/Interfaces/IAvatarService.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
31 32
32using OpenSim.Framework; 33using OpenSim.Framework;
33 34
@@ -150,7 +151,6 @@ namespace OpenSim.Services.Interfaces
150 // Wearables 151 // Wearables
151 Data["AvatarHeight"] = appearance.AvatarHeight.ToString(); 152 Data["AvatarHeight"] = appearance.AvatarHeight.ToString();
152 153
153 // TODO: With COF, is this even needed?
154 for (int i = 0 ; i < AvatarWearable.LEGACY_VERSION_MAX_WEARABLES ; i++) 154 for (int i = 0 ; i < AvatarWearable.LEGACY_VERSION_MAX_WEARABLES ; i++)
155 { 155 {
156 for (int j = 0 ; j < appearance.Wearables[i].Count ; j++) 156 for (int j = 0 ; j < appearance.Wearables[i].Count ; j++)
@@ -162,21 +162,18 @@ namespace OpenSim.Services.Interfaces
162 } 162 }
163 } 163 }
164 164
165 // Visual Params
166 //string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT];
167 //byte[] binary = appearance.VisualParams;
168
169 // for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++)
170
171 byte[] binary = appearance.VisualParams; 165 byte[] binary = appearance.VisualParams;
172 string[] vps = new string[binary.Length]; 166 int len = binary.Length;
167 int last = len - 1;
173 168
174 for (int i = 0; i < binary.Length; i++) 169 StringBuilder sb = new StringBuilder(5 * len);
170 for (int i = 0; i < len; i++)
175 { 171 {
176 vps[i] = binary[i].ToString(); 172 sb.Append(binary[i].ToString());
173 if (i < last)
174 sb.Append(",");
177 } 175 }
178 176 Data["VisualParams"] = sb.ToString();
179 Data["VisualParams"] = String.Join(",", vps);
180 177
181 // Attachments 178 // Attachments
182 List<AvatarAttachment> attachments = appearance.GetAttachments(); 179 List<AvatarAttachment> attachments = appearance.GetAttachments();
@@ -213,7 +210,6 @@ namespace OpenSim.Services.Interfaces
213 if( h == 0f) 210 if( h == 0f)
214 h = 1.9f; 211 h = 1.9f;
215 appearance.SetSize(new Vector3(0.45f, 0.6f, h )); 212 appearance.SetSize(new Vector3(0.45f, 0.6f, h ));
216// appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]);
217 } 213 }
218 214
219 // Legacy Wearables 215 // Legacy Wearables
@@ -285,9 +281,6 @@ namespace OpenSim.Services.Interfaces
285 if (Data.ContainsKey("VisualParams")) 281 if (Data.ContainsKey("VisualParams"))
286 { 282 {
287 string[] vps = Data["VisualParams"].Split(new char[] {','}); 283 string[] vps = Data["VisualParams"].Split(new char[] {','});
288 //byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT];
289
290 //for (int i = 0 ; i < vps.Length && i < binary.Length ; i++)
291 byte[] binary = new byte[vps.Length]; 284 byte[] binary = new byte[vps.Length];
292 285
293 for (int i = 0; i < vps.Length; i++) 286 for (int i = 0; i < vps.Length; i++)
@@ -296,10 +289,12 @@ namespace OpenSim.Services.Interfaces
296 appearance.VisualParams = binary; 289 appearance.VisualParams = binary;
297 } 290 }
298 291
299 // New style wearables 292 AvatarWearable[] wearables = appearance.Wearables;
293 int currentLength = wearables.Length;
300 foreach (KeyValuePair<string, string> _kvp in Data) 294 foreach (KeyValuePair<string, string> _kvp in Data)
301 { 295 {
302 if (_kvp.Key.StartsWith("Wearable ")) 296 // New style wearables
297 if (_kvp.Key.StartsWith("Wearable ") && _kvp.Key.Length > 9)
303 { 298 {
304 string wearIndex = _kvp.Key.Substring(9); 299 string wearIndex = _kvp.Key.Substring(9);
305 string[] wearIndices = wearIndex.Split(new char[] {':'}); 300 string[] wearIndices = wearIndex.Split(new char[] {':'});
@@ -308,33 +303,33 @@ namespace OpenSim.Services.Interfaces
308 string[] ids = _kvp.Value.Split(new char[] {':'}); 303 string[] ids = _kvp.Value.Split(new char[] {':'});
309 UUID itemID = new UUID(ids[0]); 304 UUID itemID = new UUID(ids[0]);
310 UUID assetID = new UUID(ids[1]); 305 UUID assetID = new UUID(ids[1]);
311 306 if (index >= currentLength)
312 appearance.Wearables[index].Add(itemID, assetID); 307 {
313 } 308 Array.Resize(ref wearables, index + 1);
314 } 309 for (int i = currentLength ; i < wearables.Length ; i++)
315 310 wearables[i] = new AvatarWearable();
316 // Attachments 311 currentLength = wearables.Length;
317 Dictionary<string, string> attchs = new Dictionary<string, string>(); 312 }
318 foreach (KeyValuePair<string, string> _kvp in Data) 313 wearables[index].Add(itemID, assetID);
319 if (_kvp.Key.StartsWith("_ap_"))
320 attchs[_kvp.Key] = _kvp.Value;
321
322 foreach (KeyValuePair<string, string> _kvp in attchs)
323 {
324 string pointStr = _kvp.Key.Substring(4);
325 int point = 0;
326 if (!Int32.TryParse(pointStr, out point))
327 continue; 314 continue;
328 315 }
329 List<string> idList = new List<string>(_kvp.Value.Split(new char[] {','})); 316 // Attachments
330 317 if (_kvp.Key.StartsWith("_ap_") && _kvp.Key.Length > 4)
331 appearance.SetAttachment(point, UUID.Zero, UUID.Zero);
332 foreach (string id in idList)
333 { 318 {
334 UUID uuid = UUID.Zero; 319 string pointStr = _kvp.Key.Substring(4);
335 UUID.TryParse(id, out uuid); 320 int point = 0;
336 321 if (Int32.TryParse(pointStr, out point))
337 appearance.SetAttachment(point | 0x80, uuid, UUID.Zero); 322 {
323 List<string> idList = new List<string>(_kvp.Value.Split(new char[] {','}));
324
325 appearance.SetAttachment(point, UUID.Zero, UUID.Zero);
326 foreach (string id in idList)
327 {
328 UUID uuid = UUID.Zero;
329 if(UUID.TryParse(id, out uuid))
330 appearance.SetAttachment(point | 0x80, uuid, UUID.Zero);
331 }
332 }
338 } 333 }
339 } 334 }
340 335