* Applied patch 708 from devalnor. Thanks devalnor!

* ODE: Added support for larger box stacks. (they're slow, but they work)
* ODEPlugin no longer tries to 'catch up' with the simulator frame rate if it gets behind.  Catching up was causing a lot of problems with larger box stacks and other things that stall the simulator (like saving prim in the datastore)
0.6.0-stable
Teravus Ovares 2008-03-03 16:52:25 +00:00
parent 358a4963d3
commit d015356902
5 changed files with 134 additions and 90 deletions

View File

@ -46,6 +46,7 @@ Patches
* jimbo2120 (International Business Machines Corp.) * jimbo2120 (International Business Machines Corp.)
* brianw/Sir_Ahzz * brianw/Sir_Ahzz
* ChrisDown * ChrisDown
* devalnor-#708
LSL Devs LSL Devs

View File

@ -606,16 +606,47 @@ namespace OpenSim.Region.Environment.Scenes
public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID,
uint primLocalID) uint primLocalID)
{ {
SceneObjectGroup group = GetGroupByPrim(primLocalID); SceneObjectGroup group = GetGroupByPrim(primLocalID);
if (group != null) if (group != null)
{ {
// TODO Retrieve itemID from client's inventory to pass on LLUUID copyID = LLUUID.Random();
//group.AddInventoryItem(remoteClient, primLocalID, null); if (itemID != LLUUID.Zero)
m_log.InfoFormat( {
"[PRIM INVENTORY]: " + CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
"Non script prim inventory not yet implemented!"
+ "\nUpdateTaskInventory called with item {0}, folder {1}, primLocalID {2}, user {3}", if (userInfo != null && userInfo.RootFolder != null)
itemID, folderID, primLocalID, remoteClient.Name); {
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
// Try library
// XXX clumsy, possibly should be one call
if (null == item)
{
item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(itemID);
}
if (item != null)
{
group.AddInventoryItem(remoteClient, primLocalID, item, copyID);
m_log.InfoFormat("[PRIMINVENTORY]: Update with item {0} requested of prim {1} for {2}", item.inventoryName, primLocalID, remoteClient.Name);
group.GetProperties(remoteClient);
}
else
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!",
itemID, remoteClient.Name);
}
}
}
} }
else else
{ {

View File

@ -1844,7 +1844,7 @@ namespace OpenSim.Region.Environment.Scenes
m_log.Info("[PHYSICS]: Physical Object went out of bounds."); m_log.Info("[PHYSICS]: Physical Object went out of bounds.");
RemFlag(LLObject.ObjectFlags.Physics); RemFlag(LLObject.ObjectFlags.Physics);
DoPhysicsPropertyUpdate(false, true); DoPhysicsPropertyUpdate(false, true);
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); //m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
} }
public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient) public virtual void OnGrab(LLVector3 offsetPos, IClientAPI remoteClient)

View File

@ -617,20 +617,23 @@ namespace OpenSim.Region.Physics.OdePlugin
public void disableBody() public void disableBody()
{ {
//this kills the body so things like 'mesh' can re-create it. //this kills the body so things like 'mesh' can re-create it.
if (Body != (IntPtr) 0) lock (this)
{ {
m_collisionCategories &= ~CollisionCategories.Body; if (Body != (IntPtr)0)
m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
if (prim_geom != (IntPtr)0)
{ {
d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); m_collisionCategories &= ~CollisionCategories.Body;
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land);
}
_parent_scene.remActivePrim(this); if (prim_geom != (IntPtr)0)
d.BodyDestroy(Body); {
Body = (IntPtr) 0; d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
}
_parent_scene.remActivePrim(this);
d.BodyDestroy(Body);
Body = (IntPtr)0;
}
} }
m_disabled = true; m_disabled = true;
m_collisionscore = 0; m_collisionscore = 0;

View File

@ -661,7 +661,9 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
try try
{ {
d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback);
d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback);
} }
catch (AccessViolationException) catch (AccessViolationException)
{ {
@ -685,7 +687,10 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
try try
{ {
d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); lock (chr)
{
d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback);
}
} }
catch (AccessViolationException) catch (AccessViolationException)
{ {
@ -759,90 +764,93 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <param name="prim"></param> /// <param name="prim"></param>
public void RemovePrimThreadLocked(OdePrim prim) public void RemovePrimThreadLocked(OdePrim prim)
{ {
lock (ode) lock (prim)
{ {
if (prim.prim_geom != (IntPtr)0) lock (ode)
{ {
while (ode.lockquery()) if (prim.prim_geom != (IntPtr)0)
{ {
} while (ode.lockquery())
ode.dlock(world);
//System.Threading.Thread.Sleep(20);
prim.ResetTaints();
if (prim.IsPhysical)
{
prim.disableBody();
}
// we don't want to remove the main space
// If the geometry is in the targetspace, remove it from the target space
//m_log.Warn(prim.m_targetSpace);
//if (prim.m_targetSpace != (IntPtr)0)
//{
if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom))
{ {
}
ode.dlock(world);
//System.Threading.Thread.Sleep(20);
prim.ResetTaints();
if (d.GeomIsSpace(prim.m_targetSpace))
if (prim.IsPhysical)
{
prim.disableBody();
}
// we don't want to remove the main space
// If the geometry is in the targetspace, remove it from the target space
//m_log.Warn(prim.m_targetSpace);
//if (prim.m_targetSpace != (IntPtr)0)
//{
//if (d.SpaceQuery(prim.m_targetSpace, prim.prim_geom))
//{
//if (d.GeomIsSpace(prim.m_targetSpace))
//{
//waitForSpaceUnlock(prim.m_targetSpace);
//d.SpaceRemove(prim.m_targetSpace, prim.prim_geom);
prim.m_targetSpace = (IntPtr)0;
//}
//else
//{
// m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
//((OdePrim)prim).m_targetSpace.ToString());
//}
//}
//}
//m_log.Warn(prim.prim_geom);
try
{
if (prim.prim_geom != (IntPtr)0)
{ {
waitForSpaceUnlock(prim.m_targetSpace); d.GeomDestroy(prim.prim_geom);
d.SpaceRemove(prim.m_targetSpace, prim.prim_geom); prim.prim_geom = (IntPtr)0;
prim.m_targetSpace = (IntPtr) 0;
} }
else else
{ {
m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" + m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene");
((OdePrim)prim).m_targetSpace.ToString());
} }
} }
//} catch (System.AccessViolationException)
//m_log.Warn(prim.prim_geom);
try
{
if (prim.prim_geom != (IntPtr)0)
{ {
d.GeomDestroy(prim.prim_geom); m_log.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed.");
prim.prim_geom = (IntPtr)0;
}
else
{
m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene");
} }
_prims.Remove(prim);
//If there are no more geometries in the sub-space, we don't need it in the main space anymore
//if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0)
//{
//if (!(prim.m_targetSpace.Equals(null)))
//{
//if (d.GeomIsSpace(prim.m_targetSpace))
//{
//waitForSpaceUnlock(prim.m_targetSpace);
//d.SpaceRemove(space, prim.m_targetSpace);
// free up memory used by the space.
//d.SpaceDestroy(prim.m_targetSpace);
//int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position);
//resetSpaceArrayItemToZero(xyspace[0], xyspace[1]);
//}
//else
//{
//m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
//((OdePrim) prim).m_targetSpace.ToString());
//}
//}
//}
} }
catch (System.AccessViolationException)
{
m_log.Info("[PHYSICS]: Couldn't remove prim from physics scene, it was already be removed.");
}
_prims.Remove(prim);
//If there are no more geometries in the sub-space, we don't need it in the main space anymore ode.dunlock(world);
//if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0)
//{
//if (!(prim.m_targetSpace.Equals(null)))
//{
//if (d.GeomIsSpace(prim.m_targetSpace))
//{
//waitForSpaceUnlock(prim.m_targetSpace);
//d.SpaceRemove(space, prim.m_targetSpace);
// free up memory used by the space.
//d.SpaceDestroy(prim.m_targetSpace);
//int[] xyspace = calculateSpaceArrayItemFromPos(prim.Position);
//resetSpaceArrayItemToZero(xyspace[0], xyspace[1]);
//}
//else
//{
//m_log.Info("[Physics]: Invalid Scene passed to 'removeprim from scene':" +
//((OdePrim) prim).m_targetSpace.ToString());
//}
//}
//}
} }
ode.dunlock(world);
} }
} }
@ -934,7 +942,7 @@ namespace OpenSim.Region.Physics.OdePlugin
d.SpaceRemove(space, currentspace); d.SpaceRemove(space, currentspace);
// free up memory used by the space. // free up memory used by the space.
d.SpaceDestroy(currentspace); //d.SpaceDestroy(currentspace);
resetSpaceArrayItemToZero(currentspace); resetSpaceArrayItemToZero(currentspace);
} }
else else
@ -1236,7 +1244,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public override float Simulate(float timeStep) public override float Simulate(float timeStep)
{ {
float fps = 0; float fps = 0;
//m_log.Info(timeStep.ToString());
step_time += timeStep; step_time += timeStep;
@ -1275,8 +1283,9 @@ namespace OpenSim.Region.Physics.OdePlugin
// Figure out the Frames Per Second we're going at. // Figure out the Frames Per Second we're going at.
//(step_time == 0.004f, there's 250 of those per second. Times the step time/step size //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size
step_time = 0.09375f;
fps = (step_time/ODE_STEPSIZE) * 1000; fps = (step_time/ODE_STEPSIZE) * 1000;
while (step_time > 0.0f) while (step_time > 0.0f)
{ {
lock (ode) lock (ode)