Another attempt to add SOG/SOP to ScenePresence so it can be handled by bucket update code

dsg
Robert Adams 2011-02-18 17:16:57 -08:00
parent a25eac0a40
commit 1ff16c93a3
8 changed files with 55 additions and 25 deletions

View File

@ -273,7 +273,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{
m_presenceUpdates[presence.UUID] = presence;
}
//m_log.WarnFormat("[REGION SYNC SERVER MODULE] QueuePresenceForUpdate: {0}", presence.UUID.ToString());
m_log.WarnFormat("[REGION SYNC SERVER MODULE] QueuePresenceForUpdate: {0}", presence.UUID.ToString());
}
public void SendUpdates()

View File

@ -253,7 +253,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap data = new OSDMap();
data["UUID"] = OSD.FromUUID(updatedPart.UUID);
// data["UUID"] = OSD.FromUUID(updatedPart.UUID);
data["UUID"] = OSD.FromUUID(pa.UUID);
data["Bucket"] = OSD.FromString(bucketName);
data["GroupPosition"] = OSD.FromVector3(updatedPart.GroupPosition);
@ -280,7 +281,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["LastUpdateActorID"] = OSD.FromString(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID);
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedBucketProperties, OSDParser.SerializeJsonString(data));
m_log.DebugFormat("{0}: PhysBucketSender for {1}", LogHeader, updatedPart.UUID.ToString());
m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString());
SendObjectUpdateToRelevantSyncConnectors(updatedPart, syncMsg);
}
}
@ -409,6 +410,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}
List<ScenePresence> presenceUpdates = new List<ScenePresence>();
/*
if (m_presenceUpdates.Count > 0)
{
lock (m_updateScenePresenceLock)
@ -418,6 +420,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_presenceUpdates.Clear();
}
}
*/
if (updated)
{
@ -458,19 +461,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{
if (!presence.IsDeleted)
{
// Robert admits to doing this terrible kludge
// Someday, ScenePresences will be properly handled but, for the moment,
// we convert a ScenePresence update to a physics bucket transmission.
SceneObjectPart sop = new SceneObjectPart(presence.UUID, new PrimitiveBaseShape(),
Vector3.Zero, Quaternion.Identity, Vector3.Zero);
sop.PhysActor = presence.PhysicsActor;
sop.UUID = presence.UUID;
sop.BucketSyncInfoList = new Dictionary<string, BucketSyncInfo>();
sop.BucketSyncInfoList.Add("Physics", new BucketSyncInfo(DateTime.Now.Ticks, ActorID, "Physics"));
List<SceneObjectPart> lsop = new List<SceneObjectPart>();
lsop.Add(sop);
PrimUpdatesPhysicsBucketSender("Physics", lsop);
/*
OSDMap data = new OSDMap(10);
data["id"] = OSD.FromUUID(presence.UUID);
@ -1525,6 +1515,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
UUID partUUID = data["UUID"].AsUUID();
string bucketName = data["Bucket"].AsString();
m_log.DebugFormat("{0}: HandleUpdatedBucketProperties {1}: for {2}/{3}", LogHeader, senderActorID, partUUID.ToString(), bucketName);
/* Commented out since OSDMap is now passed all the way through to the unpacker.
* Previous implementation is to create a SOP and copy the values into same and copy them out later.
SceneObjectPart updatedPart = new SceneObjectPart();

View File

@ -2436,8 +2436,14 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart localPart = GetSceneObjectPart(partUUID);
if (localPart == null)
{
m_log.Warn("No SOP found: UUID -- " + partUUID);
return Scene.ObjectUpdateResult.Unchanged;
// it's not a prim. Maybe it's a ScenePresence
ScenePresence sp;
if (!m_parentScene.TryGetScenePresence(partUUID, out sp))
{
m_log.Warn("No SOP found: UUID -- " + partUUID);
return Scene.ObjectUpdateResult.Unchanged;
}
localPart = sp.RegionSyncSOP;
}
return localPart.UpdateBucketProperties(bucketName, updatedPart, bucketSyncInfo);
}

View File

@ -2745,12 +2745,23 @@ namespace OpenSim.Region.Framework.Scenes
{
Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0);
if (m_parentGroup == null)
{
m_log.Error("[SCENE OBJECT PART]: PhysicsRequestingTerseUpdate: m_parentGroup is null!");
return;
}
if (m_parentGroup.Scene == null)
{
m_log.Error("[SCENE OBJECT PART]: PhysicsRequestingTerseUpdate: m_parentGroup.Scene is null!");
return;
}
if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W))
{
m_parentGroup.AbsolutePosition = newpos;
return;
}
m_log.DebugFormat("[PHYSICS]: TerseUpdate: newpos={0}", newpos.ToString());
//m_parentGroup.RootPart.m_groupPosition = newpos;
}
//ScheduleTerseUpdate();
@ -5447,6 +5458,8 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart localPart = this;
PhysicsActor pa = localPart.PhysActor;
m_log.DebugFormat("{0}: PhysicsBucketUpdateProcessor. pos={1}", "[SCENE OBJECT PART]", data["Position"].AsVector3().ToString());
lock (m_bucketUpdateLocks[bucketName])
{
localPart.GroupPosition = data["GroupPosition"].AsVector3();
@ -5502,7 +5515,7 @@ namespace OpenSim.Region.Framework.Scenes
}
long timeStamp = DateTime.Now.Ticks;
m_log.Debug("InitializeBucketSyncInfo called at " + timeStamp);
// m_log.Debug("InitializeBucketSyncInfo called at " + timeStamp);
for (int i = 0; i < m_propertyBucketNames.Count; i++)
{

View File

@ -112,6 +112,14 @@ namespace OpenSim.Region.Framework.Scenes
}
protected List<SceneObjectGroup> m_attachments = new List<SceneObjectGroup>();
// SYMMETRIC SYNC: used to make a ScenePresence look like a SceneObjectPart for synchronization
private SceneObjectGroup m_sog;
private SceneObjectPart m_sop;
public SceneObjectPart RegionSyncSOP
{
get { return m_sop; }
}
private Dictionary<UUID, ScriptControllers> scriptedcontrols = new Dictionary<UUID, ScriptControllers>();
private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO;
private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO;
@ -2443,14 +2451,19 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SendTerseUpdateToAllClients()
{
m_log.DebugFormat("[SCENE PRESENCE]: TerseUpdate: pos={0}", m_physicsActor.Position.ToString());
// REGION SYNC
if (m_scene.IsSyncedServer())
{
// the old and new systems live in parallel
m_scene.RegionSyncModule.QueueScenePresenceForTerseUpdate(this);
m_scene.RegionSyncServerModule.QueuePresenceForTerseUpdate(this);
return;
}
if (m_scene.RegionSyncModule.Active)
{
m_sop.PhysicsRequestingTerseUpdate();
m_scene.RegionSyncModule.QueueSceneObjectPartForUpdate(m_sop);
}
if (m_scene.IsSyncedServer() || m_scene.RegionSyncModule.Active)
return;
m_perfMonMS = Util.EnvironmentTickCount();
@ -3378,6 +3391,12 @@ namespace OpenSim.Region.Framework.Scenes
m_physicsActor.SubscribeEvents(500);
m_physicsActor.LocalID = LocalId;
m_physicsActor.UUID = this.UUID;
m_sop = new SceneObjectPart(this.UUID, new PrimitiveBaseShape(), Vector3.Zero, Quaternion.Identity, Vector3.Zero);
m_sop.PhysActor = m_physicsActor;
m_sop.InitializeBucketSyncInfo();
m_sog = new SceneObjectGroup(m_sop, true);
m_sog.Scene = m_scene;
}
private void OutOfBoundsCall(Vector3 pos)

View File

@ -1355,7 +1355,6 @@ namespace OpenSim.Region.Physics.OdePlugin
_position.Z = m_taintPosition.Z;
}
}
Console.WriteLine("ODECharacter: ProcessTaints: doing update");
this.RequestPhysicsterseUpdate();
}

View File

@ -155,7 +155,7 @@ public class PECharacter : PhysicsActor
public override Vector3 Velocity {
get { return _velocity; }
set { _velocity = value;
// SyncUpdated = true;
SyncUpdated = true;
}
}
public override Vector3 Torque {

View File

@ -124,6 +124,7 @@ public class PEScene : PhysicsScene
// if the values have changed and it was I who changed them, send an update
if (actor.SyncUpdated)
{
actor.SyncUpdated = false;
actor.RequestPhysicsterseUpdate();
}
}