Converted PhysicsActor identification from localID to UUID

dsg
Robert Adams 2011-01-18 16:52:37 -08:00
parent 42563e77fa
commit c541b42f7e
8 changed files with 43 additions and 30 deletions

View File

@ -379,10 +379,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = RegionSyncUtil.DeserializeMessage(msg, LogHeader); OSDMap data = RegionSyncUtil.DeserializeMessage(msg, LogHeader);
try try
{ {
uint localID = data["localID"].AsUInteger(); UUID uuid = data["uuid"].AsUUID();
string actorID = data["actorID"].AsString(); string actorID = data["actorID"].AsString();
// m_log.DebugFormat("{0}: HandlPhysUpdateAttributes for {1}", LogHeader, localID); // m_log.DebugFormat("{0}: HandlPhysUpdateAttributes for {1}", LogHeader, uuid);
PhysicsActor pa = FindPhysicsActor(localID); PhysicsActor pa = FindPhysicsActor(uuid);
if (pa != null) if (pa != null)
{ {
// pa.Size = data["size"].AsVector3(); // pa.Size = data["size"].AsVector3();
@ -396,7 +396,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
pa.Flying = data["flying"].AsBoolean(); // receive?? pa.Flying = data["flying"].AsBoolean(); // receive??
pa.Kinematic = data["kinematic"].AsBoolean(); // receive?? pa.Kinematic = data["kinematic"].AsBoolean(); // receive??
pa.Buoyancy = (float)(data["buoyancy"].AsReal()); pa.Buoyancy = (float)(data["buoyancy"].AsReal());
SceneObjectPart sop = m_validLocalScene.GetSceneObjectPart(localID); SceneObjectPart sop = m_validLocalScene.GetSceneObjectPart(uuid);
if (sop != null) if (sop != null)
{ {
pa.Shape = sop.Shape; pa.Shape = sop.Shape;
@ -405,7 +405,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
else else
{ {
m_log.WarnFormat("{0}: attribute update for unknown localID {1}", LogHeader, localID); m_log.WarnFormat("{0}: attribute update for unknown uuid {1}", LogHeader, uuid);
return; return;
} }
} }
@ -418,14 +418,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
// Find the physics actor whether it is an object or a scene presence // Find the physics actor whether it is an object or a scene presence
private PhysicsActor FindPhysicsActor(uint localID) private PhysicsActor FindPhysicsActor(UUID uuid)
{ {
SceneObjectPart sop = m_validLocalScene.GetSceneObjectPart(localID); SceneObjectPart sop = m_validLocalScene.GetSceneObjectPart(uuid);
if (sop != null) if (sop != null)
{ {
return sop.PhysActor; return sop.PhysActor;
} }
ScenePresence sp = m_validLocalScene.GetScenePresence(localID); ScenePresence sp = m_validLocalScene.GetScenePresence(uuid);
if (sp != null) if (sp != null)
{ {
return sp.PhysicsActor; return sp.PhysicsActor;
@ -435,9 +435,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void SendPhysUpdateAttributes(PhysicsActor pa) public void SendPhysUpdateAttributes(PhysicsActor pa)
{ {
// m_log.DebugFormat("{0}: SendPhysUpdateAttributes for {1}", LogHeader, pa.LocalID); // m_log.DebugFormat("{0}: SendPhysUpdateAttributes for {1}", LogHeader, pa.UUID);
OSDMap data = new OSDMap(9); OSDMap data = new OSDMap(9);
data["localID"] = OSD.FromUInteger(pa.LocalID); data["localID"] = OSD.FromUInteger(pa.LocalID);
data["uuid"] = OSD.FromUUID(pa.UUID);
data["actorID"] = OSD.FromString(RegionSyncServerModule.ActorID); data["actorID"] = OSD.FromString(RegionSyncServerModule.ActorID);
data["size"] = OSD.FromVector3(pa.Size); data["size"] = OSD.FromVector3(pa.Size);
data["position"] = OSD.FromVector3(pa.Position); data["position"] = OSD.FromVector3(pa.Position);

View File

@ -240,7 +240,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
try try
{ {
sop = ss.GetSceneObjectPart(pa.LocalID); sop = ss.GetSceneObjectPart(pa.UUID);
} }
catch catch
{ {
@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
try try
{ {
sp = ss.GetScenePresence(pa.LocalID); sp = ss.GetScenePresence(pa.UUID);
} }
catch catch
{ {
@ -278,7 +278,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
else else
{ {
Console.WriteLine("RouteUpdate: no SOP found for {0}", pa.LocalID); Console.WriteLine("RouteUpdate: no SOP found for {0}", pa.UUID);
} }
return; return;
} }

View File

@ -296,16 +296,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = RegionSyncUtil.DeserializeMessage(msg, LogHeader); OSDMap data = RegionSyncUtil.DeserializeMessage(msg, LogHeader);
try try
{ {
uint localID = data["localID"].AsUInteger(); UUID uuid = data["uuid"].AsUUID();
// m_log.DebugFormat("{0}: received PhysUpdateAttributes for {1}", LogHeader, localID); // m_log.DebugFormat("{0}: received PhysUpdateAttributes for {1}", LogHeader, uuid);
PhysicsActor pa = FindPhysicsActor(localID); PhysicsActor pa = FindPhysicsActor(uuid);
if (pa != null) if (pa != null)
{ {
pa.RequestPhysicsterseUpdate(); pa.RequestPhysicsterseUpdate();
} }
else else
{ {
m_log.WarnFormat("{0}: terse update for unknown localID {1}", LogHeader, localID); m_log.WarnFormat("{0}: terse update for unknown uuid {1}", LogHeader, uuid);
return; return;
} }
} }
@ -339,10 +339,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = RegionSyncUtil.DeserializeMessage(msg, LogHeader); OSDMap data = RegionSyncUtil.DeserializeMessage(msg, LogHeader);
try try
{ {
uint localID = data["localID"].AsUInteger(); UUID uuid = data["uuid"].AsUUID();
string actorID = data["actorID"].AsString(); string actorID = data["actorID"].AsString();
// m_log.DebugFormat("{0}: received PhysUpdateAttributes for {1}", LogHeader, localID); // m_log.DebugFormat("{0}: received PhysUpdateAttributes for {1}", LogHeader, uuid);
PhysicsActor pa = FindPhysicsActor(localID); PhysicsActor pa = FindPhysicsActor(uuid);
if (pa != null) if (pa != null)
{ {
pa.ChangingActorID = actorID; pa.ChangingActorID = actorID;
@ -363,7 +363,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
else else
{ {
m_log.WarnFormat("{0}: attribute update for unknown localID {1}", LogHeader, localID); m_log.WarnFormat("{0}: attribute update for unknown uuid {1}", LogHeader, uuid);
return; return;
} }
} }
@ -376,14 +376,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
// Find the physics actor whether it is an object or a scene presence // Find the physics actor whether it is an object or a scene presence
private PhysicsActor FindPhysicsActor(uint localID) private PhysicsActor FindPhysicsActor(UUID uuid)
{ {
SceneObjectPart sop = m_scene.GetSceneObjectPart(localID); SceneObjectPart sop = m_scene.GetSceneObjectPart(uuid);
if (sop != null) if (sop != null)
{ {
return sop.PhysActor; return sop.PhysActor;
} }
ScenePresence sp = m_scene.GetScenePresence(localID); ScenePresence sp = m_scene.GetScenePresence(uuid);
if (sp != null) if (sp != null)
{ {
return sp.PhysicsActor; return sp.PhysicsActor;
@ -393,9 +393,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void SendPhysUpdateAttributes(PhysicsActor pa) public void SendPhysUpdateAttributes(PhysicsActor pa)
{ {
// m_log.DebugFormat("{0}: sending PhysUpdateAttributes for {1}", LogHeader, pa.LocalID); // m_log.DebugFormat("{0}: sending PhysUpdateAttributes for {1}", LogHeader, pa.UUID);
OSDMap data = new OSDMap(9); OSDMap data = new OSDMap(9);
data["localID"] = OSD.FromUInteger(pa.LocalID); data["localID"] = OSD.FromUInteger(pa.LocalID);
data["uuid"] = OSD.FromUUID(pa.UUID);
data["actorID"] = OSD.FromString(RegionSyncServerModule.ActorID); data["actorID"] = OSD.FromString(RegionSyncServerModule.ActorID);
data["size"] = OSD.FromVector3(pa.Size); data["size"] = OSD.FromVector3(pa.Size);
data["position"] = OSD.FromVector3(pa.Position); data["position"] = OSD.FromVector3(pa.Position);

View File

@ -231,7 +231,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
try try
{ {
sop = ss.GetSceneObjectPart(pa.LocalID); sop = ss.GetSceneObjectPart(pa.UUID);
} }
catch catch
{ {
@ -244,7 +244,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
else else
{ {
ScenePresence sp = ss.GetScenePresence(pa.LocalID); ScenePresence sp = ss.GetScenePresence(pa.UUID);
if (sp != null) if (sp != null)
{ {
s = ss; s = ss;
@ -260,12 +260,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
else else
{ {
Console.WriteLine("RouteUpdate: SceneToPhysEngineSyncServer is no available"); Console.WriteLine("RouteUpdate: SceneToPhysEngineSyncServer is not available");
} }
} }
else else
{ {
Console.WriteLine("RouteUpdate: no SOP for update of {0}", pa.LocalID); Console.WriteLine("RouteUpdate: no SOP for update of {0}", pa.UUID);
} }
return; return;
} }

View File

@ -1468,6 +1468,7 @@ namespace OpenSim.Region.Framework.Scenes
part.PhysActor.IsPhysical); part.PhysActor.IsPhysical);
part.PhysActor.LocalID = part.LocalId; part.PhysActor.LocalID = part.LocalId;
part.PhysActor.UUID = part.UUID;
part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
} }
} }

View File

@ -1593,6 +1593,7 @@ namespace OpenSim.Region.Framework.Scenes
PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info
PhysActor.SOPDescription = this.Description; PhysActor.SOPDescription = this.Description;
PhysActor.LocalID = LocalId; PhysActor.LocalID = LocalId;
PhysActor.UUID = UUID;
DoPhysicsPropertyUpdate(RigidBody, true); DoPhysicsPropertyUpdate(RigidBody, true);
PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0);
} }
@ -4440,6 +4441,7 @@ namespace OpenSim.Region.Framework.Scenes
if (pa != null) if (pa != null)
{ {
pa.LocalID = LocalId; pa.LocalID = LocalId;
pa.UUID = this.UUID;
DoPhysicsPropertyUpdate(UsePhysics, true); DoPhysicsPropertyUpdate(UsePhysics, true);
if (m_parentGroup != null) if (m_parentGroup != null)
{ {

View File

@ -3342,8 +3342,9 @@ namespace OpenSim.Region.Framework.Scenes
m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong m_physicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
m_physicsActor.SubscribeEvents(500); m_physicsActor.SubscribeEvents(500);
m_physicsActor.LocalID = LocalId; m_physicsActor.LocalID = LocalId;
m_physicsActor.UUID = this.UUID;
} }
private void OutOfBoundsCall(Vector3 pos) private void OutOfBoundsCall(Vector3 pos)
{ {
//bool flying = m_physicsActor.Flying; //bool flying = m_physicsActor.Flying;

View File

@ -185,10 +185,17 @@ namespace OpenSim.Region.Physics.Manager
// RA: used to be abstract but changed to allow 'get' without changing all the phys engines // RA: used to be abstract but changed to allow 'get' without changing all the phys engines
uint m_baseLocalID; uint m_baseLocalID;
public virtual uint LocalID { public virtual uint LocalID
{
set { m_baseLocalID = value; } set { m_baseLocalID = value; }
get { return m_baseLocalID; } get { return m_baseLocalID; }
} }
public UUID m_UUID;
public virtual UUID UUID
{
set { m_UUID = value; }
get { return m_UUID; }
}
public PhysActorLastValues lastValues; public PhysActorLastValues lastValues;
// ID of actor which last updated the values. Send if I did the change. // ID of actor which last updated the values. Send if I did the change.
public string ChangingActorID = "YY"; public string ChangingActorID = "YY";