Merge branch 'dev' of ssh://sceneapi@island.sciencesim.com/home/sceneapi/sceneapi into dev

dsg
Huaiyu (Kitty) Liu 2011-03-17 17:20:58 -07:00
commit b7dc2af5e6
5 changed files with 104 additions and 4 deletions

View File

@ -245,10 +245,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false);
m_elapsedMSSinceLastStatReport = Environment.TickCount; m_elapsedMSSinceLastStatReport = Environment.TickCount;
/*
System.Timers.Timer packet_type_timer = new System.Timers.Timer(60000); System.Timers.Timer packet_type_timer = new System.Timers.Timer(60000);
packet_type_timer.Elapsed +=new System.Timers.ElapsedEventHandler(packet_type_timer_Elapsed); packet_type_timer.Elapsed +=new System.Timers.ElapsedEventHandler(packet_type_timer_Elapsed);
packet_type_timer.AutoReset = true; packet_type_timer.AutoReset = true;
packet_type_timer.Start(); packet_type_timer.Start();
*/
} }
void packet_type_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) void packet_type_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
@ -256,7 +258,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
for (int i = 0; i < 9; ++i) for (int i = 0; i < 9; ++i)
{ {
int val = Interlocked.Exchange(ref OutgoingPacket.CatCounts[i], 0); int val = Interlocked.Exchange(ref OutgoingPacket.CatCounts[i], 0);
m_log.WarnFormat("OutgoingPacket type {0} count = {1}", i, val); m_log.DebugFormat("OutgoingPacket type {0} count = {1}", i, val);
} }
} }

View File

@ -13,6 +13,7 @@ using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Region.Physics.Manager;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using log4net; using log4net;
using System.Net; using System.Net;
@ -618,6 +619,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case EventManager.EventNames.Attach: case EventManager.EventNames.Attach:
OnLocalAttach((uint)evArgs[0], (UUID)evArgs[1], (UUID)evArgs[2]); OnLocalAttach((uint)evArgs[0], (UUID)evArgs[1], (UUID)evArgs[2]);
return; return;
case EventManager.EventNames.PhysicsCollision:
OnLocalPhysicsCollision((UUID)evArgs[0], (OSDArray)evArgs[1]);
return;
default: default:
return; return;
} }
@ -1749,6 +1753,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case SymmetricSyncMessage.MsgType.ObjectGrabbing: case SymmetricSyncMessage.MsgType.ObjectGrabbing:
case SymmetricSyncMessage.MsgType.ObjectDeGrab: case SymmetricSyncMessage.MsgType.ObjectDeGrab:
case SymmetricSyncMessage.MsgType.Attach: case SymmetricSyncMessage.MsgType.Attach:
case SymmetricSyncMessage.MsgType.PhysicsCollision:
{ {
HandleRemoteEvent(msg, senderActorID); HandleRemoteEvent(msg, senderActorID);
return; return;
@ -2198,6 +2203,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
case SymmetricSyncMessage.MsgType.Attach: case SymmetricSyncMessage.MsgType.Attach:
HandleRemoteEvent_OnAttach(init_actorID, evSeqNum, data); HandleRemoteEvent_OnAttach(init_actorID, evSeqNum, data);
break; break;
case SymmetricSyncMessage.MsgType.PhysicsCollision:
HandleRemoteEvent_PhysicsCollision(init_actorID, evSeqNum, data);
break;
} }
} }
@ -2504,7 +2512,33 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
uint localID = part.LocalId; uint localID = part.LocalId;
m_scene.EventManager.TriggerOnAttachLocally(localID, itemID, avatarID); m_scene.EventManager.TriggerOnAttachLocally(localID, itemID, avatarID);
}
private void HandleRemoteEvent_PhysicsCollision(string actorID, ulong evSeqNum, OSDMap data)
{
UUID primUUID = data["primUUID"].AsUUID();
OSDArray collisionLocalIDs = (OSDArray)data["collisionLocalIDs"];
SceneObjectPart part = m_scene.GetSceneObjectPart(primUUID);
if (part == null)
{
m_log.WarnFormat("{0}: HandleRemoteEvent_PhysicsCollision: no part with UUID {1} found", LogHeader, primUUID);
return;
}
if (collisionLocalIDs == null)
{
m_log.WarnFormat("{0}: HandleRemoteEvent_PhysicsCollision: no collisionLocalIDs", LogHeader);
return;
}
// Build up the collision list. The contact point is ignored so we generate some default.
CollisionEventUpdate e = new CollisionEventUpdate();
foreach (uint collisionID in collisionLocalIDs)
{
// e.addCollider(collisionID, new ContactPoint());
e.addCollider(collisionID, new ContactPoint(Vector3.Zero, Vector3.UnitX, 0.03f));
}
part.PhysicsCollisionLocally(e);
} }
/// <summary> /// <summary>
@ -2655,6 +2689,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SendSceneEvent(SymmetricSyncMessage.MsgType.Attach, data); SendSceneEvent(SymmetricSyncMessage.MsgType.Attach, data);
} }
private void OnLocalPhysicsCollision(UUID partUUID, OSDArray collisionLocalIDs)
{
OSDMap data = new OSDMap();
data["primUUID"] = OSD.FromUUID(partUUID);
data["collisionLocalIDs"] = collisionLocalIDs;
SendSceneEvent(SymmetricSyncMessage.MsgType.PhysicsCollision, data);
}
private void OnLocalGrabObject(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) private void OnLocalGrabObject(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{ {
/* /*

View File

@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
ObjectGrabbing, ObjectGrabbing,
ObjectDeGrab, ObjectDeGrab,
Attach, Attach,
PhysicsCollision,
//contorl command //contorl command
SyncStateReport, SyncStateReport,
} }

View File

@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes
ObjectGrabbing, ObjectGrabbing,
ObjectDeGrab, ObjectDeGrab,
Attach, //attaching object to avatar Attach, //attaching object to avatar
PhysicsCollision,
} }
public EventManager(Scene scene) public EventManager(Scene scene)

View File

@ -2202,7 +2202,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
} }
public void PhysicsCollision(EventArgs e) public virtual void PhysicsCollision(EventArgs e)
{ {
// single threaded here // single threaded here
if (e == null) if (e == null)
@ -5502,6 +5502,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
localPart.AggregateScriptEvents = updatedPart.AggregateScriptEvents; localPart.AggregateScriptEvents = updatedPart.AggregateScriptEvents;
aggregateScriptEventSubscriptions();
m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp; m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp;
m_bucketSyncInfoList[bucketName].LastUpdateActorID = updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID; m_bucketSyncInfoList[bucketName].LastUpdateActorID = updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID;
@ -5525,6 +5526,36 @@ namespace OpenSim.Region.Framework.Scenes
m_bucketSyncInfoList[bucketName].TaintBucketBySync(); m_bucketSyncInfoList[bucketName].TaintBucketBySync();
} }
// Do any subscriptions based on the AggregateScriptEvents
protected void aggregateScriptEventSubscriptions()
{
if (
((AggregateScriptEvents & scriptEvents.collision) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
(CollisionSound != UUID.Zero)
)
{
// subscribe to physics updates.
if (PhysActor != null)
{
PhysActor.OnCollisionUpdate += PhysicsCollision;
PhysActor.SubscribeEvents(1000);
}
}
else
{
if (PhysActor != null)
{
PhysActor.UnSubscribeEvents();
PhysActor.OnCollisionUpdate -= PhysicsCollision;
}
}
}
//NOTE: only touch the properties and BucketSyncInfo that is related to the given bucketName. Other properties and //NOTE: only touch the properties and BucketSyncInfo that is related to the given bucketName. Other properties and
//buckets may not be filled at all in "updatedPart". //buckets may not be filled at all in "updatedPart".
@ -5951,6 +5982,30 @@ namespace OpenSim.Region.Framework.Scenes
} }
return false; return false;
} }
public override void PhysicsCollision(EventArgs e)
{
if (m_parentGroup.Scene.RegionSyncModule != null)
{
CollisionEventUpdate a = (CollisionEventUpdate)e;
Dictionary<uint, ContactPoint> collisionswith = a.m_objCollisionList;
OSDArray collisionLocalIDs = new OSDArray();
foreach (uint collisionObject in collisionswith.Keys)
{
collisionLocalIDs.Add(collisionObject);
}
object[] eventArgs = new object[2];
eventArgs[0] = this.UUID;
eventArgs[1] = collisionLocalIDs;
m_parentGroup.Scene.RegionSyncModule.PublishSceneEvent(EventManager.EventNames.PhysicsCollision, eventArgs);
}
PhysicsCollisionLocally(e);
}
public void PhysicsCollisionLocally(EventArgs e)
{
base.PhysicsCollision(e);
}
} }
//end of SYMMETRIC SYNC //end of SYMMETRIC SYNC