diff options
author | Justin Clark-Casey (justincc) | 2011-08-01 06:15:02 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-01 06:15:02 +0100 |
commit | 6618948ff9b1e98b52f3067855ca1b05e7e36144 (patch) | |
tree | b3ef19012f0dff5d118e4c1f56731ed469324ea1 /OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |
parent | minor: add note to RemovePrimThreadLocked() to the effect that it contrary to... (diff) | |
download | opensim-SC-6618948ff9b1e98b52f3067855ca1b05e7e36144.zip opensim-SC-6618948ff9b1e98b52f3067855ca1b05e7e36144.tar.gz opensim-SC-6618948ff9b1e98b52f3067855ca1b05e7e36144.tar.bz2 opensim-SC-6618948ff9b1e98b52f3067855ca1b05e7e36144.tar.xz |
refactor: centralize prim geom removal code from four places to one
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 4419dff..3402be2 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -2094,6 +2094,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2094 | 2094 | ||
2095 | public override void RemovePrim(PhysicsActor prim) | 2095 | public override void RemovePrim(PhysicsActor prim) |
2096 | { | 2096 | { |
2097 | // As with all ODE physics operations, we don't remove the prim immediately but signal that it should be | ||
2098 | // removed in the next physics simulate pass. | ||
2097 | if (prim is OdePrim) | 2099 | if (prim is OdePrim) |
2098 | { | 2100 | { |
2099 | lock (OdeLock) | 2101 | lock (OdeLock) |
@@ -2169,24 +2171,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2169 | //} | 2171 | //} |
2170 | //} | 2172 | //} |
2171 | //m_log.Warn(prim.prim_geom); | 2173 | //m_log.Warn(prim.prim_geom); |
2172 | try | 2174 | |
2173 | { | 2175 | if (!prim.RemoveGeom()) |
2174 | if (prim.prim_geom != IntPtr.Zero) | 2176 | m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene"); |
2175 | { | 2177 | |
2176 | d.GeomDestroy(prim.prim_geom); | ||
2177 | prim.prim_geom = IntPtr.Zero; | ||
2178 | } | ||
2179 | else | ||
2180 | { | ||
2181 | m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene"); | ||
2182 | } | ||
2183 | } | ||
2184 | catch (AccessViolationException) | ||
2185 | { | ||
2186 | m_log.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed."); | ||
2187 | } | ||
2188 | lock (_prims) | 2178 | lock (_prims) |
2189 | _prims.Remove(prim); | 2179 | _prims.Remove(prim); |
2190 | 2180 | ||
2191 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore | 2181 | //If there are no more geometries in the sub-space, we don't need it in the main space anymore |
2192 | //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) | 2182 | //if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) |