aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/AvatarFactory
diff options
context:
space:
mode:
authorDiva Canto2013-05-28 20:59:54 -0700
committerDiva Canto2013-05-28 20:59:54 -0700
commit233b9ec4d7739f324360366079469f2026c4ce41 (patch)
tree61266ac4ceffef23a74bad1dbd15bbe4fd103f82 /OpenSim/Region/CoreModules/Avatar/AvatarFactory
parentFirst change in Vivox for ages! -- added a lock to serialize calls to vivox s... (diff)
parentBulletSim: don't zero motion when changing vehicle type. (diff)
downloadopensim-SC-233b9ec4d7739f324360366079469f2026c4ce41.zip
opensim-SC-233b9ec4d7739f324360366079469f2026c4ce41.tar.gz
opensim-SC-233b9ec4d7739f324360366079469f2026c4ce41.tar.bz2
opensim-SC-233b9ec4d7739f324360366079469f2026c4ce41.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/AvatarFactory')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs105
1 files changed, 60 insertions, 45 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index b640b48..aea768e 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
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)
149 { 149 {
150 SetAppearance(sp, appearance.Texture, appearance.VisualParams); 150 DoSetAppearance(sp, appearance.Texture, appearance.VisualParams, new List<CachedTextureRequestArg>());
151 } 151 }
152 152
153 /// <summary> 153 /// <summary>
@@ -158,9 +158,20 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
158 /// <param name="visualParam"></param> 158 /// <param name="visualParam"></param>
159 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams) 159 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams)
160 { 160 {
161// m_log.DebugFormat( 161 DoSetAppearance(sp, textureEntry, visualParams, new List<CachedTextureRequestArg>());
162// "[AVFACTORY]: start SetAppearance for {0}, te {1}, visualParams {2}", 162 }
163// sp.Name, textureEntry, visualParams); 163
164 /// <summary>
165 /// Set appearance data (texture asset IDs and slider settings)
166 /// </summary>
167 /// <param name="sp"></param>
168 /// <param name="texture"></param>
169 /// <param name="visualParam"></param>
170 protected void DoSetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, List<CachedTextureRequestArg> hashes)
171 {
172 // m_log.DebugFormat(
173 // "[AVFACTORY]: start SetAppearance for {0}, te {1}, visualParams {2}",
174 // sp.Name, textureEntry, visualParams);
164 175
165 // TODO: This is probably not necessary any longer, just assume the 176 // TODO: This is probably not necessary any longer, just assume the
166 // textureEntry set implies that the appearance transaction is complete 177 // textureEntry set implies that the appearance transaction is complete
@@ -190,18 +201,25 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
190 // Process the baked texture array 201 // Process the baked texture array
191 if (textureEntry != null) 202 if (textureEntry != null)
192 { 203 {
193// m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); 204 // m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID);
194 205 // WriteBakedTexturesReport(sp, m_log.DebugFormat);
195// WriteBakedTexturesReport(sp, m_log.DebugFormat);
196 206
197 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; 207 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
198 208
199// WriteBakedTexturesReport(sp, m_log.DebugFormat); 209 // WriteBakedTexturesReport(sp, m_log.DebugFormat);
200 210
201 // If bake textures are missing and this is not an NPC, request a rebake from client 211 // If bake textures are missing and this is not an NPC, request a rebake from client
202 if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc)) 212 if (!ValidateBakedTextureCache(sp) && (((ScenePresence)sp).PresenceType != PresenceType.Npc))
203 RequestRebake(sp, true); 213 RequestRebake(sp, true);
204 214
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
205 // This appears to be set only in the final stage of the appearance 223 // This appears to be set only in the final stage of the appearance
206 // update transaction. In theory, we should be able to do an immediate 224 // update transaction. In theory, we should be able to do an immediate
207 // appearance send and save here. 225 // appearance send and save here.
@@ -235,13 +253,13 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
235 253
236 public bool SendAppearance(UUID agentId) 254 public bool SendAppearance(UUID agentId)
237 { 255 {
238// m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId); 256 // m_log.DebugFormat("[AVFACTORY]: Sending appearance for {0}", agentId);
239 257
240 ScenePresence sp = m_scene.GetScenePresence(agentId); 258 ScenePresence sp = m_scene.GetScenePresence(agentId);
241 if (sp == null) 259 if (sp == null)
242 { 260 {
243 // This is expected if the user has gone away. 261 // This is expected if the user has gone away.
244// m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); 262 // m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
245 return false; 263 return false;
246 } 264 }
247 265
@@ -318,7 +336,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
318 /// <param name="agentId"></param> 336 /// <param name="agentId"></param>
319 public void QueueAppearanceSend(UUID agentid) 337 public void QueueAppearanceSend(UUID agentid)
320 { 338 {
321// m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid); 339 // m_log.DebugFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
322 340
323 // 10000 ticks per millisecond, 1000 milliseconds per second 341 // 10000 ticks per millisecond, 1000 milliseconds per second
324 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 1000 * 10000); 342 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 1000 * 10000);
@@ -331,7 +349,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
331 349
332 public void QueueAppearanceSave(UUID agentid) 350 public void QueueAppearanceSave(UUID agentid)
333 { 351 {
334// m_log.DebugFormat("[AVFACTORY]: Queueing appearance save for {0}", agentid); 352 // m_log.DebugFormat("[AVFACTORY]: Queueing appearance save for {0}", agentid);
335 353
336 // 10000 ticks per millisecond, 1000 milliseconds per second 354 // 10000 ticks per millisecond, 1000 milliseconds per second
337 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_savetime * 1000 * 10000); 355 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_savetime * 1000 * 10000);
@@ -356,9 +374,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
356 if (face == null) 374 if (face == null)
357 continue; 375 continue;
358 376
359// m_log.DebugFormat( 377 // m_log.DebugFormat(
360// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", 378 // "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
361// face.TextureID, idx, client.Name, client.AgentId); 379 // face.TextureID, idx, client.Name, client.AgentId);
362 380
363 // if the texture is one of the "defaults" then skip it 381 // if the texture is one of the "defaults" then skip it
364 // this should probably be more intelligent (skirt texture doesnt matter 382 // this should probably be more intelligent (skirt texture doesnt matter
@@ -373,7 +391,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
373 return false; 391 return false;
374 } 392 }
375 393
376// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); 394 // m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
377 395
378 // If we only found default textures, then the appearance is not cached 396 // If we only found default textures, then the appearance is not cached
379 return (defonly ? false : true); 397 return (defonly ? false : true);
@@ -392,9 +410,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
392 if (face == null) 410 if (face == null)
393 continue; 411 continue;
394 412
395// m_log.DebugFormat( 413 // m_log.DebugFormat(
396// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", 414 // "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
397// face.TextureID, idx, client.Name, client.AgentId); 415 // face.TextureID, idx, client.Name, client.AgentId);
398 416
399 // if the texture is one of the "defaults" then skip it 417 // if the texture is one of the "defaults" then skip it
400 // this should probably be more intelligent (skirt texture doesnt matter 418 // this should probably be more intelligent (skirt texture doesnt matter
@@ -458,9 +476,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
458 if (bakeType == BakeType.Unknown) 476 if (bakeType == BakeType.Unknown)
459 continue; 477 continue;
460 478
461// m_log.DebugFormat( 479 // m_log.DebugFormat(
462// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}", 480 // "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}",
463// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); 481 // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
464 482
465 int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); 483 int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType);
466 Primitive.TextureEntryFace texture = faceTextures[ftIndex]; // this will be null if there's no such baked texture 484 Primitive.TextureEntryFace texture = faceTextures[ftIndex]; // this will be null if there's no such baked texture
@@ -484,7 +502,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
484 UUID avatarID = kvp.Key; 502 UUID avatarID = kvp.Key;
485 long sendTime = kvp.Value; 503 long sendTime = kvp.Value;
486 504
487// m_log.DebugFormat("[AVFACTORY]: Handling queued appearance updates for {0}, update delta to now is {1}", avatarID, sendTime - now); 505 // m_log.DebugFormat("[AVFACTORY]: Handling queued appearance updates for {0}, update delta to now is {1}", avatarID, sendTime - now);
488 506
489 if (sendTime < now) 507 if (sendTime < now)
490 { 508 {
@@ -530,11 +548,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
530 if (sp == null) 548 if (sp == null)
531 { 549 {
532 // This is expected if the user has gone away. 550 // This is expected if the user has gone away.
533// m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); 551 // m_log.DebugFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
534 return; 552 return;
535 } 553 }
536 554
537// m_log.DebugFormat("[AVFACTORY]: Saving appearance for avatar {0}", agentid); 555 // m_log.DebugFormat("[AVFACTORY]: Saving appearance for avatar {0}", agentid);
538 556
539 // This could take awhile since it needs to pull inventory 557 // This could take awhile since it needs to pull inventory
540 // 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 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
@@ -622,12 +640,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
622 /// <param name="client"></param> 640 /// <param name="client"></param>
623 /// <param name="texture"></param> 641 /// <param name="texture"></param>
624 /// <param name="visualParam"></param> 642 /// <param name="visualParam"></param>
625 private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) 643 private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, List<CachedTextureRequestArg> hashes)
626 { 644 {
627 // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId); 645 // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId);
628 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 646 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
629 if (sp != null) 647 if (sp != null)
630 SetAppearance(sp, textureEntry, visualParams); 648 DoSetAppearance(sp, textureEntry, visualParams, hashes);
631 else 649 else
632 m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId); 650 m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId);
633 } 651 }
@@ -684,7 +702,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
684 /// <param name="cachedTextureRequest"></param> 702 /// <param name="cachedTextureRequest"></param>
685 private void Client_OnCachedTextureRequest(IClientAPI client, int serial, List<CachedTextureRequestArg> cachedTextureRequest) 703 private void Client_OnCachedTextureRequest(IClientAPI client, int serial, List<CachedTextureRequestArg> cachedTextureRequest)
686 { 704 {
687 // m_log.WarnFormat("[AVFACTORY]: Client_OnCachedTextureRequest called for {0} ({1})", client.Name, client.AgentId); 705 // m_log.DebugFormat("[AVFACTORY]: Client_OnCachedTextureRequest called for {0} ({1})", client.Name, client.AgentId);
688 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 706 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
689 707
690 List<CachedTextureResponseArg> cachedTextureResponse = new List<CachedTextureResponseArg>(); 708 List<CachedTextureResponseArg> cachedTextureResponse = new List<CachedTextureResponseArg>();
@@ -695,23 +713,20 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
695 713
696 if (m_reusetextures) 714 if (m_reusetextures)
697 { 715 {
698 // this is the most insanely dumb way to do this... however it seems to 716 if (sp.Appearance.GetTextureHash(index) == request.WearableHashID)
699 // actually work. if the appearance has been reset because wearables have 717 {
700 // changed then the texture entries are zero'd out until the bakes are 718 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[index];
701 // uploaded. on login, if the textures exist in the cache (eg if you logged 719 if (face != null)
702 // into the simulator recently, then the appearance will pull those and send 720 texture = face.TextureID;
703 // them back in the packet and you won't have to rebake. if the textures aren't 721 }
704 // in the cache then the intial makeroot() call in scenepresence will zero 722 else
705 // them out. 723 {
706 // 724 // We know that that hash is wrong, null it out
707 // a better solution (though how much better is an open question) is to 725 // and wait for the setappearance call
708 // store the hashes in the appearance and compare them. Thats's coming. 726 sp.Appearance.SetTextureHash(index,UUID.Zero);
709 727 }
710 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[index]; 728
711 if (face != null) 729 // m_log.WarnFormat("[AVFACTORY]: use texture {0} for index {1}; hash={2}",texture,index,request.WearableHashID);
712 texture = face.TextureID;
713
714 // m_log.WarnFormat("[AVFACTORY]: reuse texture {0} for index {1}",texture,index);
715 } 730 }
716 731
717 CachedTextureResponseArg response = new CachedTextureResponseArg(); 732 CachedTextureResponseArg response = new CachedTextureResponseArg();