diff options
author | Justin Clarke Casey | 2008-05-25 00:09:08 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-25 00:09:08 +0000 |
commit | bc92d72828925d8b3df72cf66b003ae73731a352 (patch) | |
tree | cd0c17a61ebf5950d58cf70d6cb3c05af70d28d8 /OpenSim/Region | |
parent | * Refactor: Collapse some multiple remove object paths (diff) | |
download | opensim-SC-bc92d72828925d8b3df72cf66b003ae73731a352.zip opensim-SC-bc92d72828925d8b3df72cf66b003ae73731a352.tar.gz opensim-SC-bc92d72828925d8b3df72cf66b003ae73731a352.tar.bz2 opensim-SC-bc92d72828925d8b3df72cf66b003ae73731a352.tar.xz |
* Refactor: Collapses parts of different code paths in scene used when deleting and unlinking an object
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 52 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 4 |
4 files changed, 27 insertions, 40 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index b03ffe2..65012ad 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -590,16 +590,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
590 | } | 590 | } |
591 | } | 591 | } |
592 | 592 | ||
593 | public void RemoveAPrimCount() | ||
594 | { | ||
595 | m_numPrim--; | ||
596 | } | ||
597 | |||
598 | public void AddAPrimCount() | ||
599 | { | ||
600 | m_numPrim++; | ||
601 | } | ||
602 | |||
603 | public int GetChildAgentCount() | 593 | public int GetChildAgentCount() |
604 | { | 594 | { |
605 | // some network situations come in where child agents get closed twice. | 595 | // some network situations come in where child agents get closed twice. |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 82e112f..921770d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1145,7 +1145,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1145 | 1145 | ||
1146 | if (permissionToTake) | 1146 | if (permissionToTake) |
1147 | { | 1147 | { |
1148 | |||
1149 | string sceneObjectXml = objectGroup.ToXmlString(); | 1148 | string sceneObjectXml = objectGroup.ToXmlString(); |
1150 | 1149 | ||
1151 | CachedUserInfo userInfo = | 1150 | CachedUserInfo userInfo = |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index e30813c..1e88018 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1335,7 +1335,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1335 | public void AddSceneObject(SceneObjectGroup sceneObject) | 1335 | public void AddSceneObject(SceneObjectGroup sceneObject) |
1336 | { | 1336 | { |
1337 | m_innerScene.AddSceneObject(sceneObject); | 1337 | m_innerScene.AddSceneObject(sceneObject); |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | /// <summary> | 1340 | /// <summary> |
1341 | /// Delete this object from the scene. | 1341 | /// Delete this object from the scene. |
@@ -1344,21 +1344,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1344 | public void DeleteSceneObject(SceneObjectGroup group) | 1344 | public void DeleteSceneObject(SceneObjectGroup group) |
1345 | { | 1345 | { |
1346 | SceneObjectPart rootPart = (group).GetChildPart(group.UUID); | 1346 | SceneObjectPart rootPart = (group).GetChildPart(group.UUID); |
1347 | |||
1347 | if (rootPart.PhysActor != null) | 1348 | if (rootPart.PhysActor != null) |
1348 | { | 1349 | { |
1349 | PhysicsScene.RemovePrim(rootPart.PhysActor); | 1350 | PhysicsScene.RemovePrim(rootPart.PhysActor); |
1350 | rootPart.PhysActor = null; | 1351 | rootPart.PhysActor = null; |
1351 | } | 1352 | } |
1352 | 1353 | ||
1353 | m_storageManager.DataStore.RemoveObject(group.UUID, m_regInfo.RegionID); | 1354 | if (UnlinkSceneObject(group.UUID)) |
1354 | group.DeleteGroup(); | ||
1355 | |||
1356 | if (m_innerScene.DeleteSceneObject(group.UUID)) | ||
1357 | { | 1355 | { |
1358 | EventManager.TriggerObjectBeingRemovedFromScene(group); | 1356 | EventManager.TriggerObjectBeingRemovedFromScene(group); |
1359 | EventManager.TriggerParcelPrimCountTainted(); | 1357 | EventManager.TriggerParcelPrimCountTainted(); |
1360 | } | 1358 | } |
1361 | 1359 | ||
1360 | group.DeleteGroup(); | ||
1362 | group.DeleteParts(); | 1361 | group.DeleteParts(); |
1363 | 1362 | ||
1364 | // In case anybody else retains a reference to this group, signal deletion by changing the name | 1363 | // In case anybody else retains a reference to this group, signal deletion by changing the name |
@@ -1368,7 +1367,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
1368 | // conditions where a user deletes an entity while it is being stored. Really, the update | 1367 | // conditions where a user deletes an entity while it is being stored. Really, the update |
1369 | // code needs a redesign. | 1368 | // code needs a redesign. |
1370 | group.Name = null; | 1369 | group.Name = null; |
1371 | } | 1370 | } |
1371 | |||
1372 | /// <summary> | ||
1373 | /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the | ||
1374 | /// object itself is not destroyed. | ||
1375 | /// </summary> | ||
1376 | /// <param name="uuid"></param> | ||
1377 | /// <returns>true if the object was in the scene, false if it was not</returns> | ||
1378 | public bool UnlinkSceneObject(LLUUID uuid) | ||
1379 | { | ||
1380 | if (m_innerScene.DeleteSceneObject(uuid)) | ||
1381 | { | ||
1382 | m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); | ||
1383 | |||
1384 | return true; | ||
1385 | } | ||
1386 | |||
1387 | return false; | ||
1388 | } | ||
1372 | 1389 | ||
1373 | public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) | 1390 | public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) |
1374 | { | 1391 | { |
@@ -1971,23 +1988,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1971 | 1988 | ||
1972 | #region Entities | 1989 | #region Entities |
1973 | 1990 | ||
1974 | /// <summary> | ||
1975 | /// | ||
1976 | /// </summary> | ||
1977 | /// <param name="entID"></param> | ||
1978 | /// <returns></returns> | ||
1979 | public bool DeleteEntity(LLUUID entID) | ||
1980 | { | ||
1981 | if (Entities.ContainsKey(entID)) | ||
1982 | { | ||
1983 | Entities.Remove(entID); | ||
1984 | m_storageManager.DataStore.RemoveObject(entID, m_regInfo.RegionID); | ||
1985 | m_innerScene.RemoveAPrimCount(); | ||
1986 | return true; | ||
1987 | } | ||
1988 | return false; | ||
1989 | } | ||
1990 | |||
1991 | public void SendKillObject(uint localID) | 1991 | public void SendKillObject(uint localID) |
1992 | { | 1992 | { |
1993 | Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); | 1993 | Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index f4e1ef4..3407d4e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1744,9 +1744,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1744 | part.ClearUndoState(); | 1744 | part.ClearUndoState(); |
1745 | } | 1745 | } |
1746 | 1746 | ||
1747 | DetachFromBackup(objectGroup); | 1747 | m_scene.UnlinkSceneObject(objectGroup.UUID); |
1748 | |||
1749 | m_scene.DeleteEntity(objectGroup.UUID); | ||
1750 | 1748 | ||
1751 | // TODO Deleting the parts may cause problems later on if they have already | 1749 | // TODO Deleting the parts may cause problems later on if they have already |
1752 | // made it into the update queue. However, sending out updates for those parts is now | 1750 | // made it into the update queue. However, sending out updates for those parts is now |