aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISoundModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs110
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs108
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs91
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs107
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs66
18 files changed, 492 insertions, 148 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
index 292efa4..d49b24e 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Region.Framework.Interfaces
40 40
41 uint GetRegionFlags(); 41 uint GetRegionFlags();
42 bool IsManager(UUID avatarID); 42 bool IsManager(UUID avatarID);
43 43
44 /// <summary> 44 /// <summary>
45 /// Tell all clients about the current state of the region (terrain textures, water height, etc.). 45 /// Tell all clients about the current state of the region (terrain textures, water height, etc.).
46 /// </summary> 46 /// </summary>
diff --git a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
index 68af492..8372ddd 100644
--- a/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISoundModule.cs
@@ -104,7 +104,6 @@ namespace OpenSim.Region.Framework.Interfaces
104 /// <param name="sound">Sound asset ID</param> 104 /// <param name="sound">Sound asset ID</param>
105 /// <param name="volume">Sound volume</param> 105 /// <param name="volume">Sound volume</param>
106 /// <param name="triggered">Triggered or not.</param> 106 /// <param name="triggered">Triggered or not.</param>
107 /// <param name="flags"></param>
108 /// <param name="radius">Sound radius</param> 107 /// <param name="radius">Sound radius</param>
109 /// <param name="useMaster">Play using sound master</param> 108 /// <param name="useMaster">Play using sound master</param>
110 /// <param name="isMaster">Play as sound master</param> 109 /// <param name="isMaster">Play as sound master</param>
@@ -123,5 +122,12 @@ namespace OpenSim.Region.Framework.Interfaces
123 /// <param name="max">AABB top north-east corner</param> 122 /// <param name="max">AABB top north-east corner</param>
124 void TriggerSoundLimited(UUID objectID, UUID sound, double volume, 123 void TriggerSoundLimited(UUID objectID, UUID sound, double volume,
125 Vector3 min, Vector3 max); 124 Vector3 min, Vector3 max);
125
126 /// <summary>
127 /// Set whether sounds on the given prim should be queued.
128 /// </summary>
129 /// <param name='objectID'></param>
130 /// <param name='shouldQueue'></param>
131 void SetSoundQueueing(UUID objectID, bool shouldQueue);
126 } 132 }
127} \ No newline at end of file 133} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
index 66edfed..5dee64d 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
@@ -28,8 +28,11 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Text;
31using log4net; 32using log4net;
32using OpenMetaverse; 33using OpenMetaverse;
34using OpenMetaverse.StructuredData;
35
33using OpenSim.Framework; 36using OpenSim.Framework;
34 37
35using Animation = OpenSim.Framework.Animation; 38using Animation = OpenSim.Framework.Animation;
@@ -60,6 +63,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation
60 ResetDefaultAnimation(); 63 ResetDefaultAnimation();
61 } 64 }
62 65
66 public AnimationSet(OSDArray pArray)
67 {
68 ResetDefaultAnimation();
69 FromOSDArray(pArray);
70 }
71
63 public bool HasAnimation(UUID animID) 72 public bool HasAnimation(UUID animID)
64 { 73 {
65 if (m_defaultAnimation.AnimID == animID) 74 if (m_defaultAnimation.AnimID == animID)
@@ -218,5 +227,106 @@ namespace OpenSim.Region.Framework.Scenes.Animation
218 foreach (OpenSim.Framework.Animation anim in theArray) 227 foreach (OpenSim.Framework.Animation anim in theArray)
219 m_animations.Add(anim); 228 m_animations.Add(anim);
220 } 229 }
230
231 // Create representation of this AnimationSet as an OSDArray.
232 // First two entries in the array are the default and implicitDefault animations
233 // followed by the other animations.
234 public OSDArray ToOSDArray()
235 {
236 OSDArray ret = new OSDArray();
237 ret.Add(DefaultAnimation.PackUpdateMessage());
238 ret.Add(ImplicitDefaultAnimation.PackUpdateMessage());
239
240 foreach (OpenSim.Framework.Animation anim in m_animations)
241 ret.Add(anim.PackUpdateMessage());
242
243 return ret;
244 }
245
246 public void FromOSDArray(OSDArray pArray)
247 {
248 this.Clear();
249
250 if (pArray.Count >= 1)
251 {
252 m_defaultAnimation = new OpenSim.Framework.Animation((OSDMap)pArray[0]);
253 }
254 if (pArray.Count >= 2)
255 {
256 m_implicitDefaultAnimation = new OpenSim.Framework.Animation((OSDMap)pArray[1]);
257 }
258 for (int ii = 2; ii < pArray.Count; ii++)
259 {
260 m_animations.Add(new OpenSim.Framework.Animation((OSDMap)pArray[ii]));
261 }
262 }
263
264 // Compare two AnimationSets and return 'true' if the default animations are the same
265 // and all of the animations in the list are equal.
266 public override bool Equals(object obj)
267 {
268 AnimationSet other = obj as AnimationSet;
269 if (other != null)
270 {
271 if (this.DefaultAnimation.Equals(other.DefaultAnimation)
272 && this.ImplicitDefaultAnimation.Equals(other.ImplicitDefaultAnimation))
273 {
274 // The defaults are the same. Is the list of animations the same?
275 OpenSim.Framework.Animation[] thisAnims = this.ToArray();
276 OpenSim.Framework.Animation[] otherAnims = other.ToArray();
277 if (thisAnims.Length == 0 && otherAnims.Length == 0)
278 return true; // the common case
279 if (thisAnims.Length == otherAnims.Length)
280 {
281 // Do this the hard way but since the list is usually short this won't take long.
282 foreach (OpenSim.Framework.Animation thisAnim in thisAnims)
283 {
284 bool found = false;
285 foreach (OpenSim.Framework.Animation otherAnim in otherAnims)
286 {
287 if (thisAnim.Equals(otherAnim))
288 {
289 found = true;
290 break;
291 }
292 }
293 if (!found)
294 {
295 // If anything is not in the other list, these are not equal
296 return false;
297 }
298 }
299 // Found everything in the other list. Since lists are equal length, they must be equal.
300 return true;
301 }
302 }
303 return false;
304 }
305 // Don't know what was passed, but the base system will figure it out for me.
306 return base.Equals(obj);
307 }
308
309 public override string ToString()
310 {
311 StringBuilder buff = new StringBuilder();
312 buff.Append("dflt=");
313 buff.Append(DefaultAnimation.ToString());
314 buff.Append(",iDflt=");
315 if (DefaultAnimation == ImplicitDefaultAnimation)
316 buff.Append("same");
317 else
318 buff.Append(ImplicitDefaultAnimation.ToString());
319 if (m_animations.Count > 0)
320 {
321 buff.Append(",anims=");
322 foreach (OpenSim.Framework.Animation anim in m_animations)
323 {
324 buff.Append("<");
325 buff.Append(anim.ToString());
326 buff.Append(">,");
327 }
328 }
329 return buff.ToString();
330 }
221 } 331 }
222} 332}
diff --git a/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs
index c2b0468..b79dd8f 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs
@@ -104,5 +104,31 @@ namespace OpenSim.Region.Framework.Scenes.Animation
104 104
105 return UUID.Zero; 105 return UUID.Zero;
106 } 106 }
107
108 /// <summary>
109 /// Get the name of the animation given a UUID. If there is no matching animation
110 /// return the UUID as a string.
111 /// </summary>
112 public static string GetDefaultAnimationName(UUID uuid)
113 {
114 string ret = "unknown";
115 if (AnimsUUID.ContainsValue(uuid))
116 {
117 foreach (KeyValuePair<string, UUID> kvp in AnimsUUID)
118 {
119 if (kvp.Value == uuid)
120 {
121 ret = kvp.Key;
122 break;
123 }
124 }
125 }
126 else
127 {
128 ret = uuid.ToString();
129 }
130
131 return ret;
132 }
107 } 133 }
108} \ No newline at end of file 134} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 65c279e..eb70eee 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -93,7 +93,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
93 GetAnimName(animID), animID, m_scenePresence.Name); 93 GetAnimName(animID), animID, m_scenePresence.Name);
94 94
95 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) 95 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
96 {
96 SendAnimPack(); 97 SendAnimPack();
98 }
97 } 99 }
98 100
99 // Called from scripts 101 // Called from scripts
@@ -132,7 +134,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
132 GetAnimName(animID), animID, m_scenePresence.Name); 134 GetAnimName(animID), animID, m_scenePresence.Name);
133 135
134 if (m_animations.Remove(animID, allowNoDefault)) 136 if (m_animations.Remove(animID, allowNoDefault))
137 {
135 SendAnimPack(); 138 SendAnimPack();
139 }
136 } 140 }
137 141
138 public void avnChangeAnim(UUID animID, bool addRemove, bool sendPack) 142 public void avnChangeAnim(UUID animID, bool addRemove, bool sendPack)
@@ -180,8 +184,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
180 /// The movement animation is reserved for "main" animations 184 /// The movement animation is reserved for "main" animations
181 /// that are mutually exclusive, e.g. flying and sitting. 185 /// that are mutually exclusive, e.g. flying and sitting.
182 /// </summary> 186 /// </summary>
183 public void TrySetMovementAnimation(string anim) 187 /// <returns>'true' if the animation was updated</returns>
188 public bool TrySetMovementAnimation(string anim)
184 { 189 {
190 bool ret = false;
185 if (!m_scenePresence.IsChildAgent) 191 if (!m_scenePresence.IsChildAgent)
186 { 192 {
187// m_log.DebugFormat( 193// m_log.DebugFormat(
@@ -198,6 +204,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
198 // 16384 is CHANGED_ANIMATION 204 // 16384 is CHANGED_ANIMATION
199 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); 205 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION});
200 SendAnimPack(); 206 SendAnimPack();
207 ret = true;
201 } 208 }
202 } 209 }
203 else 210 else
@@ -206,6 +213,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
206 "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", 213 "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}",
207 anim, m_scenePresence.Name); 214 anim, m_scenePresence.Name);
208 } 215 }
216 return ret;
209 } 217 }
210 218
211 /// <summary> 219 /// <summary>
@@ -439,8 +447,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
439 /// <summary> 447 /// <summary>
440 /// Update the movement animation of this avatar according to its current state 448 /// Update the movement animation of this avatar according to its current state
441 /// </summary> 449 /// </summary>
442 public void UpdateMovementAnimations() 450 /// <returns>'true' if the animation was changed</returns>
451 public bool UpdateMovementAnimations()
443 { 452 {
453 bool ret = false;
444 lock (m_animations) 454 lock (m_animations)
445 { 455 {
446 string newMovementAnimation = DetermineMovementAnimation(); 456 string newMovementAnimation = DetermineMovementAnimation();
@@ -454,9 +464,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
454 464
455 // Only set it if it's actually changed, give a script 465 // Only set it if it's actually changed, give a script
456 // a chance to stop a default animation 466 // a chance to stop a default animation
457 TrySetMovementAnimation(CurrentMovementAnimation); 467 ret = TrySetMovementAnimation(CurrentMovementAnimation);
458 } 468 }
459 } 469 }
470 return ret;
460 } 471 }
461 472
462 public UUID[] GetAnimationArray() 473 public UUID[] GetAnimationArray()
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index f555b49..11a0146 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -104,14 +104,8 @@ namespace OpenSim.Region.Framework.Scenes
104 // better than losing the object for now. 104 // better than losing the object for now.
105 if (permissionToDelete) 105 if (permissionToDelete)
106 { 106 {
107 List<uint> killIDs = new List<uint>();
108
109 foreach (SceneObjectGroup g in objectGroups) 107 foreach (SceneObjectGroup g in objectGroups)
110 { killIDs.Add(g.LocalId); 108 g.DeleteGroupFromScene(false);
111 g.DeleteGroupFromScene(true);
112 }
113
114 m_scene.SendKillObject(killIDs);
115 } 109 }
116 } 110 }
117 111
@@ -160,7 +154,7 @@ namespace OpenSim.Region.Framework.Scenes
160 if (x.permissionToDelete) 154 if (x.permissionToDelete)
161 { 155 {
162 foreach (SceneObjectGroup g in x.objectGroups) 156 foreach (SceneObjectGroup g in x.objectGroups)
163 m_scene.DeleteSceneObject(g, false); 157 m_scene.DeleteSceneObject(g, true);
164 } 158 }
165 } 159 }
166 catch (Exception e) 160 catch (Exception e)
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 4733547..4fec44f 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -974,6 +974,8 @@ namespace OpenSim.Region.Framework.Scenes
974 public delegate void RegionStarted(Scene scene); 974 public delegate void RegionStarted(Scene scene);
975 public event RegionStarted OnRegionStarted; 975 public event RegionStarted OnRegionStarted;
976 976
977 public delegate void RegionHeartbeatStart(Scene scene);
978 public event RegionHeartbeatStart OnRegionHeartbeatStart;
977 public delegate void RegionHeartbeatEnd(Scene scene); 979 public delegate void RegionHeartbeatEnd(Scene scene);
978 public event RegionHeartbeatEnd OnRegionHeartbeatEnd; 980 public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
979 981
@@ -3096,6 +3098,27 @@ namespace OpenSim.Region.Framework.Scenes
3096 } 3098 }
3097 } 3099 }
3098 3100
3101 public void TriggerRegionHeartbeatStart(Scene scene)
3102 {
3103 RegionHeartbeatStart handler = OnRegionHeartbeatStart;
3104
3105 if (handler != null)
3106 {
3107 foreach (RegionHeartbeatStart d in handler.GetInvocationList())
3108 {
3109 try
3110 {
3111 d(scene);
3112 }
3113 catch (Exception e)
3114 {
3115 m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionHeartbeatStart failed - continuing {0} - {1}",
3116 e.Message, e.StackTrace);
3117 }
3118 }
3119 }
3120 }
3121
3099 public void TriggerRegionHeartbeatEnd(Scene scene) 3122 public void TriggerRegionHeartbeatEnd(Scene scene)
3100 { 3123 {
3101 RegionHeartbeatEnd handler = OnRegionHeartbeatEnd; 3124 RegionHeartbeatEnd handler = OnRegionHeartbeatEnd;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index d2e41f8..70018c8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -417,13 +417,13 @@ namespace OpenSim.Region.Framework.Scenes
417 // is not allowed to change the export flag. 417 // is not allowed to change the export flag.
418 bool denyExportChange = false; 418 bool denyExportChange = false;
419 419
420 m_log.InfoFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions); 420// m_log.DebugFormat("[XXX]: B: {0} O: {1} E: {2}", itemUpd.BasePermissions, itemUpd.CurrentPermissions, itemUpd.EveryOnePermissions);
421 421
422 // If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export 422 // If the user is not the creator or doesn't have "E" in both "B" and "O", deny setting export
423 if ((item.BasePermissions & (uint)(PermissionMask.All | PermissionMask.Export)) != (uint)(PermissionMask.All | PermissionMask.Export) || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0 || item.CreatorIdAsUuid != item.Owner) 423 if ((item.BasePermissions & (uint)(PermissionMask.All | PermissionMask.Export)) != (uint)(PermissionMask.All | PermissionMask.Export) || (item.CurrentPermissions & (uint)PermissionMask.Export) == 0 || item.CreatorIdAsUuid != item.Owner)
424 denyExportChange = true; 424 denyExportChange = true;
425 425
426 m_log.InfoFormat("[XXX]: Deny Export Update {0}", denyExportChange); 426// m_log.DebugFormat("[XXX]: Deny Export Update {0}", denyExportChange);
427 427
428 // If it is already set, force it set and also force full perm 428 // If it is already set, force it set and also force full perm
429 // else prevent setting it. It can and should never be set unless 429 // else prevent setting it. It can and should never be set unless
@@ -447,7 +447,7 @@ namespace OpenSim.Region.Framework.Scenes
447 // If the new state is exportable, force full perm 447 // If the new state is exportable, force full perm
448 if ((itemUpd.EveryOnePermissions & (uint)PermissionMask.Export) != 0) 448 if ((itemUpd.EveryOnePermissions & (uint)PermissionMask.Export) != 0)
449 { 449 {
450 m_log.InfoFormat("[XXX]: Force full perm"); 450// m_log.DebugFormat("[XXX]: Force full perm");
451 itemUpd.NextPermissions = (uint)(PermissionMask.All); 451 itemUpd.NextPermissions = (uint)(PermissionMask.All);
452 } 452 }
453 } 453 }
@@ -485,7 +485,10 @@ namespace OpenSim.Region.Framework.Scenes
485 item.SaleType = itemUpd.SaleType; 485 item.SaleType = itemUpd.SaleType;
486 486
487 InventoryService.UpdateItem(item); 487 InventoryService.UpdateItem(item);
488 remoteClient.SendBulkUpdateInventory(item); 488
489 // We cannot send out a bulk update here, since this will cause editing of clothing to start
490 // failing frequently. Possibly this is a race with a separate transaction that uploads the asset.
491// remoteClient.SendBulkUpdateInventory(item);
489 } 492 }
490 493
491 if (UUID.Zero != transactionID) 494 if (UUID.Zero != transactionID)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2b58795..436a544 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -396,10 +396,12 @@ namespace OpenSim.Region.Framework.Scenes
396 if (value) 396 if (value)
397 { 397 {
398 if (!m_active) 398 if (!m_active)
399 Start(); 399 Start(false);
400 } 400 }
401 else 401 else
402 { 402 {
403 // This appears assymetric with Start() above but is not - setting m_active = false stops the loops
404 // XXX: Possibly this should be in an explicit Stop() method for symmetry.
403 m_active = false; 405 m_active = false;
404 } 406 }
405 } 407 }
@@ -1361,10 +1363,18 @@ namespace OpenSim.Region.Framework.Scenes
1361 } 1363 }
1362 } 1364 }
1363 1365
1366 public override void Start()
1367 {
1368 Start(true);
1369 }
1370
1364 /// <summary> 1371 /// <summary>
1365 /// Start the scene 1372 /// Start the scene
1366 /// </summary> 1373 /// </summary>
1367 public void Start() 1374 /// <param name='startScripts'>
1375 /// Start the scripts within the scene.
1376 /// </param>
1377 public void Start(bool startScripts)
1368 { 1378 {
1369 m_active = true; 1379 m_active = true;
1370 1380
@@ -1401,6 +1411,8 @@ namespace OpenSim.Region.Framework.Scenes
1401 m_heartbeatThread 1411 m_heartbeatThread
1402 = Watchdog.StartThread( 1412 = Watchdog.StartThread(
1403 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); 1413 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
1414
1415 StartScripts();
1404 } 1416 }
1405 1417
1406 /// <summary> 1418 /// <summary>
@@ -1557,6 +1569,8 @@ namespace OpenSim.Region.Framework.Scenes
1557 1569
1558 try 1570 try
1559 { 1571 {
1572 EventManager.TriggerRegionHeartbeatStart(this);
1573
1560 // Apply taints in terrain module to terrain in physics scene 1574 // Apply taints in terrain module to terrain in physics scene
1561 if (Frame % m_update_terrain == 0) 1575 if (Frame % m_update_terrain == 0)
1562 { 1576 {
@@ -3001,7 +3015,9 @@ namespace OpenSim.Region.Framework.Scenes
3001 // client is for a root or child agent. 3015 // client is for a root or child agent.
3002 client.SceneAgent = sp; 3016 client.SceneAgent = sp;
3003 3017
3004 // Cache the user's name 3018 // This is currently also being done earlier in NewUserConnection for real users to see if this
3019 // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other
3020 // places. However, we still need to do it here for NPCs.
3005 CacheUserName(sp, aCircuit); 3021 CacheUserName(sp, aCircuit);
3006 3022
3007 EventManager.TriggerOnNewClient(client); 3023 EventManager.TriggerOnNewClient(client);
@@ -3025,7 +3041,7 @@ namespace OpenSim.Region.Framework.Scenes
3025 { 3041 {
3026 string first = aCircuit.firstname, last = aCircuit.lastname; 3042 string first = aCircuit.firstname, last = aCircuit.lastname;
3027 3043
3028 if (sp.PresenceType == PresenceType.Npc) 3044 if (sp != null && sp.PresenceType == PresenceType.Npc)
3029 { 3045 {
3030 UserManagementModule.AddUser(aCircuit.AgentID, first, last); 3046 UserManagementModule.AddUser(aCircuit.AgentID, first, last);
3031 } 3047 }
@@ -3242,7 +3258,6 @@ namespace OpenSim.Region.Framework.Scenes
3242 { 3258 {
3243 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest; 3259 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
3244 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 3260 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
3245 client.OnSetStartLocationRequest += SetHomeRezPoint;
3246 client.OnRegionHandleRequest += RegionHandleRequest; 3261 client.OnRegionHandleRequest += RegionHandleRequest;
3247 } 3262 }
3248 3263
@@ -3369,7 +3384,6 @@ namespace OpenSim.Region.Framework.Scenes
3369 { 3384 {
3370 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; 3385 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
3371 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; 3386 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
3372 client.OnSetStartLocationRequest -= SetHomeRezPoint;
3373 client.OnRegionHandleRequest -= RegionHandleRequest; 3387 client.OnRegionHandleRequest -= RegionHandleRequest;
3374 } 3388 }
3375 3389
@@ -3496,33 +3510,6 @@ namespace OpenSim.Region.Framework.Scenes
3496 } 3510 }
3497 3511
3498 /// <summary> 3512 /// <summary>
3499 /// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in
3500 /// </summary>
3501 /// <param name="remoteClient"></param>
3502 /// <param name="regionHandle"></param>
3503 /// <param name="position"></param>
3504 /// <param name="lookAt"></param>
3505 /// <param name="flags"></param>
3506 public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
3507 {
3508 //Add half the avatar's height so that the user doesn't fall through prims
3509 ScenePresence presence;
3510 if (TryGetScenePresence(remoteClient.AgentId, out presence))
3511 {
3512 if (presence.Appearance != null)
3513 {
3514 position.Z = position.Z + (presence.Appearance.AvatarHeight / 2);
3515 }
3516 }
3517
3518 if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt))
3519 // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
3520 m_dialogModule.SendAlertToUser(remoteClient, "Home position set.");
3521 else
3522 m_dialogModule.SendAlertToUser(remoteClient, "Set Home request Failed.");
3523 }
3524
3525 /// <summary>
3526 /// Get the avatar apperance for the given client. 3513 /// Get the avatar apperance for the given client.
3527 /// </summary> 3514 /// </summary>
3528 /// <param name="client"></param> 3515 /// <param name="client"></param>
@@ -3618,15 +3605,12 @@ namespace OpenSim.Region.Framework.Scenes
3618 if (closeChildAgents && CapsModule != null) 3605 if (closeChildAgents && CapsModule != null)
3619 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); 3606 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode);
3620 3607
3621// // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3622// // this method is doing is HORRIBLE!!!
3623 // Commented pending deletion since this method no longer appears to do anything at all
3624// avatar.Scene.NeedSceneCacheClear(avatar.UUID);
3625
3626 if (closeChildAgents && !isChildAgent) 3608 if (closeChildAgents && !isChildAgent)
3627 { 3609 {
3628 List<ulong> regions = avatar.KnownRegionHandles; 3610 List<ulong> regions = avatar.KnownRegionHandles;
3629 regions.Remove(RegionInfo.RegionHandle); 3611 regions.Remove(RegionInfo.RegionHandle);
3612
3613 // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours.
3630 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); 3614 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
3631 } 3615 }
3632 3616
@@ -3644,7 +3628,7 @@ namespace OpenSim.Region.Framework.Scenes
3644 delegate(IClientAPI client) 3628 delegate(IClientAPI client)
3645 { 3629 {
3646 //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway 3630 //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway
3647 try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); } 3631 try { client.SendKillObject(new List<uint> { avatar.LocalId }); }
3648 catch (NullReferenceException) { } 3632 catch (NullReferenceException) { }
3649 }); 3633 });
3650 } 3634 }
@@ -3725,7 +3709,8 @@ namespace OpenSim.Region.Framework.Scenes
3725 } 3709 }
3726 deleteIDs.Add(localID); 3710 deleteIDs.Add(localID);
3727 } 3711 }
3728 ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, deleteIDs); }); 3712
3713 ForEachClient(c => c.SendKillObject(deleteIDs));
3729 } 3714 }
3730 3715
3731 #endregion 3716 #endregion
@@ -3881,7 +3866,13 @@ namespace OpenSim.Region.Framework.Scenes
3881 3866
3882 lock (agent) 3867 lock (agent)
3883 { 3868 {
3884 //On login test land permisions 3869 // Optimistic: add or update the circuit data with the new agent circuit data and teleport flags.
3870 // We need the circuit data here for some of the subsequent checks. (groups, for example)
3871 // If the checks fail, we remove the circuit.
3872 agent.teleportFlags = teleportFlags;
3873 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
3874
3875 // On login test land permisions
3885 if (vialogin) 3876 if (vialogin)
3886 { 3877 {
3887 IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); 3878 IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>();
@@ -3890,6 +3881,7 @@ namespace OpenSim.Region.Framework.Scenes
3890 if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) 3881 if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y))
3891 { 3882 {
3892 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); 3883 m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString());
3884 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3893 return false; 3885 return false;
3894 } 3886 }
3895 } 3887 }
@@ -3901,11 +3893,17 @@ namespace OpenSim.Region.Framework.Scenes
3901 try 3893 try
3902 { 3894 {
3903 if (!VerifyUserPresence(agent, out reason)) 3895 if (!VerifyUserPresence(agent, out reason))
3896 {
3897 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3904 return false; 3898 return false;
3905 } catch (Exception e) 3899 }
3900 }
3901 catch (Exception e)
3906 { 3902 {
3907 m_log.ErrorFormat( 3903 m_log.ErrorFormat(
3908 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); 3904 "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace);
3905
3906 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3909 return false; 3907 return false;
3910 } 3908 }
3911 } 3909 }
@@ -3918,6 +3916,7 @@ namespace OpenSim.Region.Framework.Scenes
3918 { 3916 {
3919 if (!AuthorizeUser(agent, out reason)) 3917 if (!AuthorizeUser(agent, out reason))
3920 { 3918 {
3919 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3921 return false; 3920 return false;
3922 } 3921 }
3923 } 3922 }
@@ -3926,6 +3925,8 @@ namespace OpenSim.Region.Framework.Scenes
3926 { 3925 {
3927 m_log.ErrorFormat( 3926 m_log.ErrorFormat(
3928 "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); 3927 "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace);
3928
3929 m_authenticateHandler.RemoveCircuit(agent.circuitcode);
3929 return false; 3930 return false;
3930 } 3931 }
3931 3932
@@ -3953,11 +3954,12 @@ namespace OpenSim.Region.Framework.Scenes
3953 CapsModule.SetAgentCapsSeeds(agent); 3954 CapsModule.SetAgentCapsSeeds(agent);
3954 } 3955 }
3955 } 3956 }
3956 }
3957 3957
3958 // In all cases, add or update the circuit data with the new agent circuit data and teleport flags 3958 // Try caching an incoming user name much earlier on to see if this helps with an issue
3959 agent.teleportFlags = teleportFlags; 3959 // where HG users are occasionally seen by others as "Unknown User" because their UUIDName
3960 m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); 3960 // request for the HG avatar appears to trigger before the user name is cached.
3961 CacheUserName(null, agent);
3962 }
3961 3963
3962 if (CapsModule != null) 3964 if (CapsModule != null)
3963 { 3965 {
@@ -4365,8 +4367,6 @@ namespace OpenSim.Region.Framework.Scenes
4365 m_log.DebugFormat( 4367 m_log.DebugFormat(
4366 "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); 4368 "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
4367 4369
4368 // XPTO: if this agent is not allowed here as root, always return false
4369
4370 // We have to wait until the viewer contacts this region after receiving EAC. 4370 // We have to wait until the viewer contacts this region after receiving EAC.
4371 // That calls AddNewClient, which finally creates the ScenePresence 4371 // That calls AddNewClient, which finally creates the ScenePresence
4372 int flags = GetUserFlags(cAgentData.AgentID); 4372 int flags = GetUserFlags(cAgentData.AgentID);
@@ -5655,12 +5655,12 @@ Environment.Exit(1);
5655 List<SceneObjectGroup> objects, 5655 List<SceneObjectGroup> objects,
5656 out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ) 5656 out float minX, out float maxX, out float minY, out float maxY, out float minZ, out float maxZ)
5657 { 5657 {
5658 minX = 256; 5658 minX = float.MaxValue;
5659 maxX = -256; 5659 maxX = float.MinValue;
5660 minY = 256; 5660 minY = float.MaxValue;
5661 maxY = -256; 5661 maxY = float.MinValue;
5662 minZ = 8192; 5662 minZ = float.MaxValue;
5663 maxZ = -256; 5663 maxZ = float.MinValue;
5664 5664
5665 List<Vector3> offsets = new List<Vector3>(); 5665 List<Vector3> offsets = new List<Vector3>();
5666 5666
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 74c9582..4eef162 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -562,6 +562,10 @@ namespace OpenSim.Region.Framework.Scenes
562 get { return false; } 562 get { return false; }
563 } 563 }
564 564
565 public virtual void Start()
566 {
567 }
568
565 public void Restart() 569 public void Restart()
566 { 570 {
567 // This has to be here to fire the event 571 // This has to be here to fire the event
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 0ea4e09..02a8935 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1862,11 +1862,11 @@ namespace OpenSim.Region.Framework.Scenes
1862 /// <summary> 1862 /// <summary>
1863 /// Delete this group from its scene. 1863 /// Delete this group from its scene.
1864 /// </summary> 1864 /// </summary>
1865 /// 1865 /// <remarks>
1866 /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood 1866 /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood
1867 /// up and all avatars receive notification of its removal. Removal of the scene object from database backup 1867 /// up and all avatars receive notification of its removal. Removal of the scene object from database backup
1868 /// must be handled by the caller. 1868 /// must be handled by the caller.
1869 /// 1869 /// </remarks>
1870 /// <param name="silent">If true then deletion is not broadcast to clients</param> 1870 /// <param name="silent">If true then deletion is not broadcast to clients</param>
1871 public void DeleteGroupFromScene(bool silent) 1871 public void DeleteGroupFromScene(bool silent)
1872 { 1872 {
@@ -1880,10 +1880,10 @@ namespace OpenSim.Region.Framework.Scenes
1880 { 1880 {
1881 SceneObjectPart part = parts[i]; 1881 SceneObjectPart part = parts[i];
1882 1882
1883 Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) 1883 Scene.ForEachScenePresence(sp =>
1884 { 1884 {
1885 if (avatar.ParentID == LocalId) 1885 if (!sp.IsChildAgent && sp.ParentID == LocalId)
1886 avatar.StandUp(); 1886 sp.StandUp();
1887 1887
1888 if (!silent) 1888 if (!silent)
1889 { 1889 {
@@ -1891,9 +1891,9 @@ namespace OpenSim.Region.Framework.Scenes
1891 if (part == m_rootPart) 1891 if (part == m_rootPart)
1892 { 1892 {
1893 if (!IsAttachment 1893 if (!IsAttachment
1894 || AttachedAvatar == avatar.ControllingClient.AgentId 1894 || AttachedAvatar == sp.UUID
1895 || !HasPrivateAttachmentPoint) 1895 || !HasPrivateAttachmentPoint)
1896 avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId }); 1896 sp.ControllingClient.SendKillObject(new List<uint> { part.LocalId });
1897 } 1897 }
1898 } 1898 }
1899 }); 1899 });
@@ -2202,7 +2202,7 @@ namespace OpenSim.Region.Framework.Scenes
2202 if (!userExposed) 2202 if (!userExposed)
2203 dupe.IsAttachment = true; 2203 dupe.IsAttachment = true;
2204 2204
2205 dupe.AbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 2205 dupe.m_sittingAvatars = new List<UUID>();
2206 2206
2207 if (!userExposed) 2207 if (!userExposed)
2208 { 2208 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 261e958..8c6450d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -231,6 +231,13 @@ namespace OpenSim.Region.Framework.Scenes
231 231
232 public double SoundRadius; 232 public double SoundRadius;
233 233
234 /// <summary>
235 /// Should sounds played from this prim be queued?
236 /// </summary>
237 /// <remarks>
238 /// This should only be changed by sound modules. It is up to sound modules as to how they interpret this setting.
239 /// </remarks>
240 public bool SoundQueueing { get; set; }
234 241
235 public uint TimeStampFull; 242 public uint TimeStampFull;
236 243
@@ -1218,23 +1225,14 @@ namespace OpenSim.Region.Framework.Scenes
1218 // the mappings more consistant. 1225 // the mappings more consistant.
1219 public Vector3 SitTargetPositionLL 1226 public Vector3 SitTargetPositionLL
1220 { 1227 {
1221 get { return new Vector3(m_sitTargetPosition.X, m_sitTargetPosition.Y,m_sitTargetPosition.Z); } 1228 get { return m_sitTargetPosition; }
1222 set { m_sitTargetPosition = value; } 1229 set { m_sitTargetPosition = value; }
1223 } 1230 }
1224 1231
1225 public Quaternion SitTargetOrientationLL 1232 public Quaternion SitTargetOrientationLL
1226 { 1233 {
1227 get 1234 get { return m_sitTargetOrientation; }
1228 { 1235 set { m_sitTargetOrientation = value; }
1229 return new Quaternion(
1230 m_sitTargetOrientation.X,
1231 m_sitTargetOrientation.Y,
1232 m_sitTargetOrientation.Z,
1233 m_sitTargetOrientation.W
1234 );
1235 }
1236
1237 set { m_sitTargetOrientation = new Quaternion(value.X, value.Y, value.Z, value.W); }
1238 } 1236 }
1239 1237
1240 public bool Stopped 1238 public bool Stopped
@@ -4350,30 +4348,31 @@ namespace OpenSim.Region.Framework.Scenes
4350 } 4348 }
4351 } 4349 }
4352 4350
4353 public void UpdateGroupPosition(Vector3 pos) 4351 public void UpdateGroupPosition(Vector3 newPos)
4354 { 4352 {
4355 if ((pos.X != GroupPosition.X) || 4353 Vector3 oldPos = GroupPosition;
4356 (pos.Y != GroupPosition.Y) || 4354
4357 (pos.Z != GroupPosition.Z)) 4355 if ((newPos.X != oldPos.X) ||
4356 (newPos.Y != oldPos.Y) ||
4357 (newPos.Z != oldPos.Z))
4358 { 4358 {
4359 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
4360 GroupPosition = newPos; 4359 GroupPosition = newPos;
4361 ScheduleTerseUpdate(); 4360 ScheduleTerseUpdate();
4362 } 4361 }
4363 } 4362 }
4364 4363
4365 /// <summary> 4364 /// <summary>
4366 /// 4365 /// Update this part's offset position.
4367 /// </summary> 4366 /// </summary>
4368 /// <param name="pos"></param> 4367 /// <param name="pos"></param>
4369 public void UpdateOffSet(Vector3 pos) 4368 public void UpdateOffSet(Vector3 newPos)
4370 { 4369 {
4371 if ((pos.X != OffsetPosition.X) || 4370 Vector3 oldPos = OffsetPosition;
4372 (pos.Y != OffsetPosition.Y) ||
4373 (pos.Z != OffsetPosition.Z))
4374 {
4375 Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
4376 4371
4372 if ((newPos.X != oldPos.X) ||
4373 (newPos.Y != oldPos.Y) ||
4374 (newPos.Z != oldPos.Z))
4375 {
4377 if (ParentGroup.RootPart.GetStatusSandbox()) 4376 if (ParentGroup.RootPart.GetStatusSandbox())
4378 { 4377 {
4379 if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10) 4378 if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
@@ -5014,6 +5013,14 @@ namespace OpenSim.Region.Framework.Scenes
5014 oldTex.DefaultTexture = fallbackOldFace; 5013 oldTex.DefaultTexture = fallbackOldFace;
5015 } 5014 }
5016 5015
5016 // Materials capable viewers can send a ObjectImage packet
5017 // when nothing in TE has changed. MaterialID should be updated
5018 // by the RenderMaterials CAP handler, so updating it here may cause a
5019 // race condtion. Therefore, if no non-materials TE fields have changed,
5020 // we should ignore any changes and not update Shape.TextureEntry
5021
5022 bool otherFieldsChanged = false;
5023
5017 for (int i = 0 ; i < GetNumberOfSides(); i++) 5024 for (int i = 0 ; i < GetNumberOfSides(); i++)
5018 { 5025 {
5019 5026
@@ -5040,18 +5047,36 @@ namespace OpenSim.Region.Framework.Scenes
5040 // Max change, skip the rest of testing 5047 // Max change, skip the rest of testing
5041 if (changeFlags == (Changed.TEXTURE | Changed.COLOR)) 5048 if (changeFlags == (Changed.TEXTURE | Changed.COLOR))
5042 break; 5049 break;
5050
5051 if (!otherFieldsChanged)
5052 {
5053 if (oldFace.Bump != newFace.Bump) otherFieldsChanged = true;
5054 if (oldFace.Fullbright != newFace.Fullbright) otherFieldsChanged = true;
5055 if (oldFace.Glow != newFace.Glow) otherFieldsChanged = true;
5056 if (oldFace.MediaFlags != newFace.MediaFlags) otherFieldsChanged = true;
5057 if (oldFace.OffsetU != newFace.OffsetU) otherFieldsChanged = true;
5058 if (oldFace.OffsetV != newFace.OffsetV) otherFieldsChanged = true;
5059 if (oldFace.RepeatU != newFace.RepeatU) otherFieldsChanged = true;
5060 if (oldFace.RepeatV != newFace.RepeatV) otherFieldsChanged = true;
5061 if (oldFace.Rotation != newFace.Rotation) otherFieldsChanged = true;
5062 if (oldFace.Shiny != newFace.Shiny) otherFieldsChanged = true;
5063 if (oldFace.TexMapType != newFace.TexMapType) otherFieldsChanged = true;
5064 }
5043 } 5065 }
5044 5066
5045 m_shape.TextureEntry = newTex.GetBytes(); 5067 if (changeFlags != 0 || otherFieldsChanged)
5046 if (changeFlags != 0) 5068 {
5047 TriggerScriptChangedEvent(changeFlags); 5069 m_shape.TextureEntry = newTex.GetBytes();
5048 UpdateFlag = UpdateRequired.FULL; 5070 if (changeFlags != 0)
5049 ParentGroup.HasGroupChanged = true; 5071 TriggerScriptChangedEvent(changeFlags);
5072 UpdateFlag = UpdateRequired.FULL;
5073 ParentGroup.HasGroupChanged = true;
5050 5074
5051 //This is madness.. 5075 //This is madness..
5052 //ParentGroup.ScheduleGroupForFullUpdate(); 5076 //ParentGroup.ScheduleGroupForFullUpdate();
5053 //This is sparta 5077 //This is sparta
5054 ScheduleFullUpdate(); 5078 ScheduleFullUpdate();
5079 }
5055 } 5080 }
5056 5081
5057 5082
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0ab267a..1859cb1 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1550,6 +1550,8 @@ namespace OpenSim.Region.Framework.Scenes
1550 // Create child agents in neighbouring regions 1550 // Create child agents in neighbouring regions
1551 if (openChildAgents && !IsChildAgent) 1551 if (openChildAgents && !IsChildAgent)
1552 { 1552 {
1553 // Remember in HandleUseCircuitCode, we delayed this to here
1554 SendInitialDataToMe();
1553 1555
1554 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1556 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1555 if (m_agentTransfer != null) 1557 if (m_agentTransfer != null)
@@ -2308,6 +2310,7 @@ namespace OpenSim.Region.Framework.Scenes
2308 AddToPhysicalScene(false); 2310 AddToPhysicalScene(false);
2309 2311
2310 Animator.TrySetMovementAnimation("STAND"); 2312 Animator.TrySetMovementAnimation("STAND");
2313 TriggerScenePresenceUpdated();
2311 } 2314 }
2312 2315
2313 private SceneObjectPart FindNextAvailableSitTarget(UUID targetID) 2316 private SceneObjectPart FindNextAvailableSitTarget(UUID targetID)
@@ -2406,7 +2409,7 @@ namespace OpenSim.Region.Framework.Scenes
2406 ControllingClient.SendSitResponse( 2409 ControllingClient.SendSitResponse(
2407 part.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); 2410 part.UUID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
2408 2411
2409 m_requestedSitTargetUUID = targetID; 2412 m_requestedSitTargetUUID = part.UUID;
2410 2413
2411 HandleAgentSit(ControllingClient, UUID); 2414 HandleAgentSit(ControllingClient, UUID);
2412 2415
@@ -2434,7 +2437,7 @@ namespace OpenSim.Region.Framework.Scenes
2434 if (part != null) 2437 if (part != null)
2435 { 2438 {
2436 m_requestedSitTargetID = part.LocalId; 2439 m_requestedSitTargetID = part.LocalId;
2437 m_requestedSitTargetUUID = targetID; 2440 m_requestedSitTargetUUID = part.UUID;
2438 2441
2439 } 2442 }
2440 else 2443 else
@@ -2633,6 +2636,7 @@ namespace OpenSim.Region.Framework.Scenes
2633 } 2636 }
2634 Animator.TrySetMovementAnimation(sitAnimation); 2637 Animator.TrySetMovementAnimation(sitAnimation);
2635 SendAvatarDataToAllAgents(); 2638 SendAvatarDataToAllAgents();
2639 TriggerScenePresenceUpdated();
2636 } 2640 }
2637 } 2641 }
2638 2642
@@ -2641,6 +2645,7 @@ namespace OpenSim.Region.Framework.Scenes
2641// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. 2645// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick..
2642 m_AngularVelocity = Vector3.Zero; 2646 m_AngularVelocity = Vector3.Zero;
2643 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); 2647 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
2648 TriggerScenePresenceUpdated();
2644 SitGround = true; 2649 SitGround = true;
2645 RemoveFromPhysicalScene(); 2650 RemoveFromPhysicalScene();
2646 } 2651 }
@@ -2657,11 +2662,13 @@ namespace OpenSim.Region.Framework.Scenes
2657 public void HandleStartAnim(IClientAPI remoteClient, UUID animID) 2662 public void HandleStartAnim(IClientAPI remoteClient, UUID animID)
2658 { 2663 {
2659 Animator.AddAnimation(animID, UUID.Zero); 2664 Animator.AddAnimation(animID, UUID.Zero);
2665 TriggerScenePresenceUpdated();
2660 } 2666 }
2661 2667
2662 public void HandleStopAnim(IClientAPI remoteClient, UUID animID) 2668 public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
2663 { 2669 {
2664 Animator.RemoveAnimation(animID, false); 2670 Animator.RemoveAnimation(animID, false);
2671 TriggerScenePresenceUpdated();
2665 } 2672 }
2666 2673
2667 public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack) 2674 public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)
@@ -3347,10 +3354,8 @@ namespace OpenSim.Region.Framework.Scenes
3347 if (byebyeRegions.Count > 0) 3354 if (byebyeRegions.Count > 0)
3348 { 3355 {
3349 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); 3356 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents");
3350 Util.FireAndForget(delegate 3357
3351 { 3358 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions);
3352 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions);
3353 });
3354 } 3359 }
3355 3360
3356 foreach (ulong handle in byebyeRegions) 3361 foreach (ulong handle in byebyeRegions)
@@ -3693,7 +3698,8 @@ namespace OpenSim.Region.Framework.Scenes
3693 3698
3694// if (m_updateCount > 0) 3699// if (m_updateCount > 0)
3695// { 3700// {
3696 Animator.UpdateMovementAnimations(); 3701 if (Animator.UpdateMovementAnimations())
3702 TriggerScenePresenceUpdated();
3697// m_updateCount--; 3703// m_updateCount--;
3698// } 3704// }
3699 3705
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 5398ab9..bf32251 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -290,6 +290,9 @@ namespace OpenSim.Region.Framework.Scenes
290 290
291 private void statsHeartBeat(object sender, EventArgs e) 291 private void statsHeartBeat(object sender, EventArgs e)
292 { 292 {
293 if (!m_scene.Active)
294 return;
295
293 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; 296 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23];
294 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); 297 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
295 298
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 52ad538..d670dad 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -33,7 +33,9 @@ using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Framework.EntityTransfer;
36using OpenSim.Region.CoreModules.Framework.InventoryAccess; 37using OpenSim.Region.CoreModules.Framework.InventoryAccess;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
37using OpenSim.Region.CoreModules.World.Permissions; 39using OpenSim.Region.CoreModules.World.Permissions;
38using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
@@ -52,6 +54,24 @@ namespace OpenSim.Region.Framework.Scenes.Tests
52 [TestFixture] 54 [TestFixture]
53 public class SceneObjectDeRezTests : OpenSimTestCase 55 public class SceneObjectDeRezTests : OpenSimTestCase
54 { 56 {
57 [TestFixtureSetUp]
58 public void FixtureInit()
59 {
60 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
61 // This facility was added after the original async delete tests were written, so it may be possible now
62 // to not bother explicitly disabling their async (since everything will be running sync).
63 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
64 }
65
66 [TestFixtureTearDown]
67 public void TearDown()
68 {
69 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
70 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
71 // tests really shouldn't).
72 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
73 }
74
55 /// <summary> 75 /// <summary>
56 /// Test deleting an object from a scene. 76 /// Test deleting an object from a scene.
57 /// </summary> 77 /// </summary>
@@ -59,46 +79,96 @@ namespace OpenSim.Region.Framework.Scenes.Tests
59 public void TestDeRezSceneObject() 79 public void TestDeRezSceneObject()
60 { 80 {
61 TestHelpers.InMethod(); 81 TestHelpers.InMethod();
62// log4net.Config.XmlConfigurator.Configure();
63 82
64 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 83 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
65 84
66 TestScene scene = new SceneHelpers().SetupScene(); 85 TestScene scene = new SceneHelpers().SetupScene();
67 IConfigSource configSource = new IniConfigSource(); 86 SceneHelpers.SetupSceneModules(scene, new PermissionsModule());
68 IConfig config = configSource.AddConfig("Startup"); 87 TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
69 config.Set("serverside_object_permissions", true);
70 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
71 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
72 88
73 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 89 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
74 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; 90 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
75 sogd.Enabled = false; 91 sogd.Enabled = false;
76 92
77 SceneObjectPart part 93 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", userId);
78 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); 94 uint soLocalId = so.LocalId;
79 part.Name = "obj1";
80 scene.AddNewSceneObject(new SceneObjectGroup(part), false);
81 95
82 List<uint> localIds = new List<uint>(); 96 List<uint> localIds = new List<uint>();
83 localIds.Add(part.LocalId); 97 localIds.Add(so.LocalId);
84 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); 98 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
85 99
86 // Check that object isn't deleted until we crank the sogd handle. 100 // Check that object isn't deleted until we crank the sogd handle.
87 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 101 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
88 Assert.That(retrievedPart, Is.Not.Null); 102 Assert.That(retrievedPart, Is.Not.Null);
89 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False); 103 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
90 104
91 sogd.InventoryDeQueueAndDelete(); 105 sogd.InventoryDeQueueAndDelete();
92 106
93 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); 107 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
94 Assert.That(retrievedPart2, Is.Null); 108 Assert.That(retrievedPart2, Is.Null);
109
110 Assert.That(client.ReceivedKills.Count, Is.EqualTo(1));
111 Assert.That(client.ReceivedKills[0], Is.EqualTo(soLocalId));
112 }
113
114 /// <summary>
115 /// Test that child and root agents correctly receive KillObject notifications.
116 /// </summary>
117 [Test]
118 public void TestDeRezSceneObjectToAgents()
119 {
120 TestHelpers.InMethod();
121// TestHelpers.EnableLogging();
122
123 SceneHelpers sh = new SceneHelpers();
124 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
125 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);
126
127 // We need this so that the creation of the root client for userB in sceneB can trigger the creation of a child client in sceneA
128 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
129 EntityTransferModule etmB = new EntityTransferModule();
130 IConfigSource config = new IniConfigSource();
131 IConfig modulesConfig = config.AddConfig("Modules");
132 modulesConfig.Set("EntityTransferModule", etmB.Name);
133 modulesConfig.Set("SimulationServices", lscm.Name);
134 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
135 SceneHelpers.SetupSceneModules(sceneB, config, etmB);
136
137 // We need this for derez
138 SceneHelpers.SetupSceneModules(sceneA, new PermissionsModule());
139
140 UserAccount uaA = UserAccountHelpers.CreateUserWithInventory(sceneA, "Andy", "AAA", 0x1, "");
141 UserAccount uaB = UserAccountHelpers.CreateUserWithInventory(sceneA, "Brian", "BBB", 0x2, "");
142
143 TestClient clientA = (TestClient)SceneHelpers.AddScenePresence(sceneA, uaA).ControllingClient;
144
145 // This is the more long-winded route we have to take to get a child client created for userB in sceneA
146 // rather than just calling AddScenePresence() as for userA
147 AgentCircuitData acd = SceneHelpers.GenerateAgentData(uaB);
148 TestClient clientB = new TestClient(acd, sceneB);
149 List<TestClient> childClientsB = new List<TestClient>();
150 EntityTransferHelpers.SetUpInformClientOfNeighbour(clientB, childClientsB);
151
152 SceneHelpers.AddScenePresence(sceneB, clientB, acd);
153
154 SceneObjectGroup so = SceneHelpers.AddSceneObject(sceneA);
155 uint soLocalId = so.LocalId;
156
157 sceneA.DeleteSceneObject(so, false);
158
159 Assert.That(clientA.ReceivedKills.Count, Is.EqualTo(1));
160 Assert.That(clientA.ReceivedKills[0], Is.EqualTo(soLocalId));
161
162 Assert.That(childClientsB[0].ReceivedKills.Count, Is.EqualTo(1));
163 Assert.That(childClientsB[0].ReceivedKills[0], Is.EqualTo(soLocalId));
95 } 164 }
96 165
97 /// <summary> 166 /// <summary>
98 /// Test deleting an object from a scene where the deleter is not the owner 167 /// Test deleting an object from a scene where the deleter is not the owner
99 /// </summary> 168 /// </summary>
100 /// 169 /// <remarks>
101 /// This test assumes that the deleter is not a god. 170 /// This test assumes that the deleter is not a god.
171 /// </remarks>
102 [Test] 172 [Test]
103 public void TestDeRezSceneObjectNotOwner() 173 public void TestDeRezSceneObjectNotOwner()
104 { 174 {
@@ -109,10 +179,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
109 UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); 179 UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001");
110 180
111 TestScene scene = new SceneHelpers().SetupScene(); 181 TestScene scene = new SceneHelpers().SetupScene();
112 IConfigSource configSource = new IniConfigSource(); 182 SceneHelpers.SetupSceneModules(scene, new PermissionsModule());
113 IConfig config = configSource.AddConfig("Startup");
114 config.Set("serverside_object_permissions", true);
115 SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
116 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; 183 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
117 184
118 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 185 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
index 8775949..5a72239 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -95,11 +95,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
95 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); 95 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
96 96
97 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); 97 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
98 TestClient tc = new TestClient(acd, sceneA, sh.SceneManager); 98 TestClient tc = new TestClient(acd, sceneA);
99 List<TestClient> destinationTestClients = new List<TestClient>(); 99 List<TestClient> destinationTestClients = new List<TestClient>();
100 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 100 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients);
101 101
102 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd, sh.SceneManager); 102 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
103 originalSp.AbsolutePosition = new Vector3(128, 32, 10); 103 originalSp.AbsolutePosition = new Vector3(128, 32, 10);
104 104
105// originalSp.Flying = true; 105// originalSp.Flying = true;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index de4458d..297c66b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -139,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
139 Vector3 teleportPosition = new Vector3(10, 11, 12); 139 Vector3 teleportPosition = new Vector3(10, 11, 12);
140 Vector3 teleportLookAt = new Vector3(20, 21, 22); 140 Vector3 teleportLookAt = new Vector3(20, 21, 22);
141 141
142 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); 142 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
143 sp.AbsolutePosition = new Vector3(30, 31, 32); 143 sp.AbsolutePosition = new Vector3(30, 31, 32);
144 144
145 List<TestClient> destinationTestClients = new List<TestClient>(); 145 List<TestClient> destinationTestClients = new List<TestClient>();
@@ -224,7 +224,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
224 Vector3 teleportPosition = new Vector3(10, 11, 12); 224 Vector3 teleportPosition = new Vector3(10, 11, 12);
225 Vector3 teleportLookAt = new Vector3(20, 21, 22); 225 Vector3 teleportLookAt = new Vector3(20, 21, 22);
226 226
227 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); 227 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
228 sp.AbsolutePosition = preTeleportPosition; 228 sp.AbsolutePosition = preTeleportPosition;
229 229
230 // Make sceneB return false on query access 230 // Make sceneB return false on query access
@@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
300 Vector3 teleportPosition = new Vector3(10, 11, 12); 300 Vector3 teleportPosition = new Vector3(10, 11, 12);
301 Vector3 teleportLookAt = new Vector3(20, 21, 22); 301 Vector3 teleportLookAt = new Vector3(20, 21, 22);
302 302
303 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); 303 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
304 sp.AbsolutePosition = preTeleportPosition; 304 sp.AbsolutePosition = preTeleportPosition;
305 305
306 // Make sceneB refuse CreateAgent 306 // Make sceneB refuse CreateAgent
@@ -389,7 +389,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
389 Vector3 teleportPosition = new Vector3(10, 11, 12); 389 Vector3 teleportPosition = new Vector3(10, 11, 12);
390 Vector3 teleportLookAt = new Vector3(20, 21, 22); 390 Vector3 teleportLookAt = new Vector3(20, 21, 22);
391 391
392 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); 392 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
393 sp.AbsolutePosition = preTeleportPosition; 393 sp.AbsolutePosition = preTeleportPosition;
394 394
395 sceneA.RequestTeleportLocation( 395 sceneA.RequestTeleportLocation(
@@ -428,7 +428,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
428 public void TestSameSimulatorNeighbouringRegions() 428 public void TestSameSimulatorNeighbouringRegions()
429 { 429 {
430 TestHelpers.InMethod(); 430 TestHelpers.InMethod();
431 TestHelpers.EnableLogging(); 431// TestHelpers.EnableLogging();
432 432
433 UUID userId = TestHelpers.ParseTail(0x1); 433 UUID userId = TestHelpers.ParseTail(0x1);
434 434
@@ -458,11 +458,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
458 Vector3 teleportLookAt = new Vector3(20, 21, 22); 458 Vector3 teleportLookAt = new Vector3(20, 21, 22);
459 459
460 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); 460 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
461 TestClient tc = new TestClient(acd, sceneA, sh.SceneManager); 461 TestClient tc = new TestClient(acd, sceneA);
462 List<TestClient> destinationTestClients = new List<TestClient>(); 462 List<TestClient> destinationTestClients = new List<TestClient>();
463 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 463 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients);
464 464
465 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd, sh.SceneManager); 465 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
466 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); 466 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32);
467 467
468 Assert.That(beforeSceneASp, Is.Not.Null); 468 Assert.That(beforeSceneASp, Is.Not.Null);
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index b09ae39..7b47275 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -34,6 +34,7 @@ using System.Threading;
34using log4net; 34using log4net;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenMetaverse.Assets; 36using OpenMetaverse.Assets;
37using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Region.Framework.Scenes.Serialization; 39using OpenSim.Region.Framework.Scenes.Serialization;
39using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
@@ -180,6 +181,9 @@ namespace OpenSim.Region.Framework.Scenes
180 if (!assetUuids.ContainsKey(tii.AssetID)) 181 if (!assetUuids.ContainsKey(tii.AssetID))
181 GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); 182 GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids);
182 } 183 }
184
185 // get any texture UUIDs used for materials such as normal and specular maps
186 GatherMaterialsUuids(part, assetUuids);
183 } 187 }
184 catch (Exception e) 188 catch (Exception e)
185 { 189 {
@@ -204,6 +208,68 @@ namespace OpenSim.Region.Framework.Scenes
204// } 208// }
205// } 209// }
206 210
211
212 /// <summary>
213 /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
214 /// </summary>
215 /// <param name="part"></param>
216 /// <param name="assetUuids"></param>
217 public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids)
218 {
219 // scan thru the dynAttrs map of this part for any textures used as materials
220 OSDMap OSMaterials = null;
221
222 lock (part.DynAttrs)
223 {
224 if (part.DynAttrs.ContainsKey("OS:Materials"))
225 OSMaterials = part.DynAttrs["OS:Materials"];
226 if (OSMaterials != null && OSMaterials.ContainsKey("Materials"))
227 {
228 OSD osd = OSMaterials["Materials"];
229 //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
230
231 if (osd is OSDArray)
232 {
233 OSDArray matsArr = osd as OSDArray;
234 foreach (OSDMap matMap in matsArr)
235 {
236 try
237 {
238 if (matMap.ContainsKey("Material"))
239 {
240 OSDMap mat = matMap["Material"] as OSDMap;
241 if (mat.ContainsKey("NormMap"))
242 {
243 UUID normalMapId = mat["NormMap"].AsUUID();
244 if (normalMapId != UUID.Zero)
245 {
246 assetUuids[normalMapId] = AssetType.Texture;
247 //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString());
248 }
249 }
250 if (mat.ContainsKey("SpecMap"))
251 {
252 UUID specularMapId = mat["SpecMap"].AsUUID();
253 if (specularMapId != UUID.Zero)
254 {
255 assetUuids[specularMapId] = AssetType.Texture;
256 //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString());
257 }
258 }
259 }
260
261 }
262 catch (Exception e)
263 {
264 m_log.Warn("[UUID Gatherer]: exception getting materials: " + e.Message);
265 }
266 }
267 }
268 }
269 }
270 }
271
272
207 /// <summary> 273 /// <summary>
208 /// Get an asset synchronously, potentially using an asynchronous callback. If the 274 /// Get an asset synchronously, potentially using an asynchronous callback. If the
209 /// asynchronous callback is used, we will wait for it to complete. 275 /// asynchronous callback is used, we will wait for it to complete.