aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-30 01:58:32 +0100
committerJustin Clark-Casey (justincc)2011-08-30 01:58:32 +0100
commitbe357f8feeb438e3292292d163918a307d69c69a (patch)
treef1f45b0a5bb58262885065b7a3fa37dde0d3d03e /OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
parentMove GetMeshKey from buried inside Meshmerizer to a public method on Primitiv... (diff)
downloadopensim-SC_OLD-be357f8feeb438e3292292d163918a307d69c69a.zip
opensim-SC_OLD-be357f8feeb438e3292292d163918a307d69c69a.tar.gz
opensim-SC_OLD-be357f8feeb438e3292292d163918a307d69c69a.tar.bz2
opensim-SC_OLD-be357f8feeb438e3292292d163918a307d69c69a.tar.xz
Fix bug in persisting saved appearances for npcs
Assets have to be marked non-local as well as non-temporary to persist. This is now done. Hopefully addresses http://opensimulator.org/mantis/view.php?id=5660
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs48
1 files changed, 40 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 4627701..f34b6d2 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -257,20 +257,27 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
257 return true; 257 return true;
258 } 258 }
259 259
260 public bool SaveBakedTextures(UUID agentId) 260 public Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId)
261 { 261 {
262 ScenePresence sp = m_scene.GetScenePresence(agentId); 262 ScenePresence sp = m_scene.GetScenePresence(agentId);
263 263
264 if (sp == null || sp.IsChildAgent) 264 if (sp == null)
265 return false; 265 return new Dictionary<BakeType, Primitive.TextureEntryFace>();
266
267 return GetBakedTextureFaces(sp);
268 }
269
270 private Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(ScenePresence sp)
271 {
272 if (sp.IsChildAgent)
273 return new Dictionary<BakeType, Primitive.TextureEntryFace>();
274
275 Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures
276 = new Dictionary<BakeType, Primitive.TextureEntryFace>();
266 277
267 AvatarAppearance appearance = sp.Appearance; 278 AvatarAppearance appearance = sp.Appearance;
268 Primitive.TextureEntryFace[] faceTextures = appearance.Texture.FaceTextures; 279 Primitive.TextureEntryFace[] faceTextures = appearance.Texture.FaceTextures;
269 280
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))) 281 foreach (int i in Enum.GetValues(typeof(BakeType)))
275 { 282 {
276 BakeType bakeType = (BakeType)i; 283 BakeType bakeType = (BakeType)i;
@@ -283,7 +290,31 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
283// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); 290// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]);
284 291
285 int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); 292 int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType);
286 Primitive.TextureEntryFace bakedTextureFace = faceTextures[ftIndex]; 293 bakedTextures[bakeType] = faceTextures[ftIndex];
294 }
295
296 return bakedTextures;
297 }
298
299 public bool SaveBakedTextures(UUID agentId)
300 {
301 ScenePresence sp = m_scene.GetScenePresence(agentId);
302
303 if (sp == null)
304 return false;
305
306 m_log.DebugFormat(
307 "[AV FACTORY]: Permanently saving baked textures for {0} in {1}",
308 sp.Name, m_scene.RegionInfo.RegionName);
309
310 Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = GetBakedTextureFaces(sp);
311
312 if (bakedTextures.Count == 0)
313 return false;
314
315 foreach (BakeType bakeType in bakedTextures.Keys)
316 {
317 Primitive.TextureEntryFace bakedTextureFace = bakedTextures[bakeType];
287 318
288 if (bakedTextureFace == null) 319 if (bakedTextureFace == null)
289 { 320 {
@@ -299,6 +330,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
299 if (asset != null) 330 if (asset != null)
300 { 331 {
301 asset.Temporary = false; 332 asset.Temporary = false;
333 asset.Local = false;
302 m_scene.AssetService.Store(asset); 334 m_scene.AssetService.Store(asset);
303 } 335 }
304 else 336 else