aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2011-10-25 03:17:11 +0100
committerMelanie2011-10-25 03:17:11 +0100
commitd1028b36477c91562f92ef85236e6c330e70aecf (patch)
tree7e5e2d10a85704305f1e7f1cf0f02430f951bba6 /OpenSim
parentMerge commit '8b20faf06c4850df800945c8135aa90c2eebe034' into bigmerge (diff)
parentMoved HaveNeighbor utility function from ScenePresence to Scene. Fixed line e... (diff)
downloadopensim-SC-d1028b36477c91562f92ef85236e6c330e70aecf.zip
opensim-SC-d1028b36477c91562f92ef85236e6c330e70aecf.tar.gz
opensim-SC-d1028b36477c91562f92ef85236e6c330e70aecf.tar.bz2
opensim-SC-d1028b36477c91562f92ef85236e6c330e70aecf.tar.xz
Merge commit 'eac29396d98a4864923a69e0eb73cecdd8a225b3' into bigmerge
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs534
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs40
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs56
5 files changed, 318 insertions, 318 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 0c7c690..236a47c 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -105,143 +105,143 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
105 client.OnAvatarNowWearing += Client_OnAvatarNowWearing; 105 client.OnAvatarNowWearing += Client_OnAvatarNowWearing;
106 } 106 }
107 107
108 #endregion 108 #endregion
109 109
110 #region IAvatarFactoryModule 110 #region IAvatarFactoryModule
111 111
112 /// <summary> 112 /// <summary>
113 /// Set appearance data (texture asset IDs and slider settings) 113 /// Set appearance data (texture asset IDs and slider settings)
114 /// </summary> 114 /// </summary>
115 /// <param name="sp"></param> 115 /// <param name="sp"></param>
116 /// <param name="texture"></param> 116 /// <param name="texture"></param>
117 /// <param name="visualParam"></param> 117 /// <param name="visualParam"></param>
118 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams) 118 public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams)
119 { 119 {
120 // m_log.InfoFormat("[AVFACTORY]: start SetAppearance for {0}", client.AgentId); 120 // m_log.InfoFormat("[AVFACTORY]: start SetAppearance for {0}", client.AgentId);
121 121
122 // TODO: This is probably not necessary any longer, just assume the 122 // TODO: This is probably not necessary any longer, just assume the
123 // textureEntry set implies that the appearance transaction is complete 123 // textureEntry set implies that the appearance transaction is complete
124 bool changed = false; 124 bool changed = false;
125 125
126 // Process the texture entry transactionally, this doesn't guarantee that Appearance is 126 // Process the texture entry transactionally, this doesn't guarantee that Appearance is
127 // going to be handled correctly but it does serialize the updates to the appearance 127 // going to be handled correctly but it does serialize the updates to the appearance
128 lock (m_setAppearanceLock) 128 lock (m_setAppearanceLock)
129 { 129 {
130 // Process the visual params, this may change height as well 130 // Process the visual params, this may change height as well
131 if (visualParams != null) 131 if (visualParams != null)
132 { 132 {
133 // string[] visualParamsStrings = new string[visualParams.Length]; 133 // string[] visualParamsStrings = new string[visualParams.Length];
134 // for (int i = 0; i < visualParams.Length; i++) 134 // for (int i = 0; i < visualParams.Length; i++)
135 // visualParamsStrings[i] = visualParams[i].ToString(); 135 // visualParamsStrings[i] = visualParams[i].ToString();
136 // m_log.DebugFormat( 136 // m_log.DebugFormat(
137 // "[AVFACTORY]: Setting visual params for {0} to {1}", 137 // "[AVFACTORY]: Setting visual params for {0} to {1}",
138 // client.Name, string.Join(", ", visualParamsStrings)); 138 // client.Name, string.Join(", ", visualParamsStrings));
139 139
140 float oldHeight = sp.Appearance.AvatarHeight; 140 float oldHeight = sp.Appearance.AvatarHeight;
141 changed = sp.Appearance.SetVisualParams(visualParams); 141 changed = sp.Appearance.SetVisualParams(visualParams);
142 142
143 if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0) 143 if (sp.Appearance.AvatarHeight != oldHeight && sp.Appearance.AvatarHeight > 0)
144 ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight); 144 ((ScenePresence)sp).SetHeight(sp.Appearance.AvatarHeight);
145 } 145 }
146 146
147 // Process the baked texture array 147 // Process the baked texture array
148 if (textureEntry != null) 148 if (textureEntry != null)
149 { 149 {
150 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; 150 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
151 151
152 m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID); 152 m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", sp.UUID);
153 Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(sp, false); }); 153 Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(sp, false); });
154 154
155 // This appears to be set only in the final stage of the appearance 155 // This appears to be set only in the final stage of the appearance
156 // update transaction. In theory, we should be able to do an immediate 156 // update transaction. In theory, we should be able to do an immediate
157 // appearance send and save here. 157 // appearance send and save here.
158 158
159 } 159 }
160 // save only if there were changes, send no matter what (doesn't hurt to send twice) 160 // save only if there were changes, send no matter what (doesn't hurt to send twice)
161 if (changed) 161 if (changed)
162 QueueAppearanceSave(sp.ControllingClient.AgentId); 162 QueueAppearanceSave(sp.ControllingClient.AgentId);
163 163
164 QueueAppearanceSend(sp.ControllingClient.AgentId); 164 QueueAppearanceSend(sp.ControllingClient.AgentId);
165 } 165 }
166 166
167 // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); 167 // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
168 } 168 }
169 169
170 public bool SendAppearance(UUID agentId) 170 public bool SendAppearance(UUID agentId)
171 { 171 {
172 ScenePresence sp = m_scene.GetScenePresence(agentId); 172 ScenePresence sp = m_scene.GetScenePresence(agentId);
173 if (sp == null) 173 if (sp == null)
174 { 174 {
175 m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); 175 m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId);
176 return false; 176 return false;
177 } 177 }
178 178
179 // Send the appearance to everyone in the scene 179 // Send the appearance to everyone in the scene
180 sp.SendAppearanceToAllOtherAgents(); 180 sp.SendAppearanceToAllOtherAgents();
181 181
182 // Send animations back to the avatar as well 182 // Send animations back to the avatar as well
183 sp.Animator.SendAnimPack(); 183 sp.Animator.SendAnimPack();
184 184
185 return true; 185 return true;
186 } 186 }
187 187
188 public Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId) 188 public Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(UUID agentId)
189 { 189 {
190 ScenePresence sp = m_scene.GetScenePresence(agentId); 190 ScenePresence sp = m_scene.GetScenePresence(agentId);
191 191
192 if (sp == null) 192 if (sp == null)
193 return new Dictionary<BakeType, Primitive.TextureEntryFace>(); 193 return new Dictionary<BakeType, Primitive.TextureEntryFace>();
194 194
195 return GetBakedTextureFaces(sp); 195 return GetBakedTextureFaces(sp);
196 } 196 }
197 197
198 public bool SaveBakedTextures(UUID agentId) 198 public bool SaveBakedTextures(UUID agentId)
199 { 199 {
200 ScenePresence sp = m_scene.GetScenePresence(agentId); 200 ScenePresence sp = m_scene.GetScenePresence(agentId);
201 201
202 if (sp == null) 202 if (sp == null)
203 return false; 203 return false;
204 204
205 m_log.DebugFormat( 205 m_log.DebugFormat(
206 "[AV FACTORY]: Permanently saving baked textures for {0} in {1}", 206 "[AV FACTORY]: Permanently saving baked textures for {0} in {1}",
207 sp.Name, m_scene.RegionInfo.RegionName); 207 sp.Name, m_scene.RegionInfo.RegionName);
208 208
209 Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = GetBakedTextureFaces(sp); 209 Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = GetBakedTextureFaces(sp);
210 210
211 if (bakedTextures.Count == 0) 211 if (bakedTextures.Count == 0)
212 return false; 212 return false;
213 213
214 foreach (BakeType bakeType in bakedTextures.Keys) 214 foreach (BakeType bakeType in bakedTextures.Keys)
215 { 215 {
216 Primitive.TextureEntryFace bakedTextureFace = bakedTextures[bakeType]; 216 Primitive.TextureEntryFace bakedTextureFace = bakedTextures[bakeType];
217 217
218 if (bakedTextureFace == null) 218 if (bakedTextureFace == null)
219 { 219 {
220 m_log.WarnFormat( 220 m_log.WarnFormat(
221 "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently", 221 "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently",
222 bakeType, sp.Name, m_scene.RegionInfo.RegionName); 222 bakeType, sp.Name, m_scene.RegionInfo.RegionName);
223 223
224 continue; 224 continue;
225 } 225 }
226 226
227 AssetBase asset = m_scene.AssetService.Get(bakedTextureFace.TextureID.ToString()); 227 AssetBase asset = m_scene.AssetService.Get(bakedTextureFace.TextureID.ToString());
228 228
229 if (asset != null) 229 if (asset != null)
230 { 230 {
231 asset.Temporary = false; 231 asset.Temporary = false;
232 asset.Local = false; 232 asset.Local = false;
233 m_scene.AssetService.Store(asset); 233 m_scene.AssetService.Store(asset);
234 } 234 }
235 else 235 else
236 { 236 {
237 m_log.WarnFormat( 237 m_log.WarnFormat(
238 "[AV FACTORY]: Baked texture id {0} not found for bake {1} for avatar {2} in {3} when trying to save permanently", 238 "[AV FACTORY]: Baked texture id {0} not found for bake {1} for avatar {2} in {3} when trying to save permanently",
239 bakedTextureFace.TextureID, bakeType, sp.Name, m_scene.RegionInfo.RegionName); 239 bakedTextureFace.TextureID, bakeType, sp.Name, m_scene.RegionInfo.RegionName);
240 } 240 }
241 } 241 }
242 return true; 242 return true;
243 } 243 }
244 244
245 /// <summary> 245 /// <summary>
246 /// Check for the existence of the baked texture assets. 246 /// Check for the existence of the baked texture assets.
247 /// </summary> 247 /// </summary>
@@ -249,42 +249,42 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
249 public bool ValidateBakedTextureCache(IScenePresence sp) 249 public bool ValidateBakedTextureCache(IScenePresence sp)
250 { 250 {
251 return ValidateBakedTextureCache(sp, true); 251 return ValidateBakedTextureCache(sp, true);
252 } 252 }
253 253
254 /// <summary> 254 /// <summary>
255 /// Queue up a request to send appearance, makes it possible to 255 /// Queue up a request to send appearance, makes it possible to
256 /// accumulate changes without sending out each one separately. 256 /// accumulate changes without sending out each one separately.
257 /// </summary> 257 /// </summary>
258 public void QueueAppearanceSend(UUID agentid) 258 public void QueueAppearanceSend(UUID agentid)
259 { 259 {
260 // m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0}", agentid); 260 // m_log.WarnFormat("[AVFACTORY]: Queue appearance send for {0}", agentid);
261 261
262 // 10000 ticks per millisecond, 1000 milliseconds per second 262 // 10000 ticks per millisecond, 1000 milliseconds per second
263 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 1000 * 10000); 263 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_sendtime * 1000 * 10000);
264 lock (m_sendqueue) 264 lock (m_sendqueue)
265 { 265 {
266 m_sendqueue[agentid] = timestamp; 266 m_sendqueue[agentid] = timestamp;
267 m_updateTimer.Start(); 267 m_updateTimer.Start();
268 } 268 }
269 } 269 }
270 270
271 public void QueueAppearanceSave(UUID agentid) 271 public void QueueAppearanceSave(UUID agentid)
272 { 272 {
273 // m_log.WarnFormat("[AVFACTORY]: Queue appearance save for {0}", agentid); 273 // m_log.WarnFormat("[AVFACTORY]: Queue appearance save for {0}", agentid);
274 274
275 // 10000 ticks per millisecond, 1000 milliseconds per second 275 // 10000 ticks per millisecond, 1000 milliseconds per second
276 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_savetime * 1000 * 10000); 276 long timestamp = DateTime.Now.Ticks + Convert.ToInt64(m_savetime * 1000 * 10000);
277 lock (m_savequeue) 277 lock (m_savequeue)
278 { 278 {
279 m_savequeue[agentid] = timestamp; 279 m_savequeue[agentid] = timestamp;
280 m_updateTimer.Start(); 280 m_updateTimer.Start();
281 } 281 }
282 } 282 }
283 283
284 #endregion 284 #endregion
285 285
286 #region AvatarFactoryModule private methods 286 #region AvatarFactoryModule private methods
287 287
288 /// <summary> 288 /// <summary>
289 /// Check for the existence of the baked texture assets. Request a rebake 289 /// Check for the existence of the baked texture assets. Request a rebake
290 /// unless checkonly is true. 290 /// unless checkonly is true.
@@ -416,105 +416,105 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
416 416
417 if (m_savequeue.Count == 0 && m_sendqueue.Count == 0) 417 if (m_savequeue.Count == 0 && m_sendqueue.Count == 0)
418 m_updateTimer.Stop(); 418 m_updateTimer.Stop();
419 } 419 }
420 420
421 private void SaveAppearance(UUID agentid) 421 private void SaveAppearance(UUID agentid)
422 { 422 {
423 // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved 423 // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved
424 // in a culture where decimal points are commas and then reloaded in a culture which just treats them as 424 // in a culture where decimal points are commas and then reloaded in a culture which just treats them as
425 // number seperators. 425 // number seperators.
426 Culture.SetCurrentCulture(); 426 Culture.SetCurrentCulture();
427 427
428 ScenePresence sp = m_scene.GetScenePresence(agentid); 428 ScenePresence sp = m_scene.GetScenePresence(agentid);
429 if (sp == null) 429 if (sp == null)
430 { 430 {
431 m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); 431 m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid);
432 return; 432 return;
433 } 433 }
434 434
435 // m_log.WarnFormat("[AVFACTORY] avatar {0} save appearance",agentid); 435 // m_log.WarnFormat("[AVFACTORY] avatar {0} save appearance",agentid);
436 436
437 // This could take awhile since it needs to pull inventory 437 // This could take awhile since it needs to pull inventory
438 // 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 438 // 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
439 // assets and item asset id changes to complete. 439 // assets and item asset id changes to complete.
440 // I don't think we need to worry about doing this within m_setAppearanceLock since the queueing avoids 440 // I don't think we need to worry about doing this within m_setAppearanceLock since the queueing avoids
441 // multiple save requests. 441 // multiple save requests.
442 SetAppearanceAssets(sp.UUID, sp.Appearance); 442 SetAppearanceAssets(sp.UUID, sp.Appearance);
443 443
444 m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); 444 m_scene.AvatarService.SetAppearance(agentid, sp.Appearance);
445 } 445 }
446 446
447 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) 447 private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance)
448 { 448 {
449 IInventoryService invService = m_scene.InventoryService; 449 IInventoryService invService = m_scene.InventoryService;
450 450
451 if (invService.GetRootFolder(userID) != null) 451 if (invService.GetRootFolder(userID) != null)
452 { 452 {
453 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 453 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
454 { 454 {
455 for (int j = 0; j < appearance.Wearables[j].Count; j++) 455 for (int j = 0; j < appearance.Wearables[j].Count; j++)
456 { 456 {
457 if (appearance.Wearables[i][j].ItemID == UUID.Zero) 457 if (appearance.Wearables[i][j].ItemID == UUID.Zero)
458 continue; 458 continue;
459 459
460 // Ignore ruth's assets 460 // Ignore ruth's assets
461 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) 461 if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID)
462 continue; 462 continue;
463 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); 463 InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID);
464 baseItem = invService.GetItem(baseItem); 464 baseItem = invService.GetItem(baseItem);
465 465
466 if (baseItem != null) 466 if (baseItem != null)
467 { 467 {
468 appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID); 468 appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID);
469 } 469 }
470 else 470 else
471 { 471 {
472 m_log.ErrorFormat( 472 m_log.ErrorFormat(
473 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", 473 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default",
474 appearance.Wearables[i][j].ItemID, (WearableType)i); 474 appearance.Wearables[i][j].ItemID, (WearableType)i);
475 475
476 appearance.Wearables[i].RemoveItem(appearance.Wearables[i][j].ItemID); 476 appearance.Wearables[i].RemoveItem(appearance.Wearables[i][j].ItemID);
477 } 477 }
478 } 478 }
479 } 479 }
480 } 480 }
481 else 481 else
482 { 482 {
483 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID); 483 m_log.WarnFormat("[AVFACTORY]: user {0} has no inventory, appearance isn't going to work", userID);
484 } 484 }
485 } 485 }
486 486
487 #endregion 487 #endregion
488 488
489 #region Client Event Handlers 489 #region Client Event Handlers
490 /// <summary> 490 /// <summary>
491 /// Tell the client for this scene presence what items it should be wearing now 491 /// Tell the client for this scene presence what items it should be wearing now
492 /// </summary> 492 /// </summary>
493 /// <param name="client"></param> 493 /// <param name="client"></param>
494 private void Client_OnRequestWearables(IClientAPI client) 494 private void Client_OnRequestWearables(IClientAPI client)
495 { 495 {
496 // m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId); 496 // m_log.DebugFormat("[AVFACTORY]: Client_OnRequestWearables called for {0} ({1})", client.Name, client.AgentId);
497 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 497 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
498 if (sp != null) 498 if (sp != null)
499 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++); 499 client.SendWearables(sp.Appearance.Wearables, sp.Appearance.Serial++);
500 else 500 else
501 m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId); 501 m_log.WarnFormat("[AVFACTORY]: Client_OnRequestWearables unable to find presence for {0}", client.AgentId);
502 } 502 }
503 503
504 /// <summary> 504 /// <summary>
505 /// Set appearance data (texture asset IDs and slider settings) received from a client 505 /// Set appearance data (texture asset IDs and slider settings) received from a client
506 /// </summary> 506 /// </summary>
507 /// <param name="client"></param> 507 /// <param name="client"></param>
508 /// <param name="texture"></param> 508 /// <param name="texture"></param>
509 /// <param name="visualParam"></param> 509 /// <param name="visualParam"></param>
510 private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) 510 private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams)
511 { 511 {
512 // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId); 512 // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId);
513 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 513 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
514 if (sp != null) 514 if (sp != null)
515 SetAppearance(sp, textureEntry, visualParams); 515 SetAppearance(sp, textureEntry, visualParams);
516 else 516 else
517 m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId); 517 m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId);
518 } 518 }
519 519
520 /// <summary> 520 /// <summary>
@@ -523,7 +523,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
523 /// <param name="client"></param> 523 /// <param name="client"></param>
524 /// <param name="e"></param> 524 /// <param name="e"></param>
525 private void Client_OnAvatarNowWearing(IClientAPI client, AvatarWearingArgs e) 525 private void Client_OnAvatarNowWearing(IClientAPI client, AvatarWearingArgs e)
526 { 526 {
527 // m_log.WarnFormat("[AVFACTORY]: Client_OnAvatarNowWearing called for {0} ({1})", client.Name, client.AgentId); 527 // m_log.WarnFormat("[AVFACTORY]: Client_OnAvatarNowWearing called for {0} ({1})", client.Name, client.AgentId);
528 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 528 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
529 if (sp == null) 529 if (sp == null)
@@ -558,8 +558,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
558 // of visual param and baked texture changes. When those complete, the new appearance will be sent 558 // of visual param and baked texture changes. When those complete, the new appearance will be sent
559 559
560 QueueAppearanceSave(client.AgentId); 560 QueueAppearanceSave(client.AgentId);
561 } 561 }
562 } 562 }
563 #endregion 563 #endregion
564 } 564 }
565} 565}
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
index 931d52f..11a0a86 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
82 82
83 AvatarFactoryModule afm = new AvatarFactoryModule(); 83 AvatarFactoryModule afm = new AvatarFactoryModule();
84 TestScene scene = SceneHelpers.SetupScene(assetCache); 84 TestScene scene = SceneHelpers.SetupScene(assetCache);
85 SceneHelpers.SetupSceneModules(scene, afm); 85 SceneHelpers.SetupSceneModules(scene, afm);
86 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); 86 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
87 87
88 // TODO: Use the actual BunchOfCaps functionality once we slot in the CapabilitiesModules 88 // TODO: Use the actual BunchOfCaps functionality once we slot in the CapabilitiesModules
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
index 98228e4..26bc922 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
@@ -32,8 +32,8 @@ using OpenSim.Framework;
32namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 public interface IAvatarFactoryModule 34 public interface IAvatarFactoryModule
35 { 35 {
36 36
37 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); 37 void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams);
38 38
39 /// <summary> 39 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index aa0b47a..cabba04 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -987,6 +987,46 @@ namespace OpenSim.Region.Framework.Scenes
987 return found; 987 return found;
988 } 988 }
989 989
990 /// <summary>
991 /// Checks whether this region has a neighbour in the given direction.
992 /// </summary>
993 /// <param name="car"></param>
994 /// <param name="fix"></param>
995 /// <returns>
996 /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8.
997 /// Returns a positive integer if there is a region in that direction, a negative integer if not.
998 /// </returns>
999 public int HaveNeighbor(Cardinals car, ref int[] fix)
1000 {
1001 uint neighbourx = RegionInfo.RegionLocX;
1002 uint neighboury = RegionInfo.RegionLocY;
1003
1004 int dir = (int)car;
1005
1006 if (dir > 1 && dir < 5) //Heading East
1007 neighbourx++;
1008 else if (dir > 5) // Heading West
1009 neighbourx--;
1010
1011 if (dir < 3 || dir == 8) // Heading North
1012 neighboury++;
1013 else if (dir > 3 && dir < 7) // Heading Sout
1014 neighboury--;
1015
1016 int x = (int)(neighbourx * Constants.RegionSize);
1017 int y = (int)(neighboury * Constants.RegionSize);
1018 GridRegion neighbourRegion = GridService.GetRegionByPosition(RegionInfo.ScopeID, x, y);
1019
1020 if (neighbourRegion == null)
1021 {
1022 fix[0] = (int)(RegionInfo.RegionLocX - neighbourx);
1023 fix[1] = (int)(RegionInfo.RegionLocY - neighboury);
1024 return dir * (-1);
1025 }
1026 else
1027 return dir;
1028 }
1029
990 // Alias IncomingHelloNeighbour OtherRegionUp, for now 1030 // Alias IncomingHelloNeighbour OtherRegionUp, for now
991 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour) 1031 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour)
992 { 1032 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 02bceb9..fb25493 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3134,17 +3134,17 @@ namespace OpenSim.Region.Framework.Scenes
3134 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 3134 if (m_scene.TestBorderCross(pos2, Cardinals.S))
3135 { 3135 {
3136 needsTransit = true; 3136 needsTransit = true;
3137 neighbor = HaveNeighbor(Cardinals.SW, ref fix); 3137 neighbor = m_scene.HaveNeighbor(Cardinals.SW, ref fix);
3138 } 3138 }
3139 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 3139 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
3140 { 3140 {
3141 needsTransit = true; 3141 needsTransit = true;
3142 neighbor = HaveNeighbor(Cardinals.NW, ref fix); 3142 neighbor = m_scene.HaveNeighbor(Cardinals.NW, ref fix);
3143 } 3143 }
3144 else 3144 else
3145 { 3145 {
3146 needsTransit = true; 3146 needsTransit = true;
3147 neighbor = HaveNeighbor(Cardinals.W, ref fix); 3147 neighbor = m_scene.HaveNeighbor(Cardinals.W, ref fix);
3148 } 3148 }
3149 } 3149 }
3150 else if (m_scene.TestBorderCross(pos2, Cardinals.E)) 3150 else if (m_scene.TestBorderCross(pos2, Cardinals.E))
@@ -3152,28 +3152,28 @@ namespace OpenSim.Region.Framework.Scenes
3152 if (m_scene.TestBorderCross(pos2, Cardinals.S)) 3152 if (m_scene.TestBorderCross(pos2, Cardinals.S))
3153 { 3153 {
3154 needsTransit = true; 3154 needsTransit = true;
3155 neighbor = HaveNeighbor(Cardinals.SE, ref fix); 3155 neighbor = m_scene.HaveNeighbor(Cardinals.SE, ref fix);
3156 } 3156 }
3157 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 3157 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
3158 { 3158 {
3159 needsTransit = true; 3159 needsTransit = true;
3160 neighbor = HaveNeighbor(Cardinals.NE, ref fix); 3160 neighbor = m_scene.HaveNeighbor(Cardinals.NE, ref fix);
3161 } 3161 }
3162 else 3162 else
3163 { 3163 {
3164 needsTransit = true; 3164 needsTransit = true;
3165 neighbor = HaveNeighbor(Cardinals.E, ref fix); 3165 neighbor = m_scene.HaveNeighbor(Cardinals.E, ref fix);
3166 } 3166 }
3167 } 3167 }
3168 else if (m_scene.TestBorderCross(pos2, Cardinals.S)) 3168 else if (m_scene.TestBorderCross(pos2, Cardinals.S))
3169 { 3169 {
3170 needsTransit = true; 3170 needsTransit = true;
3171 neighbor = HaveNeighbor(Cardinals.S, ref fix); 3171 neighbor = m_scene.HaveNeighbor(Cardinals.S, ref fix);
3172 } 3172 }
3173 else if (m_scene.TestBorderCross(pos2, Cardinals.N)) 3173 else if (m_scene.TestBorderCross(pos2, Cardinals.N))
3174 { 3174 {
3175 needsTransit = true; 3175 needsTransit = true;
3176 neighbor = HaveNeighbor(Cardinals.N, ref fix); 3176 neighbor = m_scene.HaveNeighbor(Cardinals.N, ref fix);
3177 } 3177 }
3178 3178
3179 // Makes sure avatar does not end up outside region 3179 // Makes sure avatar does not end up outside region
@@ -3249,46 +3249,6 @@ namespace OpenSim.Region.Framework.Scenes
3249 } 3249 }
3250 3250
3251 /// <summary> 3251 /// <summary>
3252 /// Checks whether this region has a neighbour in the given direction.
3253 /// </summary>
3254 /// <param name="car"></param>
3255 /// <param name="fix"></param>
3256 /// <returns>
3257 /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8.
3258 /// Returns a positive integer if there is a region in that direction, a negative integer if not.
3259 /// </returns>
3260 protected int HaveNeighbor(Cardinals car, ref int[] fix)
3261 {
3262 uint neighbourx = m_scene.RegionInfo.RegionLocX;
3263 uint neighboury = m_scene.RegionInfo.RegionLocY;
3264
3265 int dir = (int)car;
3266
3267 if (dir > 1 && dir < 5) //Heading East
3268 neighbourx++;
3269 else if (dir > 5) // Heading West
3270 neighbourx--;
3271
3272 if (dir < 3 || dir == 8) // Heading North
3273 neighboury++;
3274 else if (dir > 3 && dir < 7) // Heading Sout
3275 neighboury--;
3276
3277 int x = (int)(neighbourx * Constants.RegionSize);
3278 int y = (int)(neighboury * Constants.RegionSize);
3279 GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y);
3280
3281 if (neighbourRegion == null)
3282 {
3283 fix[0] = (int)(m_scene.RegionInfo.RegionLocX - neighbourx);
3284 fix[1] = (int)(m_scene.RegionInfo.RegionLocY - neighboury);
3285 return dir * (-1);
3286 }
3287 else
3288 return dir;
3289 }
3290
3291 /// <summary>
3292 /// Moves the agent outside the region bounds 3252 /// Moves the agent outside the region bounds
3293 /// Tells neighbor region that we're crossing to it 3253 /// Tells neighbor region that we're crossing to it
3294 /// If the neighbor accepts, remove the agent's viewable avatar from this scene 3254 /// If the neighbor accepts, remove the agent's viewable avatar from this scene