Merge branch 'dev' into syncstats

Conflicts:
	OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs
	OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
dsg
Robert Adams 2011-03-11 16:02:00 -08:00
commit d70deaaa64
9 changed files with 220 additions and 137 deletions

View File

@ -212,6 +212,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
lock (m_primUpdateLocks[bucketName]) lock (m_primUpdateLocks[bucketName])
{ {
//m_log.Debug("Queueing to bucket " + bucketName + " with part " + part.Name + ", " + part.UUID);
m_primUpdates[bucketName][part.UUID] = part; m_primUpdates[bucketName][part.UUID] = part;
} }
} }
@ -255,6 +256,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
if (m_primUpdates[bucketName].Count > 0) if (m_primUpdates[bucketName].Count > 0)
{ {
//m_log.Debug(m_primUpdates[bucketName].Count + " updated parts in bucket " + bucketName);
lock (m_primUpdateLocks[bucketName]) lock (m_primUpdateLocks[bucketName])
{ {
updated = true; updated = true;
@ -309,6 +311,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
} }
* */ * */
//m_log.Debug(LogHeader + " calling update sender for bucket " + bucketName);
m_primUpdatesPerBucketSender[bucketName](bucketName, primUpdates[bucketName]); m_primUpdatesPerBucketSender[bucketName](bucketName, primUpdates[bucketName]);
} }
} }
@ -383,6 +386,24 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
} }
/// <summary>
/// Send a sync message to add the given object to other sync nodes.
/// </summary>
/// <param name="sog"></param>
public void SendNewObject(SceneObjectGroup sog)
{
if (!IsSyncingWithOtherActors())
{
//no SyncConnector connected. Do nothing.
return;
}
m_log.DebugFormat(LogHeader + "SendNewObject called for object {0}, {1}", sog.Name, sog.UUID);
string sogxml = SceneObjectSerializer.ToXml2Format(sog);
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, sogxml);
SendObjectUpdateToRelevantSyncConnectors(sog, rsm);
}
/// <summary> /// <summary>
/// Send a sync message to remove the given objects in all connected actors. /// Send a sync message to remove the given objects in all connected actors.
/// UUID is used for identified a removed object. This function now should /// UUID is used for identified a removed object. This function now should
@ -442,6 +463,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
partNum++; partNum++;
} }
m_log.Debug(LogHeader + " to SendLinkObject to link " + children.Count + " parts to " + root.Name);
m_log.Debug("LinkedObject: "+sogxml);
SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.LinkObject, OSDParser.SerializeJsonString(data)); SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.LinkObject, OSDParser.SerializeJsonString(data));
SendObjectUpdateToRelevantSyncConnectors(linkedGroup, rsm); SendObjectUpdateToRelevantSyncConnectors(linkedGroup, rsm);
} }
@ -600,10 +624,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//for debugging purpose //for debugging purpose
Command cmdSyncDebug = new Command("debug", CommandIntentions.COMMAND_HAZARDOUS, SyncDebug, "Trigger some debugging functions"); Command cmdSyncDebug = new Command("debug", CommandIntentions.COMMAND_HAZARDOUS, SyncDebug, "Trigger some debugging functions");
//for sync state comparison,
Command cmdSyncStateReport = new Command("state", CommandIntentions.COMMAND_HAZARDOUS, SyncStateReport, "Trigger synchronization state comparision functions");
m_commander.RegisterCommand("start", cmdSyncStart); m_commander.RegisterCommand("start", cmdSyncStart);
m_commander.RegisterCommand("stop", cmdSyncStop); m_commander.RegisterCommand("stop", cmdSyncStop);
m_commander.RegisterCommand("status", cmdSyncStatus); m_commander.RegisterCommand("status", cmdSyncStatus);
m_commander.RegisterCommand("debug", cmdSyncDebug); m_commander.RegisterCommand("debug", cmdSyncDebug);
m_commander.RegisterCommand("state", cmdSyncStateReport);
lock (m_scene) lock (m_scene)
{ {
@ -738,14 +766,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
updatedPart.UpdateTaintedBucketSyncInfo(bucketName, DateTime.Now.Ticks); updatedPart.UpdateTaintedBucketSyncInfo(bucketName, DateTime.Now.Ticks);
Physics.Manager.PhysicsActor pa = updatedPart.PhysActor;
if (pa == null)
return;
OSDMap data = new OSDMap(); OSDMap data = new OSDMap();
// data["UUID"] = OSD.FromUUID(updatedPart.UUID); data["UUID"] = OSD.FromUUID(updatedPart.UUID);
data["UUID"] = OSD.FromUUID(pa.UUID); //data["UUID"] = OSD.FromUUID(pa.UUID);
data["Bucket"] = OSD.FromString(bucketName); data["Bucket"] = OSD.FromString(bucketName);
data["GroupPosition"] = OSD.FromVector3(updatedPart.GroupPosition); data["GroupPosition"] = OSD.FromVector3(updatedPart.GroupPosition);
@ -753,24 +777,32 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
data["Scale"] = OSD.FromVector3(updatedPart.Scale); data["Scale"] = OSD.FromVector3(updatedPart.Scale);
data["AngularVelocity"] = OSD.FromVector3(updatedPart.AngularVelocity); data["AngularVelocity"] = OSD.FromVector3(updatedPart.AngularVelocity);
data["RotationOffset"] = OSD.FromQuaternion(updatedPart.RotationOffset); data["RotationOffset"] = OSD.FromQuaternion(updatedPart.RotationOffset);
data["Size"] = OSD.FromVector3(pa.Size);
data["Position"] = OSD.FromVector3(pa.Position); Physics.Manager.PhysicsActor pa = updatedPart.PhysActor;
data["Force"] = OSD.FromVector3(pa.Force); if (pa != null)
data["Velocity"] = OSD.FromVector3(pa.Velocity); {
data["RotationalVelocity"] = OSD.FromVector3(pa.RotationalVelocity);
data["PA_Acceleration"] = OSD.FromVector3(pa.Acceleration); data["Size"] = OSD.FromVector3(pa.Size);
data["Torque"] = OSD.FromVector3(pa.Torque); data["Position"] = OSD.FromVector3(pa.Position);
data["Orientation"] = OSD.FromQuaternion(pa.Orientation); data["Force"] = OSD.FromVector3(pa.Force);
data["IsPhysical"] = OSD.FromBoolean(pa.IsPhysical); data["Velocity"] = OSD.FromVector3(pa.Velocity);
data["Flying"] = OSD.FromBoolean(pa.Flying); data["RotationalVelocity"] = OSD.FromVector3(pa.RotationalVelocity);
data["Kinematic"] = OSD.FromBoolean(pa.Kinematic); data["PA_Acceleration"] = OSD.FromVector3(pa.Acceleration);
data["Buoyancy"] = OSD.FromReal(pa.Buoyancy); data["Torque"] = OSD.FromVector3(pa.Torque);
data["CollidingGround"] = OSD.FromBoolean(pa.CollidingGround); data["Orientation"] = OSD.FromQuaternion(pa.Orientation);
data["IsColliding"] = OSD.FromBoolean(pa.IsColliding); data["IsPhysical"] = OSD.FromBoolean(pa.IsPhysical);
data["Flying"] = OSD.FromBoolean(pa.Flying);
data["Kinematic"] = OSD.FromBoolean(pa.Kinematic);
data["Buoyancy"] = OSD.FromReal(pa.Buoyancy);
data["CollidingGround"] = OSD.FromBoolean(pa.CollidingGround);
data["IsColliding"] = OSD.FromBoolean(pa.IsColliding);
}
data["LastUpdateTimeStamp"] = OSD.FromLong(updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp); data["LastUpdateTimeStamp"] = OSD.FromLong(updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp);
data["LastUpdateActorID"] = OSD.FromString(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID); data["LastUpdateActorID"] = OSD.FromString(updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID);
//m_log.Debug(LogHeader + " Send out Physics Bucket updates for " + updatedPart.Name + ". GroupPosition: " + updatedPart.GroupPosition.ToString());
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedBucketProperties, OSDParser.SerializeJsonString(data)); SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedBucketProperties, OSDParser.SerializeJsonString(data));
//m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString()); //m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString());
lock (m_stats) m_statPhysBucketOut++; lock (m_stats) m_statPhysBucketOut++;
@ -846,6 +878,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
//string sogxml = SceneObjectSerializer.ToXml2Format(sog); //string sogxml = SceneObjectSerializer.ToXml2Format(sog);
//SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml); //SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml);
connector.EnqueueOutgoingUpdate(sog.UUID, syncMsg.ToBytes()); connector.EnqueueOutgoingUpdate(sog.UUID, syncMsg.ToBytes());
} }
} }
@ -1192,6 +1225,28 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
}); });
} }
private void SyncStateReport(Object[] args)
{
//Preliminary implementation
EntityBase[] entities = m_scene.GetEntities();
List<SceneObjectGroup> sogList = new List<SceneObjectGroup>();
foreach (EntityBase entity in entities)
{
if (entity is SceneObjectGroup)
{
sogList.Add((SceneObjectGroup)entity);
}
}
int primCount = 0;
foreach (SceneObjectGroup sog in sogList)
{
primCount += sog.Parts.Length;
}
m_log.WarnFormat("SyncStateReport -- Object count: {0}, Prim Count {1} ", sogList.Count, primCount);
}
private void SyncDebug(Object[] args) private void SyncDebug(Object[] args)
{ {
if (m_scene != null) if (m_scene != null)
@ -1436,6 +1491,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
return; return;
} }
case SymmetricSyncMessage.MsgType.NewObject: case SymmetricSyncMessage.MsgType.NewObject:
HandleAddNewObject(msg, senderActorID);
break;
case SymmetricSyncMessage.MsgType.UpdatedObject: case SymmetricSyncMessage.MsgType.UpdatedObject:
{ {
HandleAddOrUpdateObjectBySynchronization(msg, senderActorID); HandleAddOrUpdateObjectBySynchronization(msg, senderActorID);
@ -1503,12 +1560,32 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_log.Debug(LogHeader + ": Synchronized terrain"); m_log.Debug(LogHeader + ": Synchronized terrain");
} }
private void HandleAddNewObject(SymmetricSyncMessage msg, string senderActorID)
{
string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
m_log.DebugFormat("{0}: received NewObject sync message from {1}, for object {1}, {2}", LogHeader, senderActorID, sog.Name, sog.UUID);
Scene.ObjectUpdateResult updateResult = m_scene.AddOrUpdateObjectBySynchronization(sog);
}
private void HandleAddOrUpdateObjectBySynchronization(SymmetricSyncMessage msg, string senderActorID) private void HandleAddOrUpdateObjectBySynchronization(SymmetricSyncMessage msg, string senderActorID)
{ {
string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length); string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length);
SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml); SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml);
lock (m_stats) m_statSOGBucketIn++; lock (m_stats) m_statSOGBucketIn++;
//SYNC DEBUG
/*
string partnames = "";
foreach (SceneObjectPart part in sog.Parts)
{
partnames += "(" + part.Name + ", " + part.UUID + ")";
}
m_log.Debug(LogHeader+" received "+msg.Type.ToString()+" from "+senderActorID+" about obj "+sog.Name+", "+sog.UUID+"; parts -- "+partnames);
* */
if (sog.IsDeleted) if (sog.IsDeleted)
{ {
SymmetricSyncMessage.HandleTrivial(LogHeader, msg, String.Format("Ignoring update on deleted object, UUID: {0}.", sog.UUID)); SymmetricSyncMessage.HandleTrivial(LogHeader, msg, String.Format("Ignoring update on deleted object, UUID: {0}.", sog.UUID));
@ -1633,6 +1710,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
return data; return data;
} }
/*
private void HandleAddNewObject(SceneObjectGroup sog) private void HandleAddNewObject(SceneObjectGroup sog)
{ {
//RegionSyncModule only add object to SceneGraph. Any actor specific actions will be implemented //RegionSyncModule only add object to SceneGraph. Any actor specific actions will be implemented
@ -1644,6 +1722,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_log.Debug(LogHeader + ": added obj " + sog.UUID); m_log.Debug(LogHeader + ": added obj " + sog.UUID);
} }
} }
* */
private void HandleRemovedObject(SymmetricSyncMessage msg, string senderActorID) private void HandleRemovedObject(SymmetricSyncMessage msg, string senderActorID)
{ {
@ -1687,6 +1766,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void HandleLinkObject(SymmetricSyncMessage msg, string senderActorID) private void HandleLinkObject(SymmetricSyncMessage msg, string senderActorID)
{ {
// Get the data from message and error check // Get the data from message and error check
OSDMap data = DeserializeMessage(msg); OSDMap data = DeserializeMessage(msg);
if (data == null) if (data == null)
@ -1708,6 +1788,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
childrenIDs.Add(data[partTempID].AsUUID()); childrenIDs.Add(data[partTempID].AsUUID());
} }
m_log.Debug(LogHeader + " received LinkObject from " + senderActorID);
//m_log.Debug("LinkedObject: " + sogxml);
m_scene.LinkObjectBySync(linkedGroup, rootID, childrenIDs); m_scene.LinkObjectBySync(linkedGroup, rootID, childrenIDs);
//if this is a relay node, forwards the event //if this is a relay node, forwards the event
@ -2006,7 +2089,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
/// <param name="data">OSDMap data of event args</param> /// <param name="data">OSDMap data of event args</param>
private void HandleRemoteEvent_OnObjectGrab(string actorID, ulong evSeqNum, OSDMap data) private void HandleRemoteEvent_OnObjectGrab(string actorID, ulong evSeqNum, OSDMap data)
{ {
m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum); // m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum);
UUID agentID = data["agentID"].AsUUID(); UUID agentID = data["agentID"].AsUUID();
@ -2043,7 +2126,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void HandleRemoteEvent_OnObjectGrabbing(string actorID, ulong evSeqNum, OSDMap data) private void HandleRemoteEvent_OnObjectGrabbing(string actorID, ulong evSeqNum, OSDMap data)
{ {
m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum); // m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum);
UUID agentID = data["agentID"].AsUUID(); UUID agentID = data["agentID"].AsUUID();
UUID primID = data["primID"].AsUUID(); UUID primID = data["primID"].AsUUID();
@ -2080,7 +2163,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private void HandleRemoteEvent_OnObjectDeGrab(string actorID, ulong evSeqNum, OSDMap data) private void HandleRemoteEvent_OnObjectDeGrab(string actorID, ulong evSeqNum, OSDMap data)
{ {
m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum); // m_log.Debug(LogHeader + ", " + m_actorID + ": received GrabObject from " + actorID + ", seq " + evSeqNum);
UUID agentID = data["agentID"].AsUUID(); UUID agentID = data["agentID"].AsUUID();
UUID primID = data["primID"].AsUUID(); UUID primID = data["primID"].AsUUID();

View File

@ -72,6 +72,7 @@ namespace OpenSim.Region.Framework.Interfaces
//The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector //The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector
void SendSceneUpdates(); void SendSceneUpdates();
void SendNewObject(SceneObjectGroup sog);
void SendDeleteObject(SceneObjectGroup sog, bool softDelete); void SendDeleteObject(SceneObjectGroup sog, bool softDelete);
void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List<SceneObjectPart> children); void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List<SceneObjectPart> children);
void SendDeLinkObject(List<SceneObjectPart> prims, List<SceneObjectGroup> beforeDelinkGroups, List<SceneObjectGroup> afterDelinkGroups); void SendDeLinkObject(List<SceneObjectPart> prims, List<SceneObjectGroup> beforeDelinkGroups, List<SceneObjectGroup> afterDelinkGroups);

View File

@ -333,11 +333,13 @@ namespace OpenSim.Region.Framework.Scenes
ArrayList errors = new ArrayList(); ArrayList errors = new ArrayList();
//In the old async model, this function is supposed to be executed only on a remote script engine, not an authorative Scene //In the old async model, this function is supposed to be executed only on a remote script engine, not an authorative Scene
/*
if (RegionSyncModule==null && !IsSyncedScriptEngine()) if (RegionSyncModule==null && !IsSyncedScriptEngine())
{ {
m_log.Warn("This is not the script engine. Should not have received OnUpdateScript event."); m_log.Warn("This is not the script engine. Should not have received OnUpdateScript event.");
return errors; return errors;
} }
* */
SceneObjectPart part = GetSceneObjectPart(primID); SceneObjectPart part = GetSceneObjectPart(primID);
SceneObjectGroup group = part.ParentGroup; SceneObjectGroup group = part.ParentGroup;
if (isScriptRunning) if (isScriptRunning)
@ -2194,7 +2196,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
AddNewSceneObject(group, true, pos, rot, vel); AddNewSceneObject(group, true, pos, rot, vel);
//SYNC DEBUG
string partnames = "";
foreach (SceneObjectPart part in group.Parts){
partnames += "(" + part.Name + ", " + part.UUID + ")";
}
m_log.DebugFormat("[SCENE] RezObject {0} with InvItem name {1} at pos {2} with parts {3}", group.UUID.ToString(), item.Name, group.RootPart.GroupPosition.ToString(), partnames);
// We can only call this after adding the scene object, since the scene object references the scene // We can only call this after adding the scene object, since the scene object references the scene
// to find out if scripts should be activated at all. // to find out if scripts should be activated at all.
group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);

View File

@ -508,6 +508,7 @@ namespace OpenSim.Region.Framework.Scenes
//Only Auth. Scene should trigger scritp rez by remote script engine. //Only Auth. Scene should trigger scritp rez by remote script engine.
return IsSyncedServer(); return IsSyncedServer();
} }
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
//RA: Physics Engine //RA: Physics Engine
@ -543,12 +544,15 @@ namespace OpenSim.Region.Framework.Scenes
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
//!!! Obsolete function. Shouldn't be used anymore.
//This function should only be called by an actor who's local Scene is just a cache of the authorative Scene. //This function should only be called by an actor who's local Scene is just a cache of the authorative Scene.
//If the object already exists, use the new copy to replace it. //If the object already exists, use the new copy to replace it.
//Return true if added, false if just updated //Return true if added, false if just updated
public bool AddOrUpdateObjectInLocalScene(SceneObjectGroup sog, bool debugWithViewer) public bool AddOrUpdateObjectInLocalScene(SceneObjectGroup sog, bool debugWithViewer)
{ {
return m_sceneGraph.AddOrUpdateObjectInScene(sog, debugWithViewer); return false;
//return m_sceneGraph.AddOrUpdateObjectInScene(sog, debugWithViewer);
} }
@ -790,11 +794,14 @@ namespace OpenSim.Region.Framework.Scenes
continue; continue;
} }
m_log.Debug("to link part " + part.DebugObjectPartProperties()); //m_log.Debug("to link part " + part.DebugObjectPartProperties());
m_log.Debug("to link part " + part.Name + "," + part.UUID + "; its SOG has " + part.ParentGroup.Parts + " parts");
children.Add(part); children.Add(part);
} }
//m_log.Debug("to link " + children.Count + " parts with " + root.Name);
//Leverage the LinkObject implementation to get the book keeping of Group and Parts relations right //Leverage the LinkObject implementation to get the book keeping of Group and Parts relations right
m_sceneGraph.LinkObjectsBySync(root, children); m_sceneGraph.LinkObjectsBySync(root, children);

View File

@ -382,10 +382,6 @@ namespace OpenSim.Region.Framework.Scenes
m_numPrim += children.Length; m_numPrim += children.Length;
sceneObject.AttachToScene(m_parentScene); sceneObject.AttachToScene(m_parentScene);
if (sendClientUpdates)
//sceneObject.ScheduleGroupForFullUpdate();
sceneObject.ScheduleGroupForFullUpdate(new List<SceneObjectPartProperties>(){SceneObjectPartProperties.None});
Entities.Add(sceneObject); Entities.Add(sceneObject);
@ -409,6 +405,16 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
} }
//SYMMETRIC SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate
if (m_parentScene.RegionSyncModule != null)
{
m_parentScene.RegionSyncModule.SendNewObject(sceneObject);
}
if (sendClientUpdates)
//sceneObject.ScheduleGroupForFullUpdate();
sceneObject.ScheduleGroupForFullUpdate(new List<SceneObjectPartProperties>() { SceneObjectPartProperties.None });
return true; return true;
} }
@ -468,7 +474,7 @@ namespace OpenSim.Region.Framework.Scenes
lock (m_updateList) lock (m_updateList)
{ {
m_updateList[obj.UUID] = obj; m_updateList[obj.UUID] = obj;
//m_log.Debug("added " + obj.UUID + " to m_updateList"); //m_log.Debug("added " + obj.Name+","+ obj.UUID + " to m_updateList");
} }
} }
@ -489,12 +495,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
updates = new List<SceneObjectGroup>(m_updateList.Values); updates = new List<SceneObjectGroup>(m_updateList.Values);
/*
if (updates.Count > 0) if (updates.Count > 0)
{ {
m_log.Debug("SceneGraph: " + updates.Count + " objects to send updates for"); //m_log.Debug("SceneGraph.UpdateObjectGroups: " + updates.Count + " objects to send updates for");
} }
* */
m_updateList.Clear(); m_updateList.Clear();
@ -1948,6 +1954,7 @@ namespace OpenSim.Region.Framework.Scenes
//Return false if the entity with the UUID is not a SceneObjectGroup, //Return false if the entity with the UUID is not a SceneObjectGroup,
//otherwise, return true. //otherwise, return true.
/*
protected internal bool AddOrUpdateObjectInScene(SceneObjectGroup updatedSog, bool debugWithViewer) protected internal bool AddOrUpdateObjectInScene(SceneObjectGroup updatedSog, bool debugWithViewer)
{ {
UUID sogID = updatedSog.UUID; UUID sogID = updatedSog.UUID;
@ -1989,6 +1996,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
* */
#endregion // REGION SYNC #endregion // REGION SYNC
@ -2018,7 +2026,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
m_log.Debug("AddSceneObjectByStateSynch to be called"); m_log.Debug(updatedSog.Name+" "+updatedSog.UUID+" not found in Entities list. Need to add");
AddSceneObjectByStateSynch(updatedSog); AddSceneObjectByStateSynch(updatedSog);
updateResult = Scene.ObjectUpdateResult.New; updateResult = Scene.ObjectUpdateResult.New;
} }
@ -2062,6 +2070,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_numPrim += children.Length; m_numPrim += children.Length;
m_log.Debug("Attached obj " + sceneObject.Name + "," + sceneObject.UUID + " to Scene");
sceneObject.AttachToScene(m_parentScene); sceneObject.AttachToScene(m_parentScene);
//Take some special care of the case of this object being an attachment //Take some special care of the case of this object being an attachment

View File

@ -1950,7 +1950,7 @@ namespace OpenSim.Region.Framework.Scenes
//public void ScheduleGroupForTerseUpdate() //public void ScheduleGroupForTerseUpdate()
public void ScheduleGroupForTerseUpdate(List<SceneObjectPartProperties> updatedProperties) public void ScheduleGroupForTerseUpdate(List<SceneObjectPartProperties> updatedProperties)
{ {
// m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID); // m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID);
SceneObjectPart[] parts = m_parts.GetArray(); SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)

View File

@ -2980,9 +2980,9 @@ namespace OpenSim.Region.Framework.Scenes
TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
m_updateFlag = 1; m_updateFlag = 1;
// m_log.DebugFormat( //m_log.DebugFormat(
// "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1} at {2}", // "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1} at {2}",
// UUID, Name, TimeStampTerse); // UUID, Name, TimeStampTerse);
} }
} }
@ -3203,7 +3203,7 @@ namespace OpenSim.Region.Framework.Scenes
//SYMMETRIC SYNC //SYMMETRIC SYNC
if (m_parentGroup.Scene.RegionSyncModule != null) if (m_parentGroup.Scene.RegionSyncModule != null)
{ {
m_parentGroup.Scene.RegionSyncModule.QueueSceneObjectPartForUpdate((SceneObjectPart)this); m_parentGroup.Scene.RegionSyncModule.QueueSceneObjectPartForUpdate((SceneObjectPart)this);
} }
//end of SYMMETRIC SYNC //end of SYMMETRIC SYNC
@ -5504,16 +5504,32 @@ namespace OpenSim.Region.Framework.Scenes
//buckets may not be filled at all in "updatedPart". //buckets may not be filled at all in "updatedPart".
private void PhysicsBucketUpdateProcessor(Object updatedPartO, string bucketName) private void PhysicsBucketUpdateProcessor(Object updatedPartO, string bucketName)
{ {
SceneObjectPart localPart = this;
if (updatedPartO is SceneObjectPart)
{
SceneObjectPart updatedPart = (SceneObjectPart)updatedPartO;
localPart.GroupPosition = updatedPart.GroupPosition;
localPart.OffsetPosition = updatedPart.OffsetPosition;
localPart.Scale = updatedPart.Scale;
localPart.Velocity = updatedPart.Velocity;
localPart.AngularVelocity = updatedPart.AngularVelocity;
localPart.RotationOffset = updatedPart.RotationOffset;
return;
}
if (!(updatedPartO is OSDMap)) return; if (!(updatedPartO is OSDMap)) return;
OSDMap data = (OSDMap)updatedPartO; OSDMap data = (OSDMap)updatedPartO;
//If needed, we could define new set functions for these properties, and cast this SOP to SOPBase to //If needed, we could define new set functions for these properties, and cast this SOP to SOPBase to
//invoke the set functions in SOPBase //invoke the set functions in SOPBase
//SceneObjectPartBase localPart = (SceneObjectPartBase)this; //SceneObjectPartBase localPart = (SceneObjectPartBase)this;
SceneObjectPart localPart = this; //SceneObjectPart localPart = this;
PhysicsActor pa = localPart.PhysActor; PhysicsActor pa = localPart.PhysActor;
// m_log.DebugFormat("{0}: PhysicsBucketUpdateProcessor. pos={1}", "[SCENE OBJECT PART]", data["Position"].AsVector3().ToString()); //m_log.Debug("Received Physics Bucket updates for " + localPart.Name + ". GroupPosition: " + data["GroupPosition"].AsVector3().ToString()
// + ", Position = " + data["Position"].AsVector3().ToString());
lock (m_bucketUpdateLocks[bucketName]) lock (m_bucketUpdateLocks[bucketName])
{ {
@ -5761,6 +5777,8 @@ namespace OpenSim.Region.Framework.Scenes
//Second, if need to update local properties, call each bucket's update process //Second, if need to update local properties, call each bucket's update process
if (m_bucketUpdateProcessors.ContainsKey(bucketName)) if (m_bucketUpdateProcessors.ContainsKey(bucketName))
{ {
//m_log.Debug("Update properties in " + bucketName + " buckets");
m_bucketUpdateProcessors[bucketName](updatedPart, bucketName); m_bucketUpdateProcessors[bucketName](updatedPart, bucketName);
partUpdateResult = Scene.ObjectUpdateResult.Updated; partUpdateResult = Scene.ObjectUpdateResult.Updated;
} }

View File

@ -1353,7 +1353,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetScale(m_host, scale); SetScale(m_host, scale);
} }
//REGION SYNC TOUCHED -- set via sync'ing with remote Scene
protected void SetScale(SceneObjectPart part, LSL_Vector scale) protected void SetScale(SceneObjectPart part, LSL_Vector scale)
{ {
// TODO: this needs to trigger a persistance save as well // TODO: this needs to trigger a persistance save as well
@ -1383,21 +1382,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (scale.z > World.m_maxNonphys) if (scale.z > World.m_maxNonphys)
scale.z = World.m_maxNonphys; scale.z = World.m_maxNonphys;
if (World.ScriptEngineToSceneConnectorModule==null) Vector3 tmp = part.Scale;
{ tmp.X = (float)scale.x;
//If Script engine is local to Scene (REGION SYNC mode=server, and XEngine enabled=true, and no remote Script Engine connected) tmp.Y = (float)scale.y;
Vector3 tmp = part.Scale; tmp.Z = (float)scale.z;
tmp.X = (float)scale.x; part.Scale = tmp;
tmp.Y = (float)scale.y; part.SendFullUpdateToAllClients();
tmp.Z = (float)scale.z;
part.Scale = tmp;
part.SendFullUpdateToAllClients();
}
else
{
//set via sync'ing with remote Scene
World.ScriptEngineToSceneConnectorModule.SendSetPrimProperties(part.ParentGroup.LocX, part.ParentGroup.LocY, part.UUID, "scale", scale);
}
} }
public LSL_Vector llGetScale() public LSL_Vector llGetScale()
@ -1416,7 +1406,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
//REGION SYNC TOUCHED -- set via sync'ing with remote Scene
public void llSetColor(LSL_Vector color, int face) public void llSetColor(LSL_Vector color, int face)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -1424,22 +1413,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (face == ScriptBaseClass.ALL_SIDES) if (face == ScriptBaseClass.ALL_SIDES)
face = SceneObjectPart.ALL_SIDES; face = SceneObjectPart.ALL_SIDES;
// REGION SYNC m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
if (World.ScriptEngineToSceneConnectorModule == null)
{
m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face);
}
else
{
object[] valParams = new object[2];
//valParams[0] = (object)color.x;
//valParams[1] = (object)color.y;
//valParams[2] = (object)color.z;
Vector3 vcolor = new Vector3((float)color.x, (float)color.y, (float)color.z);
valParams[0] = (object)vcolor;
valParams[1] = (object)face;
World.ScriptEngineToSceneConnectorModule.SendSetPrimProperties(m_host.ParentGroup.LocX, m_host.ParentGroup.LocY, m_host.UUID, "color", (object)valParams);
}
} }
public void SetTexGen(SceneObjectPart part, int face,int style) public void SetTexGen(SceneObjectPart part, int face,int style)
@ -2766,7 +2740,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(100); ScriptSleep(100);
} }
//REGION SYNC TOUCHED -- set via sync'ing with remote Scene
public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) public void llRezAtRoot(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -2778,39 +2751,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (dist > m_ScriptDistanceFactor * 10.0f) if (dist > m_ScriptDistanceFactor * 10.0f)
return; return;
if (World.ScriptEngineToSceneConnectorModule == null) TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
{ {
//if Scene co-locates with Script Engine if (inv.Value.Name == inventory)
TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone();
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in partInventory)
{ {
if (inv.Value.Name == inventory) // make sure we're an object.
if (inv.Value.InvType != (int)InventoryType.Object)
{ {
// make sure we're an object. llSay(0, "Unable to create requested object. Object is missing from database.");
if (inv.Value.InvType != (int)InventoryType.Object) return;
{ }
llSay(0, "Unable to create requested object. Object is missing from database.");
return;
}
Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
// need the magnitude later // need the magnitude later
float velmag = (float)Util.GetMagnitude(llvel); float velmag = (float)Util.GetMagnitude(llvel);
SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param); SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param);
// If either of these are null, then there was an unknown error. // If either of these are null, then there was an unknown error.
if (new_group == null) if (new_group == null)
continue; continue;
if (new_group.RootPart == null) if (new_group.RootPart == null)
continue; continue;
// objects rezzed with this method are die_at_edge by default. // objects rezzed with this method are die_at_edge by default.
new_group.RootPart.SetDieAtEdge(true); new_group.RootPart.SetDieAtEdge(true);
new_group.ResumeScripts(); new_group.ResumeScripts();
@ -2818,45 +2787,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
"object_rez", new Object[] { "object_rez", new Object[] {
new LSL_String( new LSL_String(
new_group.RootPart.UUID.ToString()) }, new_group.RootPart.UUID.ToString()) },
new DetectParams[0])); new DetectParams[0]));
float groupmass = new_group.GetMass(); float groupmass = new_group.GetMass();
if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero) if (new_group.RootPart.PhysActor != null && new_group.RootPart.PhysActor.IsPhysical && llvel != Vector3.Zero)
{ {
//Recoil. //Recoil.
llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
}
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
ScriptSleep((int)((groupmass * velmag) / 10));
ScriptSleep(100);
return;
} }
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
ScriptSleep((int)((groupmass * velmag) / 10));
ScriptSleep(100);
return;
} }
llSay(0, "Could not find object " + inventory);
} }
else
{
//Scene does not co-locate with Script Engine
Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z);
Quaternion llrot = Rot2Quaternion(rot);
object[] valParams = new object[5];
valParams[0] = (object)inventory;
valParams[1] = (object)llpos;
valParams[2] = (object)llpos;
valParams[3] = (object)llrot;
valParams[4] = (object)param;
//we borrow the implementation SendSetPrimProperties to send the message to Scene
World.ScriptEngineToSceneConnectorModule.SendSetPrimProperties(m_host.ParentGroup.LocX, m_host.ParentGroup.LocY, m_host.UUID, "object_rez", (object)valParams);
// Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) llSay(0, "Could not find object " + inventory);
//ScriptSleep((int)((groupmass * velmag) / 10));
ScriptSleep(100);
}
} }
public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param) public void llRezObject(string inventory, LSL_Vector pos, LSL_Vector vel, LSL_Rotation rot, int param)
{ {
llRezAtRoot(inventory, pos, vel, rot, param); llRezAtRoot(inventory, pos, vel, rot, param);
@ -3412,8 +3362,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
item = m_host.TaskInventory[invItemID]; item = m_host.TaskInventory[invItemID];
} }
if (agentID == UUID.Zero || perm == 0) // Releasing permissions //if (agentID == UUID.Zero || perm == 0) // Releasing permissions
{ //{
llReleaseControls(); llReleaseControls();
item.PermsGranter = UUID.Zero; item.PermsGranter = UUID.Zero;
@ -3425,7 +3375,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
new DetectParams[0])); new DetectParams[0]));
return; return;
} //}
if (item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0) if (item.PermsGranter != agentID || (perm & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) == 0)
llReleaseControls(); llReleaseControls();
@ -3635,6 +3585,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; // Fail silently if attached return; // Fail silently if attached
SceneObjectGroup parentPrim = null, childPrim = null; SceneObjectGroup parentPrim = null, childPrim = null;
//SYEMMETRIC SYNC
List<SceneObjectPart> children = new List<SceneObjectPart>();
if (targetPart != null) if (targetPart != null)
{ {
if (parent != 0) { if (parent != 0) {
@ -3646,6 +3599,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
parentPrim = targetPart.ParentGroup; parentPrim = targetPart.ParentGroup;
childPrim = m_host.ParentGroup; childPrim = m_host.ParentGroup;
} }
children.Add(childPrim.RootPart);
// byte uf = childPrim.RootPart.UpdateFlag; // byte uf = childPrim.RootPart.UpdateFlag;
childPrim.RootPart.UpdateFlag = 0; childPrim.RootPart.UpdateFlag = 0;
parentPrim.LinkToGroup(childPrim); parentPrim.LinkToGroup(childPrim);
@ -3664,7 +3619,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
//Tell other actors to link the SceneObjectParts together as a new group. //Tell other actors to link the SceneObjectParts together as a new group.
//parentGroup.SyncInfoUpdate(); //parentGroup.SyncInfoUpdate();
World.RegionSyncModule.SendLinkObject(parentPrim, parentPrim.RootPart, new List<SceneObjectPart>(childPrim.Parts)); World.RegionSyncModule.SendLinkObject(parentPrim, parentPrim.RootPart, children);
} }
m_host.ScheduleFullUpdate(new List<SceneObjectPartProperties>(){SceneObjectPartProperties.None}); //SendLinkObject above will synchronize the link operation, no need to taint updates here m_host.ScheduleFullUpdate(new List<SceneObjectPartProperties>(){SceneObjectPartProperties.None}); //SendLinkObject above will synchronize the link operation, no need to taint updates here
//end of SYMMETRIC SYNC //end of SYMMETRIC SYNC

View File

@ -741,7 +741,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message); m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message);
m_InEvent = false; m_InEvent = false;
m_CurrentEvent = String.Empty; m_CurrentEvent = String.Empty;