aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs556
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs191
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs8
6 files changed, 673 insertions, 100 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index aea768e..09cc998 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -145,33 +145,37 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
145 /// <param name="sp"></param> 145 /// <param name="sp"></param>
146 /// <param name="texture"></param> 146 /// <param name="texture"></param>
147 /// <param name="visualParam"></param> 147 /// <param name="visualParam"></param>
148 public void SetAppearance(IScenePresence sp, AvatarAppearance appearance) 148 public void SetAppearance(IScenePresence sp, AvatarAppearance appearance, WearableCacheItem[] cacheItems)
149 { 149 {
150 DoSetAppearance(sp, appearance.Texture, appearance.VisualParams, new List<CachedTextureRequestArg>()); 150 SetAppearance(sp, appearance.Texture, appearance.VisualParams, cacheItems);
151 } 151 }
152 152
153 /// <summary> 153
154 /// Set appearance data (texture asset IDs and slider settings) 154 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
155 /// </summary>
156 /// <param name="sp"></param>
157 /// <param name="texture"></param>
158 /// <param name="visualParam"></param>
159 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams)
160 { 155 {
161 DoSetAppearance(sp, textureEntry, visualParams, new List<CachedTextureRequestArg>()); 156 float oldoff = sp.Appearance.AvatarFeetOffset;
157 Vector3 oldbox = sp.Appearance.AvatarBoxSize;
158
159 SetAppearance(sp, textureEntry, visualParams, cacheItems);
160 sp.Appearance.SetSize(avSize);
161
162 float off = sp.Appearance.AvatarFeetOffset;
163 Vector3 box = sp.Appearance.AvatarBoxSize;
164 if (oldoff != off || oldbox != box)
165 ((ScenePresence)sp).SetSize(box, off);
162 } 166 }
163 167
164 /// <summary> 168 /// <summary>
165 /// Set appearance data (texture asset IDs and slider settings) 169 /// Set appearance data (texture asset IDs and slider settings)
166 /// </summary> 170 /// </summary>
167 /// <param name="sp"></param> 171 /// <param name="sp"></param>
168 /// <param name="texture"></param> 172 /// <param name="texture"></param>
169 /// <param name="visualParam"></param> 173 /// <param name="visualParam"></param>
170 protected void DoSetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, List<CachedTextureRequestArg> hashes) 174 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, WearableCacheItem[] cacheItems)
171 { 175 {
172 // m_log.DebugFormat( 176// m_log.DebugFormat(
173 // "[AVFACTORY]: start SetAppearance for {0}, te {1}, visualParams {2}", 177// "[AVFACTORY]: start SetAppearance for {0}, te {1}, visualParams {2}",
174 // sp.Name, textureEntry, visualParams); 178// sp.Name, textureEntry, visualParams);
175 179
176 // TODO: This is probably not necessary any longer, just assume the 180 // TODO: This is probably not necessary any longer, just assume the
177 // textureEntry set implies that the appearance transaction is complete 181 // textureEntry set implies that the appearance transaction is complete
@@ -190,36 +194,38 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
190 // m_log.DebugFormat( 194 // m_log.DebugFormat(
191 // "[AVFACTORY]: Setting visual params for {0} to {1}", 195 // "[AVFACTORY]: Setting visual params for {0} to {1}",
192 // client.Name, string.Join(", ", visualParamsStrings)); 196 // client.Name, string.Join(", ", visualParamsStrings));
193 197/*
194 float oldHeight = sp.Appearance.AvatarHeight; 198 float oldHeight = sp.Appearance.AvatarHeight;
195 changed = sp.Appearance.SetVisualParams(visualParams); 199 changed = sp.Appearance.SetVisualParams(visualParams);
196 200
197 if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0) 201 if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0)
198 ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight); 202 ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight);
199 } 203 */
204// float oldoff = sp.Appearance.AvatarFeetOffset;
205// Vector3 oldbox = sp.Appearance.AvatarBoxSize;
206 changed = sp.Appearance.SetVisualParams(visualParams);
207// float off = sp.Appearance.AvatarFeetOffset;
208// Vector3 box = sp.Appearance.AvatarBoxSize;
209// if(oldoff != off || oldbox != box)
210// ((ScenePresence)sp).SetSize(box,off);
200 211
212 }
213
201 // Process the baked texture array 214 // Process the baked texture array
202 if (textureEntry != null) 215 if (textureEntry != null)
203 { 216 {
204 // m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); 217 m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
205 // WriteBakedTexturesReport(sp, m_log.DebugFormat); 218
219// WriteBakedTexturesReport(sp, m_log.DebugFormat);
206 220
207 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; 221 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
208 222
209 // WriteBakedTexturesReport(sp, m_log.DebugFormat); 223// WriteBakedTexturesReport(sp, m_log.DebugFormat);
210 224
211 // If bake textures are missing and this is not an NPC, request a rebake from client 225 // If bake textures are missing and this is not an NPC, request a rebake from client
212 if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc)) 226 if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc))
213 RequestRebake(sp, true); 227 RequestRebake(sp, true);
214 228
215 // Save the wearble hashes in the appearance
216 sp.Appearance.ResetTextureHashes();
217 if (m_reusetextures)
218 {
219 foreach (CachedTextureRequestArg arg in hashes)
220 sp.Appearance.SetTextureHash(arg.BakedTextureIndex,arg.WearableHashID);
221 }
222
223 // This appears to be set only in the final stage of the appearance 229 // This appears to be set only in the final stage of the appearance
224 // update transaction. In theory, we should be able to do an immediate 230 // update transaction. In theory, we should be able to do an immediate
225 // appearance send and save here. 231 // appearance send and save here.
@@ -253,13 +259,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
253 259
254 public bool SendAppearance(UUID agentId) 260 public bool SendAppearance(UUID agentId)
255 { 261 {
256 // m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId); 262// m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId);
257 263
258 ScenePresence sp = m_scene.GetScenePresence(agentId); 264 ScenePresence sp = m_scene.GetScenePresence(agentId);
259 if (sp == null) 265 if (sp == null)
260 { 266 {
261 // This is expected if the user has gone away. 267 // This is expected if the user has gone away.
262 // m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); 268// m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
263 return false; 269 return false;
264 } 270 }
265 271
@@ -277,6 +283,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
277 return GetBakedTextureFaces(sp); 283 return GetBakedTextureFaces(sp);
278 } 284 }
279 285
286 public WearableCacheItem[] GetCachedItems(UUID agentId)
287 {
288 ScenePresence sp = m_scene.GetScenePresence(agentId);
289 WearableCacheItem[] items = sp.Appearance.WearableCacheItems;
290 //foreach (WearableCacheItem item in items)
291 //{
292
293 //}
294 return items;
295 }
296
280 public bool SaveBakedTextures(UUID agentId) 297 public bool SaveBakedTextures(UUID agentId)
281 { 298 {
282 ScenePresence sp = m_scene.GetScenePresence(agentId); 299 ScenePresence sp = m_scene.GetScenePresence(agentId);
@@ -336,7 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
336 /// <param name="agentId"></param> 353 /// <param name="agentId"></param>
337 public void QueueAppearanceSend(UUID agentid) 354 public void QueueAppearanceSend(UUID agentid)
338 { 355 {
339 // m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid); 356// m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
340 357
341 // 10000 ticks per millisecond, 1000 milliseconds per second 358 // 10000 ticks per millisecond, 1000 milliseconds per second
342 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 1000 * 10000); 359 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 1000 * 10000);
@@ -349,7 +366,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
349 366
350 public void QueueAppearanceSave(UUID agentid) 367 public void QueueAppearanceSave(UUID agentid)
351 { 368 {
352 // m_log.DebugFormat("[AVFACTORY]: Queueing appearance save for {0}", agentid); 369// m_log.DebugFormat("[AVFACTORY]: Queueing appearance save for {0}", agentid);
353 370
354 // 10000 ticks per millisecond, 1000 milliseconds per second 371 // 10000 ticks per millisecond, 1000 milliseconds per second
355 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_savetime * 1000 * 10000); 372 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_savetime * 1000 * 10000);
@@ -363,6 +380,53 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
363 public bool ValidateBakedTextureCache(IScenePresence sp) 380 public bool ValidateBakedTextureCache(IScenePresence sp)
364 { 381 {
365 bool defonly = true; // are we only using default textures 382 bool defonly = true; // are we only using default textures
383 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
384 IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
385 WearableCacheItem[] wearableCache = null;
386
387 // Cache wearable data for teleport.
388 // Only makes sense if there's a bake module and a cache module
389 if (bakedModule != null && cache != null)
390 {
391 try
392 {
393 wearableCache = bakedModule.Get(sp.UUID);
394 }
395 catch (Exception)
396 {
397
398 }
399 if (wearableCache != null)
400 {
401 for (int i = 0; i < wearableCache.Length; i++)
402 {
403 cache.Cache(wearableCache[i].TextureAsset);
404 }
405 }
406 }
407 /*
408 IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
409 if (invService.GetRootFolder(userID) != null)
410 {
411 WearableCacheItem[] wearableCache = null;
412 if (bakedModule != null)
413 {
414 try
415 {
416 wearableCache = bakedModule.Get(userID);
417 appearance.WearableCacheItems = wearableCache;
418 appearance.WearableCacheItemsDirty = false;
419 foreach (WearableCacheItem item in wearableCache)
420 {
421 appearance.Texture.FaceTextures[item.TextureIndex].TextureID = item.TextureID;
422 }
423 }
424 catch (Exception)
425 {
426
427 }
428 }
429 */
366 430
367 // Process the texture entry 431 // Process the texture entry
368 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) 432 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
@@ -370,13 +434,36 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
370 int idx = AvatarAppearance.BAKE_INDICES[i]; 434 int idx = AvatarAppearance.BAKE_INDICES[i];
371 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; 435 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
372 436
373 // if there is no texture entry, skip it 437 // No face, so lets check our baked service cache, teleport or login.
374 if (face == null) 438 if (face == null)
375 continue; 439 {
440 if (wearableCache != null)
441 {
442 // If we find the an appearance item, set it as the textureentry and the face
443 WearableCacheItem searchitem = WearableCacheItem.SearchTextureIndex((uint) idx, wearableCache);
444 if (searchitem != null)
445 {
446 sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint) idx);
447 sp.Appearance.Texture.FaceTextures[idx].TextureID = searchitem.TextureID;
448 face = sp.Appearance.Texture.FaceTextures[idx];
449 }
450 else
451 {
452 // if there is no texture entry and no baked cache, skip it
453 continue;
454 }
455 }
456 else
457 {
458 //No texture entry face and no cache. Skip this face.
459 continue;
460 }
461 }
462
376 463
377 // m_log.DebugFormat( 464// m_log.DebugFormat(
378 // "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", 465// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
379 // face.TextureID, idx, client.Name, client.AgentId); 466// face.TextureID, idx, client.Name, client.AgentId);
380 467
381 // if the texture is one of the "defaults" then skip it 468 // if the texture is one of the "defaults" then skip it
382 // this should probably be more intelligent (skirt texture doesnt matter 469 // this should probably be more intelligent (skirt texture doesnt matter
@@ -387,11 +474,19 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
387 474
388 defonly = false; // found a non-default texture reference 475 defonly = false; // found a non-default texture reference
389 476
390 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) 477 if (cache != null)
391 return false; 478 {
479 if (!cache.Check(face.TextureID.ToString()))
480 return false;
481 }
482 else
483 {
484 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
485 return false;
486 }
392 } 487 }
393 488
394 // m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); 489// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
395 490
396 // If we only found default textures, then the appearance is not cached 491 // If we only found default textures, then the appearance is not cached
397 return (defonly ? false : true); 492 return (defonly ? false : true);
@@ -400,6 +495,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
400 public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) 495 public int RequestRebake(IScenePresence sp, bool missingTexturesOnly)
401 { 496 {
402 int texturesRebaked = 0; 497 int texturesRebaked = 0;
498 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
403 499
404 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) 500 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
405 { 501 {
@@ -410,9 +506,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
410 if (face == null) 506 if (face == null)
411 continue; 507 continue;
412 508
413 // m_log.DebugFormat( 509// m_log.DebugFormat(
414 // "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", 510// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
415 // face.TextureID, idx, client.Name, client.AgentId); 511// face.TextureID, idx, client.Name, client.AgentId);
416 512
417 // if the texture is one of the "defaults" then skip it 513 // if the texture is one of the "defaults" then skip it
418 // this should probably be more intelligent (skirt texture doesnt matter 514 // this should probably be more intelligent (skirt texture doesnt matter
@@ -423,21 +519,36 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
423 519
424 if (missingTexturesOnly) 520 if (missingTexturesOnly)
425 { 521 {
426 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) 522 if (cache != null)
427 { 523 {
428 continue; 524 if (cache.Check(face.TextureID.ToString()))
525 continue;
526 else
527 {
528 m_log.DebugFormat(
529 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
530 face.TextureID, idx, sp.Name);
531 }
429 } 532 }
430 else 533 else
431 { 534 {
432 // On inter-simulator teleports, this occurs if baked textures are not being stored by the 535 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
433 // grid asset service (which means that they are not available to the new region and so have 536 {
434 // to be re-requested from the client). 537 continue;
435 // 538 }
436 // The only available core OpenSimulator behaviour right now 539
437 // is not to store these textures, temporarily or otherwise. 540 else
438 m_log.DebugFormat( 541 {
439 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", 542 // On inter-simulator teleports, this occurs if baked textures are not being stored by the
440 face.TextureID, idx, sp.Name); 543 // grid asset service (which means that they are not available to the new region and so have
544 // to be re-requested from the client).
545 //
546 // The only available core OpenSimulator behaviour right now
547 // is not to store these textures, temporarily or otherwise.
548 m_log.DebugFormat(
549 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
550 face.TextureID, idx, sp.Name);
551 }
441 } 552 }
442 } 553 }
443 else 554 else
@@ -476,9 +587,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
476 if (bakeType == BakeType.Unknown) 587 if (bakeType == BakeType.Unknown)
477 continue; 588 continue;
478 589
479 // m_log.DebugFormat( 590// m_log.DebugFormat(
480 // "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}", 591// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}",
481 // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); 592// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
482 593
483 int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); 594 int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType);
484 Primitive.TextureEntryFace texture = faceTextures[ftIndex]; // this will be null if there's no such baked texture 595 Primitive.TextureEntryFace texture = faceTextures[ftIndex]; // this will be null if there's no such baked texture
@@ -502,7 +613,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
502 UUID avatarID = kvp.Key; 613 UUID avatarID = kvp.Key;
503 long sendTime = kvp.Value; 614 long sendTime = kvp.Value;
504 615
505 // m_log.DebugFormat("[AVFACTORY]: Handling queued appearance updates for {0}, update delta to now is {1}", avatarID, sendTime - now); 616// m_log.DebugFormat("[AVFACTORY]: Handling queued appearance updates for {0}, update delta to now is {1}", avatarID, sendTime - now);
506 617
507 if (sendTime < now) 618 if (sendTime < now)
508 { 619 {
@@ -548,11 +659,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
548 if (sp == null) 659 if (sp == null)
549 { 660 {
550 // This is expected if the user has gone away. 661 // This is expected if the user has gone away.
551 // m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); 662// m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
552 return; 663 return;
553 } 664 }
554 665
555 // m_log.DebugFormat("[AVFACTORY]: Saving appearance for avatar {0}", agentid); 666// m_log.DebugFormat("[AVFACTORY]: Saving appearance for avatar {0}", agentid);
556 667
557 // This could take awhile since it needs to pull inventory 668 // This could take awhile since it needs to pull inventory
558 // We need to do it at the point of save so that there is a sufficient delay for any upload of new body part/shape 669 // We need to do it at the point of save so that there is a sufficient delay for any upload of new body part/shape
@@ -579,26 +690,70 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
579 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) 690 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance)
580 { 691 {
581 IInventoryService invService = m_scene.InventoryService; 692 IInventoryService invService = m_scene.InventoryService;
582 693 bool resetwearable = false;
583 if (invService.GetRootFolder(userID) != null) 694 if (invService.GetRootFolder(userID) != null)
584 { 695 {
585 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 696 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
586 { 697 {
587 for (int j = 0; j < appearance.Wearables[i].Count; j++) 698 for (int j = 0; j < appearance.Wearables[i].Count; j++)
588 { 699 {
700 // Check if the default wearables are not set
589 if (appearance.Wearables[i][j].ItemID == UUID.Zero) 701 if (appearance.Wearables[i][j].ItemID == UUID.Zero)
702 {
703 switch ((WearableType) i)
704 {
705 case WearableType.Eyes:
706 case WearableType.Hair:
707 case WearableType.Shape:
708 case WearableType.Skin:
709 //case WearableType.Underpants:
710 TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
711 resetwearable = true;
712 m_log.Warn("[AVFACTORY]: UUID.Zero Wearables, passing fake values.");
713 resetwearable = true;
714 break;
715
716 }
590 continue; 717 continue;
718 }
591 719
592 // Ignore ruth's assets 720 // Ignore ruth's assets except for the body parts! missing body parts fail avatar appearance on V1
593 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) 721 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID)
722 {
723 switch ((WearableType)i)
724 {
725 case WearableType.Eyes:
726 case WearableType.Hair:
727 case WearableType.Shape:
728 case WearableType.Skin:
729 //case WearableType.Underpants:
730 TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
731
732 m_log.WarnFormat("[AVFACTORY]: {0} Default Wearables, passing existing values.", (WearableType)i);
733 resetwearable = true;
734 break;
735
736 }
594 continue; 737 continue;
595 738 }
739
596 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); 740 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID);
597 baseItem = invService.GetItem(baseItem); 741 baseItem = invService.GetItem(baseItem);
598 742
599 if (baseItem != null) 743 if (baseItem != null)
600 { 744 {
601 appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID); 745 appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID);
746 int unmodifiedWearableIndexForClosure = i;
747 m_scene.AssetService.Get(baseItem.AssetID.ToString(), this,
748 delegate(string x, object y, AssetBase z)
749 {
750 if (z == null)
751 {
752 TryAndRepairBrokenWearable(
753 (WearableType)unmodifiedWearableIndexForClosure, invService,
754 userID, appearance);
755 }
756 });
602 } 757 }
603 else 758 else
604 { 759 {
@@ -606,17 +761,236 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
606 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", 761 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default",
607 appearance.Wearables[i][j].ItemID, (WearableType)i); 762 appearance.Wearables[i][j].ItemID, (WearableType)i);
608 763
609 appearance.Wearables[i].RemoveItem(appearance.Wearables[i][j].ItemID); 764 TryAndRepairBrokenWearable((WearableType)i, invService, userID, appearance);
765 resetwearable = true;
766
610 } 767 }
611 } 768 }
612 } 769 }
770
771 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
772 if (appearance.Wearables[(int) WearableType.Eyes] == null)
773 {
774 m_log.WarnFormat("[AVFACTORY]: {0} Eyes are Null, passing existing values.", (WearableType.Eyes));
775
776 TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance);
777 resetwearable = true;
778 }
779 else
780 {
781 if (appearance.Wearables[(int) WearableType.Eyes][0].ItemID == UUID.Zero)
782 {
783 m_log.WarnFormat("[AVFACTORY]: Eyes are UUID.Zero are broken, {0} {1}",
784 appearance.Wearables[(int) WearableType.Eyes][0].ItemID,
785 appearance.Wearables[(int) WearableType.Eyes][0].AssetID);
786 TryAndRepairBrokenWearable(WearableType.Eyes, invService, userID, appearance);
787 resetwearable = true;
788
789 }
790
791 }
792 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
793 if (appearance.Wearables[(int)WearableType.Shape] == null)
794 {
795 m_log.WarnFormat("[AVFACTORY]: {0} shape is Null, passing existing values.", (WearableType.Shape));
796
797 TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance);
798 resetwearable = true;
799 }
800 else
801 {
802 if (appearance.Wearables[(int)WearableType.Shape][0].ItemID == UUID.Zero)
803 {
804 m_log.WarnFormat("[AVFACTORY]: Shape is UUID.Zero and broken, {0} {1}",
805 appearance.Wearables[(int)WearableType.Shape][0].ItemID,
806 appearance.Wearables[(int)WearableType.Shape][0].AssetID);
807 TryAndRepairBrokenWearable(WearableType.Shape, invService, userID, appearance);
808 resetwearable = true;
809
810 }
811
812 }
813 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
814 if (appearance.Wearables[(int)WearableType.Hair] == null)
815 {
816 m_log.WarnFormat("[AVFACTORY]: {0} Hair is Null, passing existing values.", (WearableType.Hair));
817
818 TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance);
819 resetwearable = true;
820 }
821 else
822 {
823 if (appearance.Wearables[(int)WearableType.Hair][0].ItemID == UUID.Zero)
824 {
825 m_log.WarnFormat("[AVFACTORY]: Hair is UUID.Zero and broken, {0} {1}",
826 appearance.Wearables[(int)WearableType.Hair][0].ItemID,
827 appearance.Wearables[(int)WearableType.Hair][0].AssetID);
828 TryAndRepairBrokenWearable(WearableType.Hair, invService, userID, appearance);
829 resetwearable = true;
830
831 }
832
833 }
834 // I don't know why we have to test for this again... but the above switches do not capture these scenarios for some reason....
835 if (appearance.Wearables[(int)WearableType.Skin] == null)
836 {
837 m_log.WarnFormat("[AVFACTORY]: {0} Skin is Null, passing existing values.", (WearableType.Skin));
838
839 TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance);
840 resetwearable = true;
841 }
842 else
843 {
844 if (appearance.Wearables[(int)WearableType.Skin][0].ItemID == UUID.Zero)
845 {
846 m_log.WarnFormat("[AVFACTORY]: Skin is UUID.Zero and broken, {0} {1}",
847 appearance.Wearables[(int)WearableType.Skin][0].ItemID,
848 appearance.Wearables[(int)WearableType.Skin][0].AssetID);
849 TryAndRepairBrokenWearable(WearableType.Skin, invService, userID, appearance);
850 resetwearable = true;
851
852 }
853
854 }
855 if (resetwearable)
856 {
857 ScenePresence presence = null;
858 if (m_scene.TryGetScenePresence(userID, out presence))
859 {
860 presence.ControllingClient.SendWearables(presence.Appearance.Wearables,
861 presence.Appearance.Serial++);
862 }
863 }
864
613 } 865 }
614 else 866 else
615 { 867 {
616 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); 868 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID);
617 } 869 }
618 } 870 }
871 private void TryAndRepairBrokenWearable(WearableType type, IInventoryService invService, UUID userID,AvatarAppearance appearance)
872 {
873 UUID defaultwearable = GetDefaultItem(type);
874 if (defaultwearable != UUID.Zero)
875 {
876 UUID newInvItem = UUID.Random();
877 InventoryItemBase itembase = new InventoryItemBase(newInvItem, userID)
878 {
879 AssetID =
880 defaultwearable,
881 AssetType
882 =
883 (int)
884 AssetType
885 .Bodypart,
886 CreatorId
887 =
888 userID
889 .ToString
890 (),
891 //InvType = (int)InventoryType.Wearable,
892
893 Description
894 =
895 "Failed Wearable Replacement",
896 Folder =
897 invService
898 .GetFolderForType
899 (userID,
900 AssetType
901 .Bodypart)
902 .ID,
903 Flags = (uint) type,
904 Name = Enum.GetName(typeof (WearableType), type),
905 BasePermissions = (uint) PermissionMask.Copy,
906 CurrentPermissions = (uint) PermissionMask.Copy,
907 EveryOnePermissions = (uint) PermissionMask.Copy,
908 GroupPermissions = (uint) PermissionMask.Copy,
909 NextPermissions = (uint) PermissionMask.Copy
910 };
911 invService.AddItem(itembase);
912 UUID LinkInvItem = UUID.Random();
913 itembase = new InventoryItemBase(LinkInvItem, userID)
914 {
915 AssetID =
916 newInvItem,
917 AssetType
918 =
919 (int)
920 AssetType
921 .Link,
922 CreatorId
923 =
924 userID
925 .ToString
926 (),
927 InvType = (int) InventoryType.Wearable,
928
929 Description
930 =
931 "Failed Wearable Replacement",
932 Folder =
933 invService
934 .GetFolderForType
935 (userID,
936 AssetType
937 .CurrentOutfitFolder)
938 .ID,
939 Flags = (uint) type,
940 Name = Enum.GetName(typeof (WearableType), type),
941 BasePermissions = (uint) PermissionMask.Copy,
942 CurrentPermissions = (uint) PermissionMask.Copy,
943 EveryOnePermissions = (uint) PermissionMask.Copy,
944 GroupPermissions = (uint) PermissionMask.Copy,
945 NextPermissions = (uint) PermissionMask.Copy
946 };
947 invService.AddItem(itembase);
948 appearance.Wearables[(int)type] = new AvatarWearable(newInvItem, GetDefaultItem(type));
949 ScenePresence presence = null;
950 if (m_scene.TryGetScenePresence(userID, out presence))
951 {
952 m_scene.SendInventoryUpdate(presence.ControllingClient,
953 invService.GetFolderForType(userID,
954 AssetType
955 .CurrentOutfitFolder),
956 false, true);
957 }
958 }
959 }
960 private UUID GetDefaultItem(WearableType wearable)
961 {
962 // These are ruth
963 UUID ret = UUID.Zero;
964 switch (wearable)
965 {
966 case WearableType.Eyes:
967 ret = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7");
968 break;
969 case WearableType.Hair:
970 ret = new UUID("d342e6c0-b9d2-11dc-95ff-0800200c9a66");
971 break;
972 case WearableType.Pants:
973 ret = new UUID("00000000-38f9-1111-024e-222222111120");
974 break;
975 case WearableType.Shape:
976 ret = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
977 break;
978 case WearableType.Shirt:
979 ret = new UUID("00000000-38f9-1111-024e-222222111110");
980 break;
981 case WearableType.Skin:
982 ret = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb");
983 break;
984 case WearableType.Undershirt:
985 ret = new UUID("16499ebb-3208-ec27-2def-481881728f47");
986 break;
987 case WearableType.Underpants:
988 ret = new UUID("4ac2e9c7-3671-d229-316a-67717730841d");
989 break;
990 }
619 991
992 return ret;
993 }
620 #endregion 994 #endregion
621 995
622 #region Client Event Handlers 996 #region Client Event Handlers
@@ -626,12 +1000,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
626 /// <param name="client"></param> 1000 /// <param name="client"></param>
627 private void Client_OnRequestWearables(IClientAPI client) 1001 private void Client_OnRequestWearables(IClientAPI client)
628 { 1002 {
629 // m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId); 1003 Util.FireAndForget(delegate(object x)
630 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 1004 {
631 if (sp != null) 1005 Thread.Sleep(4000);
632 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++); 1006
633 else 1007 // m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId);
634 m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId); 1008 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
1009 if (sp != null)
1010 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++);
1011 else
1012 m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId);
1013 });
635 } 1014 }
636 1015
637 /// <summary> 1016 /// <summary>
@@ -640,12 +1019,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
640 /// <param name="client"></param> 1019 /// <param name="client"></param>
641 /// <param name="texture"></param> 1020 /// <param name="texture"></param>
642 /// <param name="visualParam"></param> 1021 /// <param name="visualParam"></param>
643 private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, List<CachedTextureRequestArg> hashes) 1022 private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
644 { 1023 {
645 // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId); 1024 // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId);
646 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 1025 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
647 if (sp != null) 1026 if (sp != null)
648 DoSetAppearance(sp, textureEntry, visualParams, hashes); 1027 SetAppearance(sp, textureEntry, visualParams,avSize, cacheItems);
649 else 1028 else
650 m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId); 1029 m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId);
651 } 1030 }
@@ -702,7 +1081,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
702 /// <param name="cachedTextureRequest"></param> 1081 /// <param name="cachedTextureRequest"></param>
703 private void Client_OnCachedTextureRequest(IClientAPI client, int serial, List<CachedTextureRequestArg> cachedTextureRequest) 1082 private void Client_OnCachedTextureRequest(IClientAPI client, int serial, List<CachedTextureRequestArg> cachedTextureRequest)
704 { 1083 {
705 // m_log.DebugFormat("[AVFACTORY]: Client_OnCachedTextureRequest called for {0} ({1})", client.Name, client.AgentId); 1084 // m_log.WarnFormat("[AVFACTORY]: Client_OnCachedTextureRequest called for {0} ({1})", client.Name, client.AgentId);
706 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 1085 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
707 1086
708 List<CachedTextureResponseArg> cachedTextureResponse = new List<CachedTextureResponseArg>(); 1087 List<CachedTextureResponseArg> cachedTextureResponse = new List<CachedTextureResponseArg>();
@@ -713,20 +1092,23 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
713 1092
714 if (m_reusetextures) 1093 if (m_reusetextures)
715 { 1094 {
716 if (sp.Appearance.GetTextureHash(index) == request.WearableHashID) 1095 // this is the most insanely dumb way to do this... however it seems to
717 { 1096 // actually work. if the appearance has been reset because wearables have
718 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[index]; 1097 // changed then the texture entries are zero'd out until the bakes are
719 if (face != null) 1098 // uploaded. on login, if the textures exist in the cache (eg if you logged
720 texture = face.TextureID; 1099 // into the simulator recently, then the appearance will pull those and send
721 } 1100 // them back in the packet and you won't have to rebake. if the textures aren't
722 else 1101 // in the cache then the intial makeroot() call in scenepresence will zero
723 { 1102 // them out.
724 // We know that that hash is wrong, null it out 1103 //
725 // and wait for the setappearance call 1104 // a better solution (though how much better is an open question) is to
726 sp.Appearance.SetTextureHash(index,UUID.Zero); 1105 // store the hashes in the appearance and compare them. Thats's coming.
727 } 1106
728 1107 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[index];
729 // m_log.WarnFormat("[AVFACTORY]: use texture {0} for index {1}; hash={2}",texture,index,request.WearableHashID); 1108 if (face != null)
1109 texture = face.TextureID;
1110
1111 // m_log.WarnFormat("[AVFACTORY]: reuse texture {0} for index {1}",texture,index);
730 } 1112 }
731 1113
732 CachedTextureResponseArg response = new CachedTextureResponseArg(); 1114 CachedTextureResponseArg response = new CachedTextureResponseArg();
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
index 1830d41..ff4c6c9 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
@@ -61,10 +61,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
61 for (byte i = 0; i < visualParams.Length; i++) 61 for (byte i = 0; i < visualParams.Length; i++)
62 visualParams[i] = i; 62 visualParams[i] = i;
63 63
64 afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams); 64// afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams);
65 65
66 // TODO: Check baked texture 66 // TODO: Check baked texture
67 Assert.AreEqual(visualParams, sp.Appearance.VisualParams); 67// Assert.AreEqual(visualParams, sp.Appearance.VisualParams);
68 } 68 }
69 69
70 [Test] 70 [Test]
@@ -102,6 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
102 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex); 102 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
103 eyesFace.TextureID = eyesTextureId; 103 eyesFace.TextureID = eyesTextureId;
104 104
105/*
105 afm.SetAppearance(sp, bakedTextureEntry, visualParams); 106 afm.SetAppearance(sp, bakedTextureEntry, visualParams);
106 afm.SaveBakedTextures(userId); 107 afm.SaveBakedTextures(userId);
107// Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId); 108// Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId);
@@ -113,6 +114,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
113 Assert.That(eyesBake, Is.Not.Null); 114 Assert.That(eyesBake, Is.Not.Null);
114 Assert.That(eyesBake.Temporary, Is.False); 115 Assert.That(eyesBake.Temporary, Is.False);
115 Assert.That(eyesBake.Local, Is.False); 116 Assert.That(eyesBake.Local, Is.False);
117*/
116 } 118 }
117 } 119 }
118} \ No newline at end of file 120}
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
new file mode 100644
index 0000000..6ff991e
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
@@ -0,0 +1,191 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using Nini.Config;
30using System;
31using System.IO;
32using System.Text;
33using System.Xml;
34using System.Xml.Serialization;
35using System.Collections;
36using System.Collections.Generic;
37using System.Reflection;
38using log4net;
39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Services.Interfaces;
44using Mono.Addins;
45
46namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
47{
48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XBakes.Module")]
49 public class XBakesModule : INonSharedRegionModule, IBakedTextureModule
50 {
51 protected Scene m_Scene;
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 private UTF8Encoding enc = new UTF8Encoding();
54 private string m_URL = String.Empty;
55 private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase));
56
57
58
59 public void Initialise(IConfigSource configSource)
60 {
61 IConfig config = configSource.Configs["XBakes"];
62 if (config == null)
63 return;
64
65 m_URL = config.GetString("URL", String.Empty);
66 }
67
68 public void AddRegion(Scene scene)
69 {
70 // m_log.InfoFormat("[XBakes]: Enabled for region {0}", scene.RegionInfo.RegionName);
71 m_Scene = scene;
72
73 scene.RegisterModuleInterface<IBakedTextureModule>(this);
74 }
75
76 public void RegionLoaded(Scene scene)
77 {
78 }
79
80 public void RemoveRegion(Scene scene)
81 {
82 }
83
84 public void Close()
85 {
86 }
87
88 public string Name
89 {
90 get { return "XBakes.Module"; }
91 }
92
93 public Type ReplaceableInterface
94 {
95 get { return null; }
96 }
97
98 public WearableCacheItem[] Get(UUID id)
99 {
100 if (m_URL == String.Empty)
101 return null;
102
103 int size = 0;
104 RestClient rc = new RestClient(m_URL);
105 List<WearableCacheItem> ret = new List<WearableCacheItem>();
106 rc.AddResourcePath("bakes");
107 rc.AddResourcePath(id.ToString());
108
109 rc.RequestMethod = "GET";
110
111 try
112 {
113 Stream s = rc.Request();
114 XmlTextReader sr = new XmlTextReader(s);
115
116 sr.ReadStartElement("BakedAppearance");
117 while (sr.LocalName == "BakedTexture")
118 {
119 string sTextureIndex = sr.GetAttribute("TextureIndex");
120 int lTextureIndex = Convert.ToInt32(sTextureIndex);
121 string sCacheId = sr.GetAttribute("CacheId");
122 UUID lCacheId = UUID.Zero;
123 if (!(UUID.TryParse(sCacheId, out lCacheId)))
124 {
125 // ?? Nothing here
126 }
127
128 ++size;
129
130 sr.ReadStartElement("BakedTexture");
131 AssetBase a = (AssetBase)m_serializer.Deserialize(sr);
132 ret.Add(new WearableCacheItem() { CacheId = lCacheId, TextureIndex = (uint)lTextureIndex, TextureAsset = a, TextureID = a.FullID });
133
134 sr.ReadEndElement();
135 }
136 m_log.DebugFormat("[XBakes]: Ended reading");
137 sr.Close();
138 s.Close();
139
140
141 return ret.ToArray();
142 }
143 catch (XmlException e)
144 {
145 return null;
146 }
147 }
148
149 public void Store(UUID agentId, WearableCacheItem[] data)
150 {
151 if (m_URL == String.Empty)
152 return;
153
154 MemoryStream bakeStream = new MemoryStream();
155 XmlTextWriter bakeWriter = new XmlTextWriter(bakeStream, null);
156
157 bakeWriter.WriteStartElement(String.Empty, "BakedAppearance", String.Empty);
158
159 for (int i = 0; i < data.Length; i++)
160 {
161 if (data[i] != null)
162 {
163 bakeWriter.WriteStartElement(String.Empty, "BakedTexture", String.Empty);
164 bakeWriter.WriteAttributeString(String.Empty, "TextureIndex", String.Empty, data[i].TextureIndex.ToString());
165 bakeWriter.WriteAttributeString(String.Empty, "CacheId", String.Empty, data[i].CacheId.ToString());
166 if (data[i].TextureAsset != null)
167 m_serializer.Serialize(bakeWriter, data[i].TextureAsset);
168
169 bakeWriter.WriteEndElement();
170 }
171 }
172
173 bakeWriter.WriteEndElement();
174 bakeWriter.Flush();
175
176 RestClient rc = new RestClient(m_URL);
177 rc.AddResourcePath("bakes");
178 rc.AddResourcePath(agentId.ToString());
179
180 rc.RequestMethod = "POST";
181
182 MemoryStream reqStream = new MemoryStream(bakeStream.ToArray());
183 Util.FireAndForget(
184 delegate
185 {
186 rc.Request(reqStream);
187 }
188 );
189 }
190 }
191}
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 27ace68..10122e6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -189,8 +189,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
189 string message = c.Message; 189 string message = c.Message;
190 Scene scene = (Scene)c.Scene; 190 Scene scene = (Scene)c.Scene;
191 Vector3 fromPos = c.Position; 191 Vector3 fromPos = c.Position;
192 Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, 192 Vector3 regionPos = new Vector3(scene.RegionInfo.WorldLocX, scene.RegionInfo.WorldLocY, 0);
193 scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
194 193
195 if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel; 194 if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel;
196 195
@@ -342,8 +341,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
342 { 341 {
343 Vector3 fromRegionPos = fromPos + regionPos; 342 Vector3 fromRegionPos = fromPos + regionPos;
344 Vector3 toRegionPos = presence.AbsolutePosition + 343 Vector3 toRegionPos = presence.AbsolutePosition +
345 new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize, 344 new Vector3(presence.Scene.RegionInfo.WorldLocX, presence.Scene.RegionInfo.WorldLocY, 0);
346 presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
347 345
348 int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos); 346 int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
349 347
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 4ec8ae7..4292719 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -78,7 +78,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
78 /// <value> 78 /// <value>
79 /// Used to collect the uuids of the assets that we need to save into the archive 79 /// Used to collect the uuids of the assets that we need to save into the archive
80 /// </value> 80 /// </value>
81 protected Dictionary<UUID, AssetType> m_assetUuids = new Dictionary<UUID, AssetType>(); 81 protected Dictionary<UUID, sbyte> m_assetUuids = new Dictionary<UUID, sbyte>();
82 82
83 /// <value> 83 /// <value>
84 /// Used to collect the uuids of the users that we need to save into the archive 84 /// Used to collect the uuids of the users that we need to save into the archive
@@ -187,7 +187,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
187 187
188 // Don't chase down link asset items as they actually point to their target item IDs rather than an asset 188 // Don't chase down link asset items as they actually point to their target item IDs rather than an asset
189 if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder) 189 if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder)
190 m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (AssetType)inventoryItem.AssetType, m_assetUuids); 190 m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (sbyte)inventoryItem.AssetType, m_assetUuids);
191 } 191 }
192 192
193 /// <summary> 193 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 9e6c752..f3e757a 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -667,8 +667,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
667 667
668 Vector3 avaPos = p.AbsolutePosition; 668 Vector3 avaPos = p.AbsolutePosition;
669 // Getting the global position for the Avatar 669 // Getting the global position for the Avatar
670 Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.RegionLocX*Constants.RegionSize + avaPos.X, 670 Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.WorldLocX + avaPos.X,
671 remoteClient.Scene.RegionInfo.RegionLocY*Constants.RegionSize + avaPos.Y, 671 remoteClient.Scene.RegionInfo.WorldLocY + avaPos.Y,
672 avaPos.Z); 672 avaPos.Z);
673 673
674 string landOwnerName = string.Empty; 674 string landOwnerName = string.Empty;
@@ -758,8 +758,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
758 IClientAPI remoteClient = (IClientAPI)sender; 758 IClientAPI remoteClient = (IClientAPI)sender;
759 string serverURI = string.Empty; 759 string serverURI = string.Empty;
760 GetUserProfileServerURI(remoteClient.AgentId, out serverURI); 760 GetUserProfileServerURI(remoteClient.AgentId, out serverURI);
761 note.TargetId = remoteClient.AgentId; 761 note.UserId = remoteClient.AgentId;
762 UUID.TryParse(args[0], out note.UserId); 762 UUID.TryParse(args[0], out note.TargetId);
763 763
764 object Note = (object)note; 764 object Note = (object)note;
765 if(!JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString())) 765 if(!JsonRpcRequest(ref Note, "avatarnotesrequest", serverURI, UUID.Random().ToString()))