diff options
author | UbitUmarov | 2015-09-01 14:54:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 14:54:35 +0100 |
commit | 371c9dd2af01a2e7422ec901ee1f80757284a78c (patch) | |
tree | 058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | |
parent | remove lixo (diff) | |
parent | dont change camera on crossings (diff) | |
download | opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2 opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz |
bad merge?
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 8cdebcd..c27d101 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | |||
@@ -67,6 +67,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
67 | 67 | ||
68 | private IBakedTextureModule m_BakedTextureModule; | 68 | private IBakedTextureModule m_BakedTextureModule; |
69 | 69 | ||
70 | private IBakedTextureModule m_BakedTextureModule; | ||
71 | |||
70 | public void Initialise(IConfigSource source) | 72 | public void Initialise(IConfigSource source) |
71 | { | 73 | { |
72 | IConfig appearanceConfig = source.Configs["Appearance"]; | 74 | IConfig appearanceConfig = source.Configs["Appearance"]; |
@@ -89,7 +91,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
89 | s.EventManager.OnRemovePresence -= DeRegisterPresence; | 91 | s.EventManager.OnRemovePresence -= DeRegisterPresence; |
90 | m_BakedTextureModule = null; | 92 | m_BakedTextureModule = null; |
91 | m_scene = null; | 93 | m_scene = null; |
94 | <<<<<<< HEAD | ||
92 | } | 95 | } |
96 | ======= | ||
97 | } | ||
98 | >>>>>>> avn/ubitvar | ||
93 | 99 | ||
94 | 100 | ||
95 | 101 | ||
@@ -103,6 +109,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
103 | 109 | ||
104 | private void DeRegisterPresence(UUID agentId) | 110 | private void DeRegisterPresence(UUID agentId) |
105 | { | 111 | { |
112 | <<<<<<< HEAD | ||
106 | ScenePresence presence = null; | 113 | ScenePresence presence = null; |
107 | if (m_scene.TryGetScenePresence(agentId, out presence)) | 114 | if (m_scene.TryGetScenePresence(agentId, out presence)) |
108 | { | 115 | { |
@@ -261,8 +268,162 @@ namespace OpenSim.Region.ClientStack.Linden | |||
261 | } | 268 | } |
262 | } | 269 | } |
263 | } | 270 | } |
271 | ======= | ||
272 | // ScenePresence presence = null; | ||
273 | // if (m_scene.TryGetScenePresence(agentId, out presence)) | ||
274 | { | ||
275 | // presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings; | ||
276 | } | ||
277 | |||
278 | >>>>>>> avn/ubitvar | ||
279 | } | ||
280 | |||
281 | private void RegisterNewPresence(ScenePresence presence) | ||
282 | { | ||
283 | // presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings; | ||
264 | } | 284 | } |
265 | 285 | ||
286 | /* not in use. work done in AvatarFactoryModule ValidateBakedTextureCache() and UpdateBakedTextureCache() | ||
287 | private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) | ||
288 | { | ||
289 | // if cacheItems.Length > 0 viewer is giving us current textures information. | ||
290 | // baked ones should had been uploaded and in assets cache as local itens | ||
291 | |||
292 | |||
293 | if (cacheItems.Length == 0) | ||
294 | return; // no textures information, nothing to do | ||
295 | |||
296 | ScenePresence p = null; | ||
297 | if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out p)) | ||
298 | return; // what are we doing if there is no presence to cache for? | ||
299 | |||
300 | if (p.IsDeleted) | ||
301 | return; // does this really work? | ||
302 | |||
303 | int maxCacheitemsLoop = cacheItems.Length; | ||
304 | if (maxCacheitemsLoop > 20) | ||
305 | { | ||
306 | maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES; | ||
307 | m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES); | ||
308 | } | ||
309 | |||
310 | m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>(); | ||
311 | |||
312 | |||
313 | // some nice debug | ||
314 | m_log.Debug("[Cacheitems]: " + cacheItems.Length); | ||
315 | for (int iter = 0; iter < maxCacheitemsLoop; iter++) | ||
316 | { | ||
317 | m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + | ||
318 | cacheItems[iter].TextureID); | ||
319 | } | ||
320 | |||
321 | // p.Appearance.WearableCacheItems is in memory primary cashID to textures mapper | ||
322 | |||
323 | WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems; | ||
324 | |||
325 | if (existingitems == null) | ||
326 | { | ||
327 | if (m_BakedTextureModule != null) | ||
328 | { | ||
329 | WearableCacheItem[] savedcache = null; | ||
330 | try | ||
331 | { | ||
332 | if (p.Appearance.WearableCacheItemsDirty) | ||
333 | { | ||
334 | savedcache = m_BakedTextureModule.Get(p.UUID); | ||
335 | p.Appearance.WearableCacheItems = savedcache; | ||
336 | p.Appearance.WearableCacheItemsDirty = false; | ||
337 | } | ||
338 | } | ||
339 | |||
340 | catch (Exception) | ||
341 | { | ||
342 | // The service logs a sufficient error message. | ||
343 | } | ||
344 | |||
345 | |||
346 | if (savedcache != null) | ||
347 | existingitems = savedcache; | ||
348 | } | ||
349 | } | ||
350 | |||
351 | // Existing items null means it's a fully new appearance | ||
352 | if (existingitems == null) | ||
353 | { | ||
354 | for (int i = 0; i < maxCacheitemsLoop; i++) | ||
355 | { | ||
356 | if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) | ||
357 | { | ||
358 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; | ||
359 | if (face == null) | ||
360 | { | ||
361 | textureEntry.CreateFace(cacheItems[i].TextureIndex); | ||
362 | textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = | ||
363 | AppearanceManager.DEFAULT_AVATAR_TEXTURE; | ||
364 | continue; | ||
365 | } | ||
366 | cacheItems[i].TextureID = face.TextureID; | ||
367 | if (m_scene.AssetService != null) | ||
368 | cacheItems[i].TextureAsset = | ||
369 | m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); | ||
370 | } | ||
371 | else | ||
372 | { | ||
373 | m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); | ||
374 | } | ||
375 | } | ||
376 | } | ||
377 | else | ||
378 | { | ||
379 | for (int i = 0; i < maxCacheitemsLoop; i++) | ||
380 | { | ||
381 | if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex) | ||
382 | { | ||
383 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex]; | ||
384 | if (face == null) | ||
385 | { | ||
386 | textureEntry.CreateFace(cacheItems[i].TextureIndex); | ||
387 | textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID = | ||
388 | AppearanceManager.DEFAULT_AVATAR_TEXTURE; | ||
389 | continue; | ||
390 | } | ||
391 | cacheItems[i].TextureID = | ||
392 | face.TextureID; | ||
393 | } | ||
394 | else | ||
395 | { | ||
396 | m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length); | ||
397 | } | ||
398 | } | ||
399 | |||
400 | for (int i = 0; i < maxCacheitemsLoop; i++) | ||
401 | { | ||
402 | if (cacheItems[i].TextureAsset == null) | ||
403 | { | ||
404 | cacheItems[i].TextureAsset = | ||
405 | m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString()); | ||
406 | } | ||
407 | } | ||
408 | } | ||
409 | p.Appearance.WearableCacheItems = cacheItems; | ||
410 | |||
411 | if (m_BakedTextureModule != null) | ||
412 | { | ||
413 | m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems); | ||
414 | p.Appearance.WearableCacheItemsDirty = true; | ||
415 | |||
416 | } | ||
417 | else | ||
418 | p.Appearance.WearableCacheItemsDirty = false; | ||
419 | |||
420 | for (int iter = 0; iter < maxCacheitemsLoop; iter++) | ||
421 | { | ||
422 | m_log.Debug("[CacheitemsLeaving] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" + | ||
423 | cacheItems[iter].TextureID); | ||
424 | } | ||
425 | } | ||
426 | */ | ||
266 | public void PostInitialise() | 427 | public void PostInitialise() |
267 | { | 428 | { |
268 | } | 429 | } |
@@ -283,6 +444,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
283 | UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( | 444 | UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( |
284 | caps, m_scene.AssetService, m_persistBakedTextures); | 445 | caps, m_scene.AssetService, m_persistBakedTextures); |
285 | 446 | ||
447 | <<<<<<< HEAD | ||
286 | 448 | ||
287 | 449 | ||
288 | caps.RegisterHandler( | 450 | caps.RegisterHandler( |
@@ -297,6 +459,28 @@ namespace OpenSim.Region.ClientStack.Linden | |||
297 | 459 | ||
298 | 460 | ||
299 | 461 | ||
462 | ======= | ||
463 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | ||
464 | if (m_URL == "localhost") | ||
465 | { | ||
466 | UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler( | ||
467 | caps, m_scene.AssetService, m_persistBakedTextures); | ||
468 | |||
469 | caps.RegisterHandler( | ||
470 | "UploadBakedTexture", | ||
471 | new RestStreamHandler( | ||
472 | "POST", | ||
473 | "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, | ||
474 | avatarhandler.UploadBakedTexture, | ||
475 | "UploadBakedTexture", | ||
476 | agentID.ToString())); | ||
477 | |||
478 | } | ||
479 | else | ||
480 | { | ||
481 | caps.RegisterHandler("UploadBakedTexture", m_URL); | ||
482 | } | ||
483 | >>>>>>> avn/ubitvar | ||
300 | } | 484 | } |
301 | } | 485 | } |
302 | } | 486 | } |