aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs49
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs119
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs1
20 files changed, 166 insertions, 80 deletions
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 64567db..8feb022 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes
137 x = m_inventoryDeletes.Dequeue(); 137 x = m_inventoryDeletes.Dequeue();
138 138
139 m_log.DebugFormat( 139 m_log.DebugFormat(
140 "[ASYNC DELETER]: Sending object to user's inventory, {0} item(s) remaining.", left); 140 "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.", left, x.action, x.objectGroups.Count);
141 141
142 try 142 try
143 { 143 {
@@ -177,4 +177,4 @@ namespace OpenSim.Region.Framework.Scenes
177 return false; 177 return false;
178 } 178 }
179 } 179 }
180} \ No newline at end of file 180}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index c321a15..fd62535 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -242,7 +242,15 @@ namespace OpenSim.Region.Framework.Scenes
242 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); 242 public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
243 243
244 public event EstateToolsSunUpdate OnEstateToolsSunUpdate; 244 public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
245
246 /// <summary>
247 /// Triggered when an object is added to the scene.
248 /// </summary>
249 public event Action<SceneObjectGroup> OnObjectAddedToScene;
245 250
251 /// <summary>
252 /// Triggered when an object is removed from the scene.
253 /// </summary>
246 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); 254 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
247 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; 255 public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
248 256
@@ -345,6 +353,7 @@ namespace OpenSim.Region.Framework.Scenes
345 public delegate void Attach(uint localID, UUID itemID, UUID avatarID); 353 public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
346 public event Attach OnAttach; 354 public event Attach OnAttach;
347 355
356
348 /// <summary> 357 /// <summary>
349 /// Called immediately after an object is loaded from storage. 358 /// Called immediately after an object is loaded from storage.
350 /// </summary> 359 /// </summary>
@@ -800,6 +809,27 @@ namespace OpenSim.Region.Framework.Scenes
800 } 809 }
801 } 810 }
802 811
812 public void TriggerObjectAddedToScene(SceneObjectGroup obj)
813 {
814 Action<SceneObjectGroup> handler = OnObjectAddedToScene;
815 if (handler != null)
816 {
817 foreach (Action<SceneObjectGroup> d in handler.GetInvocationList())
818 {
819 try
820 {
821 d(obj);
822 }
823 catch (Exception e)
824 {
825 m_log.ErrorFormat(
826 "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}",
827 e.Message, e.StackTrace);
828 }
829 }
830 }
831 }
832
803 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) 833 public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
804 { 834 {
805 ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; 835 ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index fcbcf59..73dd531 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2069,7 +2069,10 @@ namespace OpenSim.Region.Framework.Scenes
2069 SceneObjectPart[] partList = sog.Parts; 2069 SceneObjectPart[] partList = sog.Parts;
2070 2070
2071 foreach (SceneObjectPart child in partList) 2071 foreach (SceneObjectPart child in partList)
2072 {
2072 child.Inventory.ChangeInventoryOwner(ownerID); 2073 child.Inventory.ChangeInventoryOwner(ownerID);
2074 child.TriggerScriptChangedEvent(Changed.OWNER);
2075 }
2073 } 2076 }
2074 else 2077 else
2075 { 2078 {
@@ -2085,6 +2088,7 @@ namespace OpenSim.Region.Framework.Scenes
2085 { 2088 {
2086 child.LastOwnerID = child.OwnerID; 2089 child.LastOwnerID = child.OwnerID;
2087 child.Inventory.ChangeInventoryOwner(groupID); 2090 child.Inventory.ChangeInventoryOwner(groupID);
2091 child.TriggerScriptChangedEvent(Changed.OWNER);
2088 } 2092 }
2089 2093
2090 sog.SetOwnerId(groupID); 2094 sog.SetOwnerId(groupID);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1a6a70b..f0acc38 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -563,7 +563,6 @@ namespace OpenSim.Region.Framework.Scenes
563 m_regInfo = regInfo; 563 m_regInfo = regInfo;
564 m_regionHandle = m_regInfo.RegionHandle; 564 m_regionHandle = m_regInfo.RegionHandle;
565 m_regionName = m_regInfo.RegionName; 565 m_regionName = m_regInfo.RegionName;
566 m_datastore = m_regInfo.DataStore;
567 m_lastUpdate = Util.EnvironmentTickCount(); 566 m_lastUpdate = Util.EnvironmentTickCount();
568 567
569 m_physicalPrim = physicalPrim; 568 m_physicalPrim = physicalPrim;
@@ -1109,7 +1108,7 @@ namespace OpenSim.Region.Framework.Scenes
1109 // 1108 //
1110 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) 1109 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
1111 { 1110 {
1112 MainConsole.Instance.Output("The current estate has no owner set."); 1111 MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName);
1113 List<char> excluded = new List<char>(new char[1]{' '}); 1112 List<char> excluded = new List<char>(new char[1]{' '});
1114 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); 1113 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
1115 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); 1114 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
@@ -1429,20 +1428,6 @@ namespace OpenSim.Region.Framework.Scenes
1429 } 1428 }
1430 1429
1431 /// <summary> 1430 /// <summary>
1432 /// Recount SceneObjectPart in parcel aabb
1433 /// </summary>
1434 private void UpdateLand()
1435 {
1436 if (LandChannel != null)
1437 {
1438 if (LandChannel.IsLandPrimCountTainted())
1439 {
1440 EventManager.TriggerParcelPrimCountUpdate();
1441 }
1442 }
1443 }
1444
1445 /// <summary>
1446 /// Update the terrain if it needs to be updated. 1431 /// Update the terrain if it needs to be updated.
1447 /// </summary> 1432 /// </summary>
1448 private void UpdateTerrain() 1433 private void UpdateTerrain()
@@ -1536,8 +1521,11 @@ namespace OpenSim.Region.Framework.Scenes
1536 } 1521 }
1537 1522
1538 /// <summary> 1523 /// <summary>
1539 /// Return object to avatar Message 1524 /// Tell an agent that their object has been returned.
1540 /// </summary> 1525 /// </summary>
1526 /// <remarks>
1527 /// The actual return is handled by the caller.
1528 /// </remarks>
1541 /// <param name="agentID">Avatar Unique Id</param> 1529 /// <param name="agentID">Avatar Unique Id</param>
1542 /// <param name="objectName">Name of object returned</param> 1530 /// <param name="objectName">Name of object returned</param>
1543 /// <param name="location">Location of object returned</param> 1531 /// <param name="location">Location of object returned</param>
@@ -1956,8 +1944,14 @@ namespace OpenSim.Region.Framework.Scenes
1956 /// If false, it is left to the caller to schedule the update 1944 /// If false, it is left to the caller to schedule the update
1957 /// </param> 1945 /// </param>
1958 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) 1946 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
1959 { 1947 {
1960 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); 1948 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates))
1949 {
1950 EventManager.TriggerObjectAddedToScene(sceneObject);
1951 return true;
1952 }
1953
1954 return false;
1961 } 1955 }
1962 1956
1963 /// <summary> 1957 /// <summary>
@@ -1974,7 +1968,13 @@ namespace OpenSim.Region.Framework.Scenes
1974 public bool AddNewSceneObject( 1968 public bool AddNewSceneObject(
1975 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) 1969 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
1976 { 1970 {
1977 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); 1971 if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel))
1972 {
1973 EventManager.TriggerObjectAddedToScene(sceneObject);
1974 return true;
1975 }
1976
1977 return false;
1978 } 1978 }
1979 1979
1980 /// <summary> 1980 /// <summary>
@@ -4854,8 +4854,17 @@ namespace OpenSim.Region.Framework.Scenes
4854 { 4854 {
4855 float ominX, ominY, ominZ, omaxX, omaxY, omaxZ; 4855 float ominX, ominY, ominZ, omaxX, omaxY, omaxZ;
4856 4856
4857 Vector3 vec = g.AbsolutePosition;
4858
4857 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); 4859 g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
4858 4860
4861 ominX += vec.X;
4862 omaxX += vec.X;
4863 ominY += vec.Y;
4864 omaxY += vec.Y;
4865 ominZ += vec.Z;
4866 omaxZ += vec.Z;
4867
4859 if (minX > ominX) 4868 if (minX > ominX)
4860 minX = ominX; 4869 minX = ominX;
4861 if (minY > ominY) 4870 if (minY > ominY)
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index f343bc8..c4547f2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -136,8 +136,6 @@ namespace OpenSim.Region.Framework.Scenes
136 get { return m_permissions; } 136 get { return m_permissions; }
137 } 137 }
138 138
139 protected string m_datastore;
140
141 /* Used by the loadbalancer plugin on GForge */ 139 /* Used by the loadbalancer plugin on GForge */
142 protected RegionStatus m_regStatus; 140 protected RegionStatus m_regStatus;
143 public RegionStatus RegionStatus 141 public RegionStatus RegionStatus
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 734ba22..97af0a0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -88,9 +88,21 @@ namespace OpenSim.Region.Framework.Scenes
88 protected internal object m_syncRoot = new object(); 88 protected internal object m_syncRoot = new object();
89 89
90 protected internal PhysicsScene _PhyScene; 90 protected internal PhysicsScene _PhyScene;
91 91
92 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); 92 /// <summary>
93 /// Index the SceneObjectGroup for each part by the root part's UUID.
94 /// </summary>
93 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); 95 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>();
96
97 /// <summary>
98 /// Index the SceneObjectGroup for each part by that part's UUID.
99 /// </summary>
100 protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullPartID = new Dictionary<UUID, SceneObjectGroup>();
101
102 /// <summary>
103 /// Index the SceneObjectGroup for each part by that part's local ID.
104 /// </summary>
105 protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
94 106
95 private Object m_updateLock = new Object(); 107 private Object m_updateLock = new Object();
96 108
@@ -133,8 +145,10 @@ namespace OpenSim.Region.Framework.Scenes
133 145
134 lock (SceneObjectGroupsByFullID) 146 lock (SceneObjectGroupsByFullID)
135 SceneObjectGroupsByFullID.Clear(); 147 SceneObjectGroupsByFullID.Clear();
136 lock (SceneObjectGroupsByLocalID) 148 lock (SceneObjectGroupsByFullPartID)
137 SceneObjectGroupsByLocalID.Clear(); 149 SceneObjectGroupsByFullPartID.Clear();
150 lock (SceneObjectGroupsByLocalPartID)
151 SceneObjectGroupsByLocalPartID.Clear();
138 152
139 Entities.Clear(); 153 Entities.Clear();
140 } 154 }
@@ -349,6 +363,10 @@ namespace OpenSim.Region.Framework.Scenes
349 363
350 if (Entities.ContainsKey(sceneObject.UUID)) 364 if (Entities.ContainsKey(sceneObject.UUID))
351 return false; 365 return false;
366
367// m_log.DebugFormat(
368// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
369// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
352 370
353 SceneObjectPart[] children = sceneObject.Parts; 371 SceneObjectPart[] children = sceneObject.Parts;
354 372
@@ -385,17 +403,20 @@ namespace OpenSim.Region.Framework.Scenes
385 OnObjectCreate(sceneObject); 403 OnObjectCreate(sceneObject);
386 404
387 lock (SceneObjectGroupsByFullID) 405 lock (SceneObjectGroupsByFullID)
388 {
389 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 406 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
407
408 lock (SceneObjectGroupsByFullPartID)
409 {
410 SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject;
390 foreach (SceneObjectPart part in children) 411 foreach (SceneObjectPart part in children)
391 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 412 SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
392 } 413 }
393 414
394 lock (SceneObjectGroupsByLocalID) 415 lock (SceneObjectGroupsByLocalPartID)
395 { 416 {
396 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; 417 SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject;
397 foreach (SceneObjectPart part in children) 418 foreach (SceneObjectPart part in children)
398 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 419 SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
399 } 420 }
400 421
401 return true; 422 return true;
@@ -426,21 +447,24 @@ namespace OpenSim.Region.Framework.Scenes
426 447
427 if (OnObjectRemove != null) 448 if (OnObjectRemove != null)
428 OnObjectRemove(Entities[uuid]); 449 OnObjectRemove(Entities[uuid]);
429 450
430 lock (SceneObjectGroupsByFullID) 451 lock (SceneObjectGroupsByFullID)
452 SceneObjectGroupsByFullID.Remove(grp.UUID);
453
454 lock (SceneObjectGroupsByFullPartID)
431 { 455 {
432 SceneObjectPart[] parts = grp.Parts; 456 SceneObjectPart[] parts = grp.Parts;
433 for (int i = 0; i < parts.Length; i++) 457 for (int i = 0; i < parts.Length; i++)
434 SceneObjectGroupsByFullID.Remove(parts[i].UUID); 458 SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
435 SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); 459 SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID);
436 } 460 }
437 461
438 lock (SceneObjectGroupsByLocalID) 462 lock (SceneObjectGroupsByLocalPartID)
439 { 463 {
440 SceneObjectPart[] parts = grp.Parts; 464 SceneObjectPart[] parts = grp.Parts;
441 for (int i = 0; i < parts.Length; i++) 465 for (int i = 0; i < parts.Length; i++)
442 SceneObjectGroupsByLocalID.Remove(parts[i].LocalId); 466 SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
443 SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); 467 SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId);
444 } 468 }
445 469
446 return Entities.Remove(uuid); 470 return Entities.Remove(uuid);
@@ -627,7 +651,7 @@ namespace OpenSim.Region.Framework.Scenes
627 if (!Entities.Remove(agentID)) 651 if (!Entities.Remove(agentID))
628 { 652 {
629 m_log.WarnFormat( 653 m_log.WarnFormat(
630 "[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", 654 "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
631 agentID); 655 agentID);
632 } 656 }
633 657
@@ -650,7 +674,7 @@ namespace OpenSim.Region.Framework.Scenes
650 } 674 }
651 else 675 else
652 { 676 {
653 m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); 677 m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
654 } 678 }
655 } 679 }
656 } 680 }
@@ -854,14 +878,14 @@ namespace OpenSim.Region.Framework.Scenes
854 878
855 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); 879 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
856 SceneObjectGroup sog; 880 SceneObjectGroup sog;
857 lock (SceneObjectGroupsByLocalID) 881 lock (SceneObjectGroupsByLocalPartID)
858 SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); 882 SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
859 883
860 if (sog != null) 884 if (sog != null)
861 { 885 {
862 if (sog.HasChildPrim(localID)) 886 if (sog.HasChildPrim(localID))
863 return sog; 887 return sog;
864 SceneObjectGroupsByLocalID.Remove(localID); 888 SceneObjectGroupsByLocalPartID.Remove(localID);
865 } 889 }
866 890
867 EntityBase[] entityList = GetEntities(); 891 EntityBase[] entityList = GetEntities();
@@ -873,8 +897,8 @@ namespace OpenSim.Region.Framework.Scenes
873 sog = (SceneObjectGroup)ent; 897 sog = (SceneObjectGroup)ent;
874 if (sog.HasChildPrim(localID)) 898 if (sog.HasChildPrim(localID))
875 { 899 {
876 lock (SceneObjectGroupsByLocalID) 900 lock (SceneObjectGroupsByLocalPartID)
877 SceneObjectGroupsByLocalID[localID] = sog; 901 SceneObjectGroupsByLocalPartID[localID] = sog;
878 return sog; 902 return sog;
879 } 903 }
880 } 904 }
@@ -891,16 +915,16 @@ namespace OpenSim.Region.Framework.Scenes
891 private SceneObjectGroup GetGroupByPrim(UUID fullID) 915 private SceneObjectGroup GetGroupByPrim(UUID fullID)
892 { 916 {
893 SceneObjectGroup sog; 917 SceneObjectGroup sog;
894 lock (SceneObjectGroupsByFullID) 918 lock (SceneObjectGroupsByFullPartID)
895 SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); 919 SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog);
896 920
897 if (sog != null) 921 if (sog != null)
898 { 922 {
899 if (sog.ContainsPart(fullID)) 923 if (sog.ContainsPart(fullID))
900 return sog; 924 return sog;
901 925
902 lock (SceneObjectGroupsByFullID) 926 lock (SceneObjectGroupsByFullPartID)
903 SceneObjectGroupsByFullID.Remove(fullID); 927 SceneObjectGroupsByFullPartID.Remove(fullID);
904 } 928 }
905 929
906 EntityBase[] entityList = GetEntities(); 930 EntityBase[] entityList = GetEntities();
@@ -911,8 +935,8 @@ namespace OpenSim.Region.Framework.Scenes
911 sog = (SceneObjectGroup)ent; 935 sog = (SceneObjectGroup)ent;
912 if (sog.HasChildPrim(fullID)) 936 if (sog.HasChildPrim(fullID))
913 { 937 {
914 lock (SceneObjectGroupsByFullID) 938 lock (SceneObjectGroupsByFullPartID)
915 SceneObjectGroupsByFullID[fullID] = sog; 939 SceneObjectGroupsByFullPartID[fullID] = sog;
916 return sog; 940 return sog;
917 } 941 }
918 } 942 }
@@ -1064,11 +1088,12 @@ namespace OpenSim.Region.Framework.Scenes
1064 } 1088 }
1065 1089
1066 /// <summary> 1090 /// <summary>
1067 /// Performs action on all scene object groups. 1091 /// Performs action once on all scene object groups.
1068 /// </summary> 1092 /// </summary>
1069 /// <param name="action"></param> 1093 /// <param name="action"></param>
1070 protected internal void ForEachSOG(Action<SceneObjectGroup> action) 1094 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1071 { 1095 {
1096 // FIXME: Need to lock here, really.
1072 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); 1097 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
1073 foreach (SceneObjectGroup obj in objlist) 1098 foreach (SceneObjectGroup obj in objlist)
1074 { 1099 {
@@ -1079,11 +1104,11 @@ namespace OpenSim.Region.Framework.Scenes
1079 catch (Exception e) 1104 catch (Exception e)
1080 { 1105 {
1081 // Catch it and move on. This includes situations where splist has inconsistent info 1106 // Catch it and move on. This includes situations where splist has inconsistent info
1082 m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.ToString()); 1107 m_log.WarnFormat(
1108 "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace);
1083 } 1109 }
1084 } 1110 }
1085 } 1111 }
1086
1087 1112
1088 /// <summary> 1113 /// <summary>
1089 /// Performs action on all scene presences. This can ultimately run the actions in parallel but 1114 /// Performs action on all scene presences. This can ultimately run the actions in parallel but
@@ -1103,8 +1128,8 @@ namespace OpenSim.Region.Framework.Scenes
1103 } 1128 }
1104 catch (Exception e) 1129 catch (Exception e)
1105 { 1130 {
1106 m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); 1131 m_log.Info("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
1107 m_log.Info("[BUG] Stack Trace: " + e.StackTrace); 1132 m_log.Info("[SCENEGRAPH]: Stack Trace: " + e.StackTrace);
1108 } 1133 }
1109 }); 1134 });
1110 Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction); 1135 Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction);
@@ -1119,7 +1144,7 @@ namespace OpenSim.Region.Framework.Scenes
1119 } 1144 }
1120 catch (Exception e) 1145 catch (Exception e)
1121 { 1146 {
1122 m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); 1147 m_log.Error("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
1123 } 1148 }
1124 } 1149 }
1125 } 1150 }
@@ -1777,7 +1802,10 @@ namespace OpenSim.Region.Framework.Scenes
1777 /// <param name="rot"></param> 1802 /// <param name="rot"></param>
1778 public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) 1803 public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
1779 { 1804 {
1780 //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); 1805// m_log.DebugFormat(
1806// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
1807// originalPrimID, offset, AgentID);
1808
1781 SceneObjectGroup original = GetGroupByPrim(originalPrimID); 1809 SceneObjectGroup original = GetGroupByPrim(originalPrimID);
1782 if (original != null) 1810 if (original != null)
1783 { 1811 {
@@ -1808,7 +1836,28 @@ namespace OpenSim.Region.Framework.Scenes
1808 copy.RootPart.SalePrice = 10; 1836 copy.RootPart.SalePrice = 10;
1809 } 1837 }
1810 1838
1839 // FIXME: This section needs to be refactored so that it just calls AddSceneObject()
1811 Entities.Add(copy); 1840 Entities.Add(copy);
1841
1842 lock (SceneObjectGroupsByFullID)
1843 SceneObjectGroupsByFullID[copy.UUID] = copy;
1844
1845 SceneObjectPart[] children = copy.Parts;
1846
1847 lock (SceneObjectGroupsByFullPartID)
1848 {
1849 SceneObjectGroupsByFullPartID[copy.UUID] = copy;
1850 foreach (SceneObjectPart part in children)
1851 SceneObjectGroupsByFullPartID[part.UUID] = copy;
1852 }
1853
1854 lock (SceneObjectGroupsByLocalPartID)
1855 {
1856 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
1857 foreach (SceneObjectPart part in children)
1858 SceneObjectGroupsByLocalPartID[part.LocalId] = copy;
1859 }
1860 // PROBABLE END OF FIXME
1812 1861
1813 // Since we copy from a source group that is in selected 1862 // Since we copy from a source group that is in selected
1814 // state, but the copy is shown deselected in the viewer, 1863 // state, but the copy is shown deselected in the viewer,
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f17fb28..ca7d9d9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -325,6 +325,8 @@ namespace OpenSim.Region.Framework.Scenes
325 //m_rootPart.GroupPosition.Z); 325 //m_rootPart.GroupPosition.Z);
326 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 326 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
327 //} 327 //}
328
329 m_scene.EventManager.TriggerParcelPrimCountTainted();
328 } 330 }
329 } 331 }
330 332
@@ -1313,8 +1315,10 @@ namespace OpenSim.Region.Framework.Scenes
1313 parcel.LandData.OtherCleanTime) 1315 parcel.LandData.OtherCleanTime)
1314 { 1316 {
1315 DetachFromBackup(); 1317 DetachFromBackup();
1316 m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); 1318 m_log.DebugFormat(
1317 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); 1319 "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn",
1320 RootPart.UUID);
1321 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn");
1318 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, 1322 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
1319 DeRezAction.Return, UUID.Zero); 1323 DeRezAction.Return, UUID.Zero);
1320 1324
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 67e59c6..3281eab 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -175,12 +175,12 @@ namespace OpenSim.Region.Framework.Scenes
175 foreach (TaskInventoryItem item in items) 175 foreach (TaskInventoryItem item in items)
176 { 176 {
177 if (ownerId != item.OwnerID) 177 if (ownerId != item.OwnerID)
178 {
179 item.LastOwnerID = item.OwnerID; 178 item.LastOwnerID = item.OwnerID;
180 item.OwnerID = ownerId; 179
181 item.PermsMask = 0; 180 item.OwnerID = ownerId;
182 item.PermsGranter = UUID.Zero; 181 item.PermsMask = 0;
183 } 182 item.PermsGranter = UUID.Zero;
183 item.OwnerChanged = true;
184 } 184 }
185 } 185 }
186 186
@@ -1089,9 +1089,13 @@ namespace OpenSim.Region.Framework.Scenes
1089 1089
1090 public Dictionary<UUID, string> GetScriptStates() 1090 public Dictionary<UUID, string> GetScriptStates()
1091 { 1091 {
1092 Dictionary<UUID, string> ret = new Dictionary<UUID, string>();
1093
1094 if (m_part.ParentGroup.Scene == null) // Group not in a scene
1095 return ret;
1096
1092 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 1097 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
1093 1098
1094 Dictionary<UUID, string> ret = new Dictionary<UUID, string>();
1095 if (engines == null) // No engine at all 1099 if (engines == null) // No engine at all
1096 return ret; 1100 return ret;
1097 1101
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
index af44640..855b589 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
@@ -34,7 +34,6 @@ using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer=System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenSim.Framework; 38using OpenSim.Framework;
40using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index b3c3e22..667b74e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -32,7 +32,6 @@ using System.Text;
32using System.Collections.Generic; 32using System.Collections.Generic;
33using Nini.Config; 33using Nini.Config;
34using NUnit.Framework; 34using NUnit.Framework;
35using NUnit.Framework.SyntaxHelpers;
36using OpenMetaverse; 35using OpenMetaverse;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using OpenSim.Framework.Communications; 37using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 9244bc3..ca635d7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Framework.Communications; 33using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 4969b09..a6a95ef 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Framework.Communications; 33using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 39116b6..0d26026 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using Nini.Config; 31using Nini.Config;
32using NUnit.Framework; 32using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
36using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index b84298f..bdfcd1d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using NUnit.Framework; 31using NUnit.Framework;
32using NUnit.Framework.SyntaxHelpers;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
index c78038f..8876a43 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using Nini.Config; 31using Nini.Config;
32using NUnit.Framework; 32using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
36using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index fd2d6fa..efb757f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -34,7 +34,6 @@ using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer=System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenSim.Framework; 38using OpenSim.Framework;
40using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 9aba8a8..abcce66 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -34,7 +34,6 @@ using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer=System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenSim.Framework; 38using OpenSim.Framework;
40using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
index cafe48a..8588f7f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
@@ -29,7 +29,6 @@ using System;
29using System.Reflection; 29using System.Reflection;
30using Nini.Config; 30using Nini.Config;
31using NUnit.Framework; 31using NUnit.Framework;
32using NUnit.Framework.SyntaxHelpers;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index fe59d4f..8138bcc 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -34,7 +34,6 @@ using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer=System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenMetaverse.Assets; 38using OpenMetaverse.Assets;
40using OpenSim.Framework; 39using OpenSim.Framework;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 5e6124b..6b70865 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -28,7 +28,6 @@
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;