Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Framework/Scenes/Scene.cs
	OpenSim/Region/Physics/Manager/PhysicsScene.cs
avinationmerge
Melanie 2012-08-01 23:03:03 +01:00
commit ecffcf7f65
13 changed files with 53 additions and 26 deletions

View File

@ -783,6 +783,7 @@ namespace OpenSim
scene.LoadWorldMap(); scene.LoadWorldMap();
scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset;
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight);

View File

@ -5816,5 +5816,21 @@ Environment.Exit(1);
{ {
GC.Collect(); GC.Collect();
} }
// Wrappers to get physics modules retrieve assets. Has to be done this way
// because we can't assign the asset service to physics directly - at the
// time physics are instantiated it's not registered but it will be by
// the time the first prim exists.
public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback)
{
AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived);
}
private void PhysicsAssetReceived(string id, Object sender, AssetBase asset)
{
AssetReceivedDelegate callback = (AssetReceivedDelegate)sender;
callback(asset);
}
} }
} }

View File

@ -86,7 +86,7 @@ public class BSConstraint : IDisposable
public bool SetCFMAndERP(float cfm, float erp) public bool SetCFMAndERP(float cfm, float erp)
{ {
bool ret = false; bool ret = true;
BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL); BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_CFM, cfm, ConstraintParamAxis.AXIS_ALL);
BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL); BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_STOP_ERP, erp, ConstraintParamAxis.AXIS_ALL);
BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL); BulletSimAPI.SetConstraintParam2(m_constraint.Ptr, ConstraintParams.BT_CONSTRAINT_CFM, cfm, ConstraintParamAxis.AXIS_ALL);

View File

@ -187,6 +187,7 @@ public sealed class BSPrim : PhysicsActor
{ {
_mass = CalculateMass(); // changing size changes the mass _mass = CalculateMass(); // changing size changes the mass
BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical); BulletSimAPI.SetObjectScaleMass(_scene.WorldID, _localID, _scale, (IsPhysical ? _mass : 0f), IsPhysical);
DetailLog("{0}: setSize: size={1}, mass={2}, physical={3}", LocalID, _size, _mass, IsPhysical);
RecreateGeomAndObject(); RecreateGeomAndObject();
}); });
} }
@ -972,7 +973,7 @@ public sealed class BSPrim : PhysicsActor
if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z) if (_size.X == _size.Y && _size.Y == _size.Z && _size.X == _size.Z)
{ {
// m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size); // m_log.DebugFormat("{0}: CreateGeom: Defaulting to sphere of size {1}", LogHeader, _size);
if (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE) if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_SPHERE))
{ {
DetailLog("{0},CreateGeom,sphere", LocalID); DetailLog("{0},CreateGeom,sphere", LocalID);
_shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE; _shapeType = ShapeData.PhysicsShapeType.SHAPE_SPHERE;
@ -986,7 +987,7 @@ public sealed class BSPrim : PhysicsActor
else else
{ {
// m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size); // m_log.DebugFormat("{0}: CreateGeom: Defaulting to box. lid={1}, type={2}, size={3}", LogHeader, LocalID, _shapeType, _size);
if (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX) if (forceRebuild || (_shapeType != ShapeData.PhysicsShapeType.SHAPE_BOX))
{ {
DetailLog("{0},CreateGeom,box", LocalID); DetailLog("{0},CreateGeom,box", LocalID);
_shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX; _shapeType = ShapeData.PhysicsShapeType.SHAPE_BOX;
@ -1201,7 +1202,8 @@ public sealed class BSPrim : PhysicsActor
// Create an object in Bullet if it has not already been created // Create an object in Bullet if it has not already been created
// No locking here because this is done when the physics engine is not simulating // No locking here because this is done when the physics engine is not simulating
private void CreateObject() // Returns 'true' if an object was actually created.
private bool CreateObject()
{ {
// this routine is called when objects are rebuilt. // this routine is called when objects are rebuilt.
@ -1209,10 +1211,12 @@ public sealed class BSPrim : PhysicsActor
ShapeData shape; ShapeData shape;
FillShapeInfo(out shape); FillShapeInfo(out shape);
// m_log.DebugFormat("{0}: CreateObject: lID={1}, shape={2}", LogHeader, _localID, shape.Type); // m_log.DebugFormat("{0}: CreateObject: lID={1}, shape={2}", LogHeader, _localID, shape.Type);
BulletSimAPI.CreateObject(_scene.WorldID, shape); bool ret = BulletSimAPI.CreateObject(_scene.WorldID, shape);
// the CreateObject() may have recreated the rigid body. Make sure we have the latest. // the CreateObject() may have recreated the rigid body. Make sure we have the latest.
m_body.Ptr = BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID); m_body.Ptr = BulletSimAPI.GetBodyHandle2(_scene.World.Ptr, LocalID);
return ret;
} }
// Copy prim's info into the BulletSim shape description structure // Copy prim's info into the BulletSim shape description structure
@ -1327,7 +1331,6 @@ public sealed class BSPrim : PhysicsActor
base.RequestPhysicsterseUpdate(); base.RequestPhysicsterseUpdate();
} }
/*
else else
{ {
// For debugging, we can also report the movement of children // For debugging, we can also report the movement of children
@ -1335,7 +1338,6 @@ public sealed class BSPrim : PhysicsActor
LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, LocalID, entprop.Position, entprop.Rotation, entprop.Velocity,
entprop.Acceleration, entprop.RotationalVelocity); entprop.Acceleration, entprop.RotationalVelocity);
} }
*/
} }
// I've collided with something // I've collided with something

View File

@ -87,12 +87,12 @@ public struct ShapeData
public System.UInt64 MeshKey; public System.UInt64 MeshKey;
public float Friction; public float Friction;
public float Restitution; public float Restitution;
public int Collidable; public float Collidable; // true of things bump into this
public int Static; // true if a static object. Otherwise gravity, etc. public float Static; // true if a static object. Otherwise gravity, etc.
// note that bools are passed as ints since bool size changes by language and architecture // note that bools are passed as floats since bool size changes by language and architecture
public const int numericTrue = 1; public const float numericTrue = 1f;
public const int numericFalse = 0; public const float numericFalse = 0f;
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct SweepHit public struct SweepHit

View File

@ -71,6 +71,9 @@ namespace OpenSim.Region.Physics.Manager
All = 0x3f All = 0x3f
} }
public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback);
public delegate void AssetReceivedDelegate(AssetBase asset);
/// <summary> /// <summary>
/// Contact result from a raycast. /// Contact result from a raycast.
/// </summary> /// </summary>
@ -103,6 +106,8 @@ namespace OpenSim.Region.Physics.Manager
get { return new NullPhysicsScene(); } get { return new NullPhysicsScene(); }
} }
public RequestAssetDelegate RequestAssetMethod { private get; set; }
public virtual void TriggerPhysicsBasedRestart() public virtual void TriggerPhysicsBasedRestart()
{ {
physicsCrash handler = OnPhysicsCrash; physicsCrash handler = OnPhysicsCrash;

View File

@ -60,8 +60,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
m_CmdManager = CmdManager; m_CmdManager = CmdManager;
maximumRange = CmdManager.m_ScriptEngine.Config.GetDouble("SensorMaxRange", 96.0d); maximumRange = CmdManager.m_ScriptEngine.Config.GetDouble("SensorMaxRange", 96.0d);
maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 16); maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 16);
m_npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>();
} }
private INPCModule m_npcModule;
private Object SenseLock = new Object(); private Object SenseLock = new Object();
private const int AGENT = 1; private const int AGENT = 1;
@ -451,8 +454,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
private List<SensedEntity> doAgentSensor(SenseRepeatClass ts) private List<SensedEntity> doAgentSensor(SenseRepeatClass ts)
{ {
INPCModule npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>();
List<SensedEntity> sensedEntities = new List<SensedEntity>(); List<SensedEntity> sensedEntities = new List<SensedEntity>();
// If nobody about quit fast // If nobody about quit fast
@ -488,7 +489,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0); bool attached = (SensePoint.ParentGroup.AttachmentPoint != 0);
Vector3 toRegionPos; Vector3 toRegionPos;
double dis; double dis;
Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence => Action<ScenePresence> senseEntity = new Action<ScenePresence>(presence =>
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
@ -497,7 +498,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc) if ((ts.type & NPC) == 0 && presence.PresenceType == PresenceType.Npc)
{ {
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); INPC npcData = m_npcModule.GetNPC(presence.UUID, presence.Scene);
if (npcData == null || !npcData.SenseAsAgent) if (npcData == null || !npcData.SenseAsAgent)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
@ -515,7 +516,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
} }
else else
{ {
INPC npcData = npcModule.GetNPC(presence.UUID, presence.Scene); INPC npcData = m_npcModule.GetNPC(presence.UUID, presence.Scene);
if (npcData != null && npcData.SenseAsAgent) if (npcData != null && npcData.SenseAsAgent)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(

View File

@ -122,7 +122,7 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping folder list: {0}", e.Message); m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception unwrapping folder list: ", e);
} }
return fldrs; return fldrs;
@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolderContent: {0}", e.Message); m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Exception in GetFolderContent: {0}", e.Message);
} }
return inventory; return inventory;
@ -432,7 +432,7 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetItem: {0}", e.Message); m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e);
} }
return null; return null;
@ -456,7 +456,7 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolder: {0}", e.Message); m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetFolder: ", e);
} }
return null; return null;
@ -525,7 +525,7 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetUserInventory: {0}", e.Message); m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetUserInventory: ", e);
} }
return inventory; return inventory;
@ -574,7 +574,7 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building folder: {0}", e.Message); m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception building folder: ", e);
} }
return folder; return folder;
@ -613,11 +613,10 @@ namespace OpenSim.Services.Connectors
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building item: {0}", e.Message); m_log.Error("[XINVENTORY CONNECTOR]: Exception building item: ", e);
} }
return item; return item;
} }
} }
} }

View File

@ -47,6 +47,9 @@ namespace pCampBot
{ {
Dictionary<UUID, Primitive> objects = Bot.Objects; Dictionary<UUID, Primitive> objects = Bot.Objects;
if (objects.Count <= 0)
return;
Primitive prim = objects.ElementAt(Bot.Random.Next(0, objects.Count - 1)).Value; Primitive prim = objects.ElementAt(Bot.Random.Next(0, objects.Count - 1)).Value;
// This appears to be a typical message sent when a viewer user clicks a clickable object // This appears to be a typical message sent when a viewer user clicks a clickable object

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.