aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
authorDan Lake2012-02-01 16:25:35 -0800
committerDan Lake2012-02-01 16:25:35 -0800
commitc10193c72b1f029a958f04d2f5d7ee384e693aaa (patch)
tree052ec7e973c15b158310511197affad14eb9c64f /OpenSim/Region/Framework/Scenes/SceneGraph.cs
parentTrigger event when prims are scheduled for an update. This gives modules earl... (diff)
parentSmall optimization to last commit (diff)
downloadopensim-SC_OLD-c10193c72b1f029a958f04d2f5d7ee384e693aaa.zip
opensim-SC_OLD-c10193c72b1f029a958f04d2f5d7ee384e693aaa.tar.gz
opensim-SC_OLD-c10193c72b1f029a958f04d2f5d7ee384e693aaa.tar.bz2
opensim-SC_OLD-c10193c72b1f029a958f04d2f5d7ee384e693aaa.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs45
1 files changed, 20 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index f481e72..1487fac 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -41,12 +41,6 @@ namespace OpenSim.Region.Framework.Scenes
41{ 41{
42 public delegate void PhysicsCrash(); 42 public delegate void PhysicsCrash();
43 43
44 public delegate void ObjectDuplicateDelegate(EntityBase original, EntityBase clone);
45
46 public delegate void ObjectCreateDelegate(EntityBase obj);
47
48 public delegate void ObjectDeleteDelegate(EntityBase obj);
49
50 /// <summary> 44 /// <summary>
51 /// This class used to be called InnerScene and may not yet truly be a SceneGraph. The non scene graph components 45 /// This class used to be called InnerScene and may not yet truly be a SceneGraph. The non scene graph components
52 /// should be migrated out over time. 46 /// should be migrated out over time.
@@ -60,10 +54,6 @@ namespace OpenSim.Region.Framework.Scenes
60 protected internal event PhysicsCrash UnRecoverableError; 54 protected internal event PhysicsCrash UnRecoverableError;
61 private PhysicsCrash handlerPhysicsCrash = null; 55 private PhysicsCrash handlerPhysicsCrash = null;
62 56
63 public event ObjectDuplicateDelegate OnObjectDuplicate;
64 public event ObjectCreateDelegate OnObjectCreate;
65 public event ObjectDeleteDelegate OnObjectRemove;
66
67 #endregion 57 #endregion
68 58
69 #region Fields 59 #region Fields
@@ -364,11 +354,23 @@ namespace OpenSim.Region.Framework.Scenes
364 /// </returns> 354 /// </returns>
365 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 355 protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
366 { 356 {
367 if (sceneObject == null || sceneObject.RootPart.UUID == UUID.Zero) 357 if (sceneObject.UUID == UUID.Zero)
358 {
359 m_log.ErrorFormat(
360 "[SCENEGRAPH]: Tried to add scene object {0} to {1} with illegal UUID of {2}",
361 sceneObject.Name, m_parentScene.RegionInfo.RegionName, UUID.Zero);
362
368 return false; 363 return false;
364 }
369 365
370 if (Entities.ContainsKey(sceneObject.UUID)) 366 if (Entities.ContainsKey(sceneObject.UUID))
367 {
368// m_log.DebugFormat(
369// "[SCENEGRAPH]: Scene graph for {0} already contains object {1} in AddSceneObject()",
370// m_parentScene.RegionInfo.RegionName, sceneObject.UUID);
371
371 return false; 372 return false;
373 }
372 374
373// m_log.DebugFormat( 375// m_log.DebugFormat(
374// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", 376// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
@@ -405,9 +407,6 @@ namespace OpenSim.Region.Framework.Scenes
405 if (attachToBackup) 407 if (attachToBackup)
406 sceneObject.AttachToBackup(); 408 sceneObject.AttachToBackup();
407 409
408 if (OnObjectCreate != null)
409 OnObjectCreate(sceneObject);
410
411 lock (SceneObjectGroupsByFullID) 410 lock (SceneObjectGroupsByFullID)
412 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 411 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
413 412
@@ -456,9 +455,6 @@ namespace OpenSim.Region.Framework.Scenes
456 if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) 455 if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
457 RemovePhysicalPrim(grp.PrimCount); 456 RemovePhysicalPrim(grp.PrimCount);
458 } 457 }
459
460 if (OnObjectRemove != null)
461 OnObjectRemove(Entities[uuid]);
462 458
463 lock (SceneObjectGroupsByFullID) 459 lock (SceneObjectGroupsByFullID)
464 SceneObjectGroupsByFullID.Remove(grp.UUID); 460 SceneObjectGroupsByFullID.Remove(grp.UUID);
@@ -1154,8 +1150,10 @@ namespace OpenSim.Region.Framework.Scenes
1154 /// <param name="action"></param> 1150 /// <param name="action"></param>
1155 protected internal void ForEachSOG(Action<SceneObjectGroup> action) 1151 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1156 { 1152 {
1157 // FIXME: Need to lock here, really. 1153 List<SceneObjectGroup> objlist;
1158 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); 1154 lock (SceneObjectGroupsByFullID)
1155 objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
1156
1159 foreach (SceneObjectGroup obj in objlist) 1157 foreach (SceneObjectGroup obj in objlist)
1160 { 1158 {
1161 try 1159 try
@@ -1164,7 +1162,7 @@ namespace OpenSim.Region.Framework.Scenes
1164 } 1162 }
1165 catch (Exception e) 1163 catch (Exception e)
1166 { 1164 {
1167 // Catch it and move on. This includes situations where splist has inconsistent info 1165 // Catch it and move on. This includes situations where objlist has inconsistent info
1168 m_log.WarnFormat( 1166 m_log.WarnFormat(
1169 "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace); 1167 "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace);
1170 } 1168 }
@@ -1399,10 +1397,10 @@ namespace OpenSim.Region.Framework.Scenes
1399 /// <summary> 1397 /// <summary>
1400 /// Update the texture entry of the given prim. 1398 /// Update the texture entry of the given prim.
1401 /// </summary> 1399 /// </summary>
1402 /// 1400 /// <remarks>
1403 /// A texture entry is an object that contains details of all the textures of the prim's face. In this case, 1401 /// A texture entry is an object that contains details of all the textures of the prim's face. In this case,
1404 /// the texture is given in its byte serialized form. 1402 /// the texture is given in its byte serialized form.
1405 /// 1403 /// </remarks>
1406 /// <param name="localID"></param> 1404 /// <param name="localID"></param>
1407 /// <param name="texture"></param> 1405 /// <param name="texture"></param>
1408 /// <param name="remoteClient"></param> 1406 /// <param name="remoteClient"></param>
@@ -1980,9 +1978,6 @@ namespace OpenSim.Region.Framework.Scenes
1980 // required for physics to update it's position 1978 // required for physics to update it's position
1981 copy.AbsolutePosition = copy.AbsolutePosition; 1979 copy.AbsolutePosition = copy.AbsolutePosition;
1982 1980
1983 if (OnObjectDuplicate != null)
1984 OnObjectDuplicate(original, copy);
1985
1986 return copy; 1981 return copy;
1987 } 1982 }
1988 } 1983 }