aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs98
1 files changed, 76 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 0a69979..3532b1d 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -145,6 +145,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
145 SetAppearance(sp, appearance.Texture, appearance.VisualParams); 145 SetAppearance(sp, appearance.Texture, appearance.VisualParams);
146 } 146 }
147 147
148
149 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize)
150 {
151 float oldoff = sp.Appearance.AvatarFeetOffset;
152 Vector3 oldbox = sp.Appearance.AvatarBoxSize;
153
154 SetAppearance(sp, textureEntry, visualParams);
155 sp.Appearance.SetSize(avSize);
156
157 float off = sp.Appearance.AvatarFeetOffset;
158 Vector3 box = sp.Appearance.AvatarBoxSize;
159 if (oldoff != off || oldbox != box)
160 ((ScenePresence)sp).SetSize(box, off);
161 }
162
148 /// <summary> 163 /// <summary>
149 /// Set appearance data (texture asset IDs and slider settings) 164 /// Set appearance data (texture asset IDs and slider settings)
150 /// </summary> 165 /// </summary>
@@ -174,12 +189,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
174 // m_log.DebugFormat( 189 // m_log.DebugFormat(
175 // "[AVFACTORY]: Setting visual params for {0} to {1}", 190 // "[AVFACTORY]: Setting visual params for {0} to {1}",
176 // client.Name, string.Join(", ", visualParamsStrings)); 191 // client.Name, string.Join(", ", visualParamsStrings));
177 192/*
178 float oldHeight = sp.Appearance.AvatarHeight; 193 float oldHeight = sp.Appearance.AvatarHeight;
179 changed = sp.Appearance.SetVisualParams(visualParams); 194 changed = sp.Appearance.SetVisualParams(visualParams);
180 195
181 if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0) 196 if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0)
182 ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight); 197 ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight);
198 */
199// float oldoff = sp.Appearance.AvatarFeetOffset;
200// Vector3 oldbox = sp.Appearance.AvatarBoxSize;
201 changed = sp.Appearance.SetVisualParams(visualParams);
202// float off = sp.Appearance.AvatarFeetOffset;
203// Vector3 box = sp.Appearance.AvatarBoxSize;
204// if(oldoff != off || oldbox != box)
205// ((ScenePresence)sp).SetSize(box,off);
206
183 } 207 }
184 208
185 // Process the baked texture array 209 // Process the baked texture array
@@ -337,6 +361,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
337 public bool ValidateBakedTextureCache(IScenePresence sp) 361 public bool ValidateBakedTextureCache(IScenePresence sp)
338 { 362 {
339 bool defonly = true; // are we only using default textures 363 bool defonly = true; // are we only using default textures
364 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
340 365
341 // Process the texture entry 366 // Process the texture entry
342 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) 367 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
@@ -361,8 +386,16 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
361 386
362 defonly = false; // found a non-default texture reference 387 defonly = false; // found a non-default texture reference
363 388
364 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) 389 if (cache != null)
365 return false; 390 {
391 if (!cache.Check(face.TextureID.ToString()))
392 return false;
393 }
394 else
395 {
396 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
397 return false;
398 }
366 } 399 }
367 400
368// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); 401// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
@@ -374,6 +407,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
374 public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) 407 public int RequestRebake(IScenePresence sp, bool missingTexturesOnly)
375 { 408 {
376 int texturesRebaked = 0; 409 int texturesRebaked = 0;
410 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
377 411
378 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) 412 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
379 { 413 {
@@ -397,21 +431,36 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
397 431
398 if (missingTexturesOnly) 432 if (missingTexturesOnly)
399 { 433 {
400 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) 434 if (cache != null)
401 { 435 {
402 continue; 436 if (cache.Check(face.TextureID.ToString()))
437 continue;
438 else
439 {
440 m_log.DebugFormat(
441 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
442 face.TextureID, idx, sp.Name);
443 }
403 } 444 }
404 else 445 else
405 { 446 {
406 // On inter-simulator teleports, this occurs if baked textures are not being stored by the 447 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
407 // grid asset service (which means that they are not available to the new region and so have 448 {
408 // to be re-requested from the client). 449 continue;
409 // 450 }
410 // The only available core OpenSimulator behaviour right now 451
411 // is not to store these textures, temporarily or otherwise. 452 else
412 m_log.DebugFormat( 453 {
413 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", 454 // On inter-simulator teleports, this occurs if baked textures are not being stored by the
414 face.TextureID, idx, sp.Name); 455 // grid asset service (which means that they are not available to the new region and so have
456 // to be re-requested from the client).
457 //
458 // The only available core OpenSimulator behaviour right now
459 // is not to store these textures, temporarily or otherwise.
460 m_log.DebugFormat(
461 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
462 face.TextureID, idx, sp.Name);
463 }
415 } 464 }
416 } 465 }
417 else 466 else
@@ -592,12 +641,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
592 /// <param name="client"></param> 641 /// <param name="client"></param>
593 private void Client_OnRequestWearables(IClientAPI client) 642 private void Client_OnRequestWearables(IClientAPI client)
594 { 643 {
595 // m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId); 644 Util.FireAndForget(delegate(object x)
596 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 645 {
597 if (sp != null) 646 Thread.Sleep(4000);
598 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++); 647
599 else 648 // m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId);
600 m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId); 649 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
650 if (sp != null)
651 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++);
652 else
653 m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId);
654 });
601 } 655 }
602 656
603 /// <summary> 657 /// <summary>
@@ -606,12 +660,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
606 /// <param name="client"></param> 660 /// <param name="client"></param>
607 /// <param name="texture"></param> 661 /// <param name="texture"></param>
608 /// <param name="visualParam"></param> 662 /// <param name="visualParam"></param>
609 private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) 663 private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize)
610 { 664 {
611 // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId); 665 // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId);
612 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 666 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
613 if (sp != null) 667 if (sp != null)
614 SetAppearance(sp, textureEntry, visualParams); 668 SetAppearance(sp, textureEntry, visualParams,avSize);
615 else 669 else
616 m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId); 670 m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId);
617 } 671 }