diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 71 |
1 files changed, 29 insertions, 42 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index bbe8bd9..e30813c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1335,22 +1335,40 @@ 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 | /// Remove an object from the scene | 1341 | /// Delete this object from the scene. |
1342 | /// </summary> | 1342 | /// </summary> |
1343 | /// <param name="sceneObject"></param> | 1343 | /// <param name="group"></param> |
1344 | public void RemoveSceneObject(SceneObjectGroup sceneObject) | 1344 | public void DeleteSceneObject(SceneObjectGroup group) |
1345 | { | 1345 | { |
1346 | if (Entities.ContainsKey(sceneObject.UUID)) | 1346 | SceneObjectPart rootPart = (group).GetChildPart(group.UUID); |
1347 | if (rootPart.PhysActor != null) | ||
1348 | { | ||
1349 | PhysicsScene.RemovePrim(rootPart.PhysActor); | ||
1350 | rootPart.PhysActor = null; | ||
1351 | } | ||
1352 | |||
1353 | m_storageManager.DataStore.RemoveObject(group.UUID, m_regInfo.RegionID); | ||
1354 | group.DeleteGroup(); | ||
1355 | |||
1356 | if (m_innerScene.DeleteSceneObject(group.UUID)) | ||
1347 | { | 1357 | { |
1348 | EventManager.TriggerObjectBeingRemovedFromScene(sceneObject); | 1358 | EventManager.TriggerObjectBeingRemovedFromScene(group); |
1349 | Entities.Remove(sceneObject.UUID); | ||
1350 | EventManager.TriggerParcelPrimCountTainted(); | 1359 | EventManager.TriggerParcelPrimCountTainted(); |
1351 | m_innerScene.RemoveAPrimCount(); | ||
1352 | } | 1360 | } |
1353 | } | 1361 | |
1362 | group.DeleteParts(); | ||
1363 | |||
1364 | // In case anybody else retains a reference to this group, signal deletion by changing the name | ||
1365 | // to null. We can't zero out the UUID because this is taken from the root part, which has already | ||
1366 | // been removed. | ||
1367 | // FIXME: This is a really poor temporary solution, since it still leaves plenty of scope for race | ||
1368 | // conditions where a user deletes an entity while it is being stored. Really, the update | ||
1369 | // code needs a redesign. | ||
1370 | group.Name = null; | ||
1371 | } | ||
1354 | 1372 | ||
1355 | public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) | 1373 | public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) |
1356 | { | 1374 | { |
@@ -1411,7 +1429,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1411 | // We remove the object here | 1429 | // We remove the object here |
1412 | try | 1430 | try |
1413 | { | 1431 | { |
1414 | DeleteSceneObjectGroup(grp); | 1432 | DeleteSceneObject(grp); |
1415 | } | 1433 | } |
1416 | catch (Exception) | 1434 | catch (Exception) |
1417 | { | 1435 | { |
@@ -1473,7 +1491,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1473 | // We remove the object here | 1491 | // We remove the object here |
1474 | try | 1492 | try |
1475 | { | 1493 | { |
1476 | DeleteSceneObjectGroup(grp); | 1494 | DeleteSceneObject(grp); |
1477 | } | 1495 | } |
1478 | catch (Exception) | 1496 | catch (Exception) |
1479 | { | 1497 | { |
@@ -3142,37 +3160,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
3142 | } | 3160 | } |
3143 | 3161 | ||
3144 | /// <summary> | 3162 | /// <summary> |
3145 | /// Delete this object from the scene. | ||
3146 | /// </summary> | ||
3147 | /// <param name="group"></param> | ||
3148 | public void DeleteSceneObjectGroup(SceneObjectGroup group) | ||
3149 | { | ||
3150 | SceneObjectPart rootPart = (group).GetChildPart(group.UUID); | ||
3151 | if (rootPart.PhysActor != null) | ||
3152 | { | ||
3153 | PhysicsScene.RemovePrim(rootPart.PhysActor); | ||
3154 | rootPart.PhysActor = null; | ||
3155 | } | ||
3156 | |||
3157 | m_storageManager.DataStore.RemoveObject(group.UUID, m_regInfo.RegionID); | ||
3158 | group.DeleteGroup(); | ||
3159 | |||
3160 | lock (Entities) | ||
3161 | { | ||
3162 | RemoveSceneObject(group); | ||
3163 | } | ||
3164 | group.DeleteParts(); | ||
3165 | |||
3166 | // In case anybody else retains a reference to this group, signal deletion by changing the name | ||
3167 | // to null. We can't zero out the UUID because this is taken from the root part, which has already | ||
3168 | // been removed. | ||
3169 | // FIXME: This is a really poor temporary solution, since it still leaves plenty of scope for race | ||
3170 | // conditions where a user deletes an entity while it is being stored. Really, the update | ||
3171 | // code needs a redesign. | ||
3172 | group.Name = null; | ||
3173 | } | ||
3174 | |||
3175 | /// <summary> | ||
3176 | /// | 3163 | /// |
3177 | /// </summary> | 3164 | /// </summary> |
3178 | /// <param name="action"></param> | 3165 | /// <param name="action"></param> |