diff options
Merge branch 'master' into bulletsim
Conflicts:
OpenSim/Region/Framework/Scenes/SceneManager.cs
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 125 |
1 files changed, 102 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index e3e3452..4627701 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
104 | public void NewClient(IClientAPI client) | 104 | public void NewClient(IClientAPI client) |
105 | { | 105 | { |
106 | client.OnRequestWearables += SendWearables; | 106 | client.OnRequestWearables += SendWearables; |
107 | client.OnSetAppearance += SetAppearance; | 107 | client.OnSetAppearance += SetAppearanceFromClient; |
108 | client.OnAvatarNowWearing += AvatarIsWearing; | 108 | client.OnAvatarNowWearing += AvatarIsWearing; |
109 | } | 109 | } |
110 | 110 | ||
@@ -189,7 +189,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
189 | /// <param name="client"></param> | 189 | /// <param name="client"></param> |
190 | /// <param name="texture"></param> | 190 | /// <param name="texture"></param> |
191 | /// <param name="visualParam"></param> | 191 | /// <param name="visualParam"></param> |
192 | public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) | 192 | public void SetAppearanceFromClient(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) |
193 | { | 193 | { |
194 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); | 194 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); |
195 | if (sp == null) | 195 | if (sp == null) |
@@ -257,6 +257,85 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
257 | return true; | 257 | return true; |
258 | } | 258 | } |
259 | 259 | ||
260 | public bool SaveBakedTextures(UUID agentId) | ||
261 | { | ||
262 | ScenePresence sp = m_scene.GetScenePresence(agentId); | ||
263 | |||
264 | if (sp == null || sp.IsChildAgent) | ||
265 | return false; | ||
266 | |||
267 | AvatarAppearance appearance = sp.Appearance; | ||
268 | Primitive.TextureEntryFace[] faceTextures = appearance.Texture.FaceTextures; | ||
269 | |||
270 | m_log.DebugFormat( | ||
271 | "[AV FACTORY]: Permanently saving baked textures for {0} in {1}", | ||
272 | sp.Name, m_scene.RegionInfo.RegionName); | ||
273 | |||
274 | foreach (int i in Enum.GetValues(typeof(BakeType))) | ||
275 | { | ||
276 | BakeType bakeType = (BakeType)i; | ||
277 | |||
278 | if (bakeType == BakeType.Unknown) | ||
279 | continue; | ||
280 | |||
281 | // m_log.DebugFormat( | ||
282 | // "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}", | ||
283 | // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); | ||
284 | |||
285 | int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); | ||
286 | Primitive.TextureEntryFace bakedTextureFace = faceTextures[ftIndex]; | ||
287 | |||
288 | if (bakedTextureFace == null) | ||
289 | { | ||
290 | m_log.WarnFormat( | ||
291 | "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently", | ||
292 | bakeType, sp.Name, m_scene.RegionInfo.RegionName); | ||
293 | |||
294 | continue; | ||
295 | } | ||
296 | |||
297 | AssetBase asset = m_scene.AssetService.Get(bakedTextureFace.TextureID.ToString()); | ||
298 | |||
299 | if (asset != null) | ||
300 | { | ||
301 | asset.Temporary = false; | ||
302 | m_scene.AssetService.Store(asset); | ||
303 | } | ||
304 | else | ||
305 | { | ||
306 | m_log.WarnFormat( | ||
307 | "[AV FACTORY]: Baked texture id {0} not found for bake {1} for avatar {2} in {3} when trying to save permanently", | ||
308 | bakedTextureFace.TextureID, bakeType, sp.Name, m_scene.RegionInfo.RegionName); | ||
309 | } | ||
310 | } | ||
311 | |||
312 | // for (int i = 0; i < faceTextures.Length; i++) | ||
313 | // { | ||
314 | //// m_log.DebugFormat( | ||
315 | //// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}", | ||
316 | //// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); | ||
317 | // | ||
318 | // if (faceTextures[i] == null) | ||
319 | // continue; | ||
320 | // | ||
321 | // AssetBase asset = m_scene.AssetService.Get(faceTextures[i].TextureID.ToString()); | ||
322 | // | ||
323 | // if (asset != null) | ||
324 | // { | ||
325 | // asset.Temporary = false; | ||
326 | // m_scene.AssetService.Store(asset); | ||
327 | // } | ||
328 | // else | ||
329 | // { | ||
330 | // m_log.WarnFormat( | ||
331 | // "[AV FACTORY]: Baked texture {0} for {1} in {2} not found when trying to save permanently", | ||
332 | // faceTextures[i].TextureID, sp.Name, m_scene.RegionInfo.RegionName); | ||
333 | // } | ||
334 | // } | ||
335 | |||
336 | return true; | ||
337 | } | ||
338 | |||
260 | #region UpdateAppearanceTimer | 339 | #region UpdateAppearanceTimer |
261 | 340 | ||
262 | /// <summary> | 341 | /// <summary> |
@@ -289,25 +368,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
289 | } | 368 | } |
290 | } | 369 | } |
291 | 370 | ||
292 | private void HandleAppearanceSend(UUID agentid) | 371 | private void SaveAppearance(UUID agentid) |
293 | { | ||
294 | ScenePresence sp = m_scene.GetScenePresence(agentid); | ||
295 | if (sp == null) | ||
296 | { | ||
297 | m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); | ||
298 | return; | ||
299 | } | ||
300 | |||
301 | // m_log.WarnFormat("[AVFACTORY]: Handle appearance send for {0}", agentid); | ||
302 | |||
303 | // Send the appearance to everyone in the scene | ||
304 | sp.SendAppearanceToAllOtherAgents(); | ||
305 | |||
306 | // Send animations back to the avatar as well | ||
307 | sp.Animator.SendAnimPack(); | ||
308 | } | ||
309 | |||
310 | private void HandleAppearanceSave(UUID agentid) | ||
311 | { | 372 | { |
312 | // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved | 373 | // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved |
313 | // in a culture where decimal points are commas and then reloaded in a culture which just treats them as | 374 | // in a culture where decimal points are commas and then reloaded in a culture which just treats them as |
@@ -337,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
337 | { | 398 | { |
338 | if (kvp.Value < now) | 399 | if (kvp.Value < now) |
339 | { | 400 | { |
340 | Util.FireAndForget(delegate(object o) { HandleAppearanceSend(kvp.Key); }); | 401 | Util.FireAndForget(delegate(object o) { SendAppearance(kvp.Key); }); |
341 | m_sendqueue.Remove(kvp.Key); | 402 | m_sendqueue.Remove(kvp.Key); |
342 | } | 403 | } |
343 | } | 404 | } |
@@ -350,7 +411,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
350 | { | 411 | { |
351 | if (kvp.Value < now) | 412 | if (kvp.Value < now) |
352 | { | 413 | { |
353 | Util.FireAndForget(delegate(object o) { HandleAppearanceSave(kvp.Key); }); | 414 | Util.FireAndForget(delegate(object o) { SaveAppearance(kvp.Key); }); |
354 | m_savequeue.Remove(kvp.Key); | 415 | m_savequeue.Remove(kvp.Key); |
355 | } | 416 | } |
356 | } | 417 | } |
@@ -427,6 +488,24 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
427 | } | 488 | } |
428 | } | 489 | } |
429 | 490 | ||
491 | public bool SendAppearance(UUID agentId) | ||
492 | { | ||
493 | ScenePresence sp = m_scene.GetScenePresence(agentId); | ||
494 | if (sp == null) | ||
495 | { | ||
496 | m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); | ||
497 | return false; | ||
498 | } | ||
499 | |||
500 | // Send the appearance to everyone in the scene | ||
501 | sp.SendAppearanceToAllOtherAgents(); | ||
502 | |||
503 | // Send animations back to the avatar as well | ||
504 | sp.Animator.SendAnimPack(); | ||
505 | |||
506 | return true; | ||
507 | } | ||
508 | |||
430 | private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) | 509 | private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) |
431 | { | 510 | { |
432 | IInventoryService invService = m_scene.InventoryService; | 511 | IInventoryService invService = m_scene.InventoryService; |