aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2008-02-15 12:39:45 +0000
committerMW2008-02-15 12:39:45 +0000
commit23c7c6dabde17130531c5a807f9f1cb621f400dd (patch)
tree11f3181b70a0742af97a8288c07f58d68d707c60 /OpenSim
parentAdd Dr Scofield's name to CONTRIBUTORS (diff)
downloadopensim-SC-23c7c6dabde17130531c5a807f9f1cb621f400dd.zip
opensim-SC-23c7c6dabde17130531c5a807f9f1cb621f400dd.tar.gz
opensim-SC-23c7c6dabde17130531c5a807f9f1cb621f400dd.tar.bz2
opensim-SC-23c7c6dabde17130531c5a807f9f1cb621f400dd.tar.xz
Fixed bug in AvatarFactoryModule that resulted in removing cloth items, not being persisted.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs55
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs1
2 files changed, 29 insertions, 27 deletions
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
index f43657c..24afdb4 100644
--- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Environment.Modules
57 57
58 public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) 58 public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance)
59 { 59 {
60 60
61 //should only let one thread at a time do this part 61 //should only let one thread at a time do this part
62 EventWaitHandle waitHandle = null; 62 EventWaitHandle waitHandle = null;
63 bool fetchInProgress = false; 63 bool fetchInProgress = false;
@@ -99,7 +99,6 @@ namespace OpenSim.Region.Environment.Modules
99 waitHandle = null; 99 waitHandle = null;
100 return false; 100 return false;
101 } 101 }
102
103 } 102 }
104 else 103 else
105 { 104 {
@@ -144,7 +143,7 @@ namespace OpenSim.Region.Environment.Modules
144 m_fetchesInProgress.Remove(avatarId); 143 m_fetchesInProgress.Remove(avatarId);
145 waitHandle.Set(); 144 waitHandle.Set();
146 } 145 }
147 // waitHandle.Close(); 146 // waitHandle.Close();
148 waitHandle = null; 147 waitHandle = null;
149 return true; 148 return true;
150 } 149 }
@@ -158,7 +157,7 @@ namespace OpenSim.Region.Environment.Modules
158 m_fetchesInProgress.Remove(avatarId); 157 m_fetchesInProgress.Remove(avatarId);
159 waitHandle.Set(); 158 waitHandle.Set();
160 } 159 }
161 //waitHandle.Close(); 160 //waitHandle.Close();
162 waitHandle = null; 161 waitHandle = null;
163 return false; 162 return false;
164 } 163 }
@@ -179,7 +178,6 @@ namespace OpenSim.Region.Environment.Modules
179 private AvatarAppearance CheckDatabase(LLUUID avatarId) 178 private AvatarAppearance CheckDatabase(LLUUID avatarId)
180 { 179 {
181 AvatarAppearance appearance = null; 180 AvatarAppearance appearance = null;
182 //check db
183 if (m_enablePersist) 181 if (m_enablePersist)
184 { 182 {
185 if (m_appearanceMapper.TryGetValue(avatarId.UUID, out appearance)) 183 if (m_appearanceMapper.TryGetValue(avatarId.UUID, out appearance))
@@ -198,13 +196,11 @@ namespace OpenSim.Region.Environment.Modules
198 private AvatarAppearance CheckCache(LLUUID avatarId) 196 private AvatarAppearance CheckCache(LLUUID avatarId)
199 { 197 {
200 AvatarAppearance appearance = null; 198 AvatarAppearance appearance = null;
201 //check cache
202 lock (m_avatarsAppearance) 199 lock (m_avatarsAppearance)
203 { 200 {
204 if (m_avatarsAppearance.ContainsKey(avatarId)) 201 if (m_avatarsAppearance.ContainsKey(avatarId))
205 { 202 {
206 appearance = m_avatarsAppearance[avatarId]; 203 appearance = m_avatarsAppearance[avatarId];
207 // return true;
208 } 204 }
209 } 205 }
210 return appearance; 206 return appearance;
@@ -212,10 +208,8 @@ namespace OpenSim.Region.Environment.Modules
212 208
213 public void Initialise(Scene scene, IConfigSource source) 209 public void Initialise(Scene scene, IConfigSource source)
214 { 210 {
215 211 scene.RegisterModuleInterface<IAvatarFactory>(this);
216 scene.RegisterModuleInterface<IAvatarFactory>(this); 212 scene.EventManager.OnNewClient += NewClient;
217 scene.EventManager.OnNewClient += NewClient;
218
219 213
220 if (m_scene == null) 214 if (m_scene == null)
221 { 215 {
@@ -277,31 +271,38 @@ namespace OpenSim.Region.Environment.Modules
277 { 271 {
278 if (profile.RootFolder != null) 272 if (profile.RootFolder != null)
279 { 273 {
280 //Todo look up the assetid from the inventory cache for each itemId that is in AvatarWearingArgs 274 if (m_avatarsAppearance.ContainsKey(clientView.AgentId))
281 // then store assetid and itemId and wearable type in a database
282 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
283 { 275 {
284 if (wear.Type < 13) 276 AvatarAppearance avatAppearance = null;
277 lock (m_avatarsAppearance)
285 { 278 {
286 LLUUID assetId; 279 avatAppearance = m_avatarsAppearance[clientView.AgentId];
280 }
287 281
288 InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID); 282 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
289 if (baseItem != null) 283 {
284 if (wear.Type < 13)
290 { 285 {
291 assetId = baseItem.assetID; 286 if (wear.ItemID == LLUUID.Zero)
287 {
288 avatAppearance.Wearables[wear.Type].ItemID = LLUUID.Zero;
289 avatAppearance.Wearables[wear.Type].AssetID = LLUUID.Zero;
292 290
293 if (m_avatarsAppearance.ContainsKey(clientView.AgentId)) 291 UpdateDatabase(clientView.AgentId, avatAppearance);
292 }
293 else
294 { 294 {
295 AvatarAppearance avatAppearance = null; 295 LLUUID assetId;
296 296
297 lock (m_avatarsAppearance) 297 InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID);
298 if (baseItem != null)
298 { 299 {
299 avatAppearance = m_avatarsAppearance[clientView.AgentId]; 300 assetId = baseItem.assetID;
300 } 301 avatAppearance.Wearables[wear.Type].AssetID = assetId;
301 avatAppearance.Wearables[wear.Type].AssetID = assetId; 302 avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
302 avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
303 303
304 UpdateDatabase(clientView.AgentId, avatAppearance); 304 UpdateDatabase(clientView.AgentId, avatAppearance);
305 }
305 } 306 }
306 } 307 }
307 } 308 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index eec51e6..708da15 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1422,6 +1422,7 @@ namespace OpenSim.Region.Environment.Scenes
1422 !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) 1422 !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance))
1423 { 1423 {
1424 //not found Appearance 1424 //not found Appearance
1425 m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis");
1425 byte[] visualParams; 1426 byte[] visualParams;
1426 AvatarWearable[] wearables; 1427 AvatarWearable[] wearables;
1427 AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams); 1428 AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams);