* Tentative Bug fix for OptikSL's intermittant Copy prim error.

afrisby
Teravus Ovares 2007-11-18 17:25:12 +00:00
parent 615b40b68b
commit 7672237bcd
1 changed files with 23 additions and 13 deletions

View File

@ -200,8 +200,6 @@ namespace OpenSim.Region.Physics.OdePlugin
if (g1 == g2) if (g1 == g2)
return; // Can't collide with yourself return; // Can't collide with yourself
if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
return; return;
@ -457,7 +455,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// never be called if the prim is physical(active) // never be called if the prim is physical(active)
if (currentspace != space) if (currentspace != space)
{ {
if (d.SpaceQuery(currentspace, geom)) if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr)0)
{ {
d.SpaceRemove(currentspace, geom); d.SpaceRemove(currentspace, geom);
@ -466,12 +464,17 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
IntPtr sGeomIsIn = d.GeomGetSpace(geom); IntPtr sGeomIsIn = d.GeomGetSpace(geom);
if (!(sGeomIsIn.Equals(null))) if (!(sGeomIsIn.Equals(null)))
{
if (sGeomIsIn != (IntPtr)0)
d.SpaceRemove(sGeomIsIn, geom); d.SpaceRemove(sGeomIsIn, geom);
} }
}
//If there are no more geometries in the sub-space, we don't need it in the main space anymore //If there are no more geometries in the sub-space, we don't need it in the main space anymore
if (d.SpaceGetNumGeoms(currentspace) == 0) if (d.SpaceGetNumGeoms(currentspace) == 0)
{
if (currentspace != (IntPtr)0)
{ {
d.SpaceRemove(space, currentspace); d.SpaceRemove(space, currentspace);
// free up memory used by the space. // free up memory used by the space.
@ -479,21 +482,27 @@ namespace OpenSim.Region.Physics.OdePlugin
resetSpaceArrayItemToZero(currentspace); resetSpaceArrayItemToZero(currentspace);
} }
} }
}
else else
{ {
// this is a physical object that got disabled. ;.; // this is a physical object that got disabled. ;.;
if (d.SpaceQuery(currentspace, geom)) if (d.SpaceQuery(currentspace, geom))
{ {
if (currentspace != (IntPtr)0)
d.SpaceRemove(currentspace, geom); d.SpaceRemove(currentspace, geom);
} }
else else
{ {
IntPtr sGeomIsIn = d.GeomGetSpace(geom); IntPtr sGeomIsIn = d.GeomGetSpace(geom);
if (!(sGeomIsIn.Equals(null))) if (!(sGeomIsIn.Equals(null)))
{
if (sGeomIsIn != (IntPtr)0)
{
d.SpaceRemove(sGeomIsIn, geom); d.SpaceRemove(sGeomIsIn, geom);
} }
} }
}
}
// The routines in the Position and Size sections do the 'inserting' into the space, // The routines in the Position and Size sections do the 'inserting' into the space,
@ -1547,8 +1556,9 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
else else
{ {
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); m_targetSpace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace);
d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
d.SpaceAdd(m_targetSpace, prim_geom); d.SpaceAdd(m_targetSpace, prim_geom);
} }