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

dsg
Dan Lake 2011-07-15 15:34:00 -07:00
commit eb95762769
9 changed files with 191 additions and 127 deletions

View File

@ -394,16 +394,16 @@ 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(UUID uuid) private PhysicsActor FindPhysicsActor(UUID uuid)
{ {
SceneObjectPart sop = m_validLocalScene.GetSceneObjectPart(uuid);
if (sop != null)
{
return sop.PhysActor;
}
ScenePresence sp = m_validLocalScene.GetScenePresence(uuid); ScenePresence sp = m_validLocalScene.GetScenePresence(uuid);
if (sp != null) if (sp != null)
{ {
return sp.PhysicsActor; return sp.PhysicsActor;
} }
SceneObjectPart sop = m_validLocalScene.GetSceneObjectPart(uuid);
if (sop != null)
{
return sop.PhysActor;
}
return null; return null;
} }

View File

@ -108,8 +108,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation; //m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation;
//Register for Scene/SceneGraph events //Register for Scene/SceneGraph events
//m_scene.SceneGraph.OnObjectCreate += new ObjectCreateDelegate(ClientManager_OnObjectCreate);
m_scene.SceneGraph.OnObjectCreateBySync += new ObjectCreateBySyncDelegate(ClientManager_OnObjectCreateBySync);
m_scene.EventManager.OnSymmetricSyncStop += ClientManager_OnSymmetricSyncStop; m_scene.EventManager.OnSymmetricSyncStop += ClientManager_OnSymmetricSyncStop;
} }
@ -173,19 +171,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private string LogHeader = "[ClientManagerSyncModule]"; private string LogHeader = "[ClientManagerSyncModule]";
/// <summary> /// <summary>
/// Script Engine's action upon an object is added to the local scene /// Client Manager's action upon an object is added to the local scene
/// </summary> /// </summary>
private void ClientManager_OnObjectCreateBySync(EntityBase entity) private void ClientManager_OnObjectCreateBySync(EntityBase entity)
{ {
if (entity is SceneObjectGroup)
{
}
} }
public void ClientManager_OnSymmetricSyncStop() public void ClientManager_OnSymmetricSyncStop()
{ {
//remove all objects //remove all objects
m_scene.DeleteAllSceneObjects(); //m_scene.DeleteAllSceneObjects();
} }
#endregion //ScriptEngineSyncModule #endregion //ScriptEngineSyncModule

View File

@ -115,8 +115,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation; //m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation;
//Register for Scene/SceneGraph events //Register for Scene/SceneGraph events
//m_scene.SceneGraph.OnObjectCreate += new ObjectCreateDelegate(PhysicsEngine_OnObjectCreate);
m_scene.SceneGraph.OnObjectCreateBySync += new ObjectCreateBySyncDelegate(PhysicsEngine_OnObjectCreateBySync);
m_scene.EventManager.OnSymmetricSyncStop += PhysicsEngine_OnSymmetricSyncStop; m_scene.EventManager.OnSymmetricSyncStop += PhysicsEngine_OnSymmetricSyncStop;
} }
@ -180,7 +178,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private string LogHeader = "[PhysicsEngineSyncModule]"; private string LogHeader = "[PhysicsEngineSyncModule]";
/// <summary> /// <summary>
/// Script Engine's action upon an object is added to the local scene /// Physics Engine's action upon an object is added to the local scene
/// </summary> /// </summary>
private void PhysicsEngine_OnObjectCreateBySync(EntityBase entity) private void PhysicsEngine_OnObjectCreateBySync(EntityBase entity)
{ {

View File

@ -1880,8 +1880,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
shape = true; shape = true;
} }
} }
m_log.WarnFormat("{0}: HandleUpdatedPrimProperties -- prim {1} not in local SceneGraph. SOP == NULL? ({2}), Sender is {3}, property == Shape? {4}", //m_log.WarnFormat("{0}: HandleUpdatedPrimProperties -- prim {1} not in local SceneGraph. SOP == NULL? ({2}), Sender is {3}, property == Shape? {4}",
LogHeader, primUUID, sop == null, senderActorID, shape); // LogHeader, primUUID, sop == null, senderActorID, shape);
return; return;
} }
@ -2198,7 +2198,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
m_primSyncInfoManager.RemovePrimSyncInfo(part); m_primSyncInfoManager.RemovePrimSyncInfo(part);
} }
m_scene.DeleteSceneObjectBySynchronization(sog); m_scene.DeleteSceneObjectBySync(sog);
} }
else else
{ {
@ -3531,6 +3531,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SceneObjectGroup group; SceneObjectGroup group;
Dictionary<UUID, PrimSyncInfo> primsSyncInfo; Dictionary<UUID, PrimSyncInfo> primsSyncInfo;
SceneObjectDecoder(data, out group, out primsSyncInfo); SceneObjectDecoder(data, out group, out primsSyncInfo);
if (group == null) if (group == null)
@ -3585,7 +3586,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap rootData = (OSDMap)data["RootPart"]; OSDMap rootData = (OSDMap)data["RootPart"];
//Decode and copy to the list of PrimSyncInfo //Decode and copy to the list of PrimSyncInfo
PrimSyncInfo primSyncInfo = m_primSyncInfoManager.DecodeFullSetPrimProperties(rootData); PrimSyncInfo primSyncInfo = null;
try
{
primSyncInfo = m_primSyncInfoManager.DecodeFullSetPrimProperties(rootData);
}
catch (Exception e)
{
m_log.ErrorFormat("SceneObjectDecoder: {0}", e.Message);
return;
}
SceneObjectPart root= primSyncInfo.PrimSyncInfoToSOP(); SceneObjectPart root= primSyncInfo.PrimSyncInfoToSOP();
if (root != null) if (root != null)
@ -6768,6 +6778,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
part.ParentGroup.AbsolutePosition = (Vector3)pSyncInfo.LastUpdateValue; part.ParentGroup.AbsolutePosition = (Vector3)pSyncInfo.LastUpdateValue;
PropertySyncInfo gPosSyncInfo; PropertySyncInfo gPosSyncInfo;
if (part.IsAttachment)
return;
if (m_propertiesSyncInfo.ContainsKey(SceneObjectPartSyncProperties.GroupPosition)) if (m_propertiesSyncInfo.ContainsKey(SceneObjectPartSyncProperties.GroupPosition))
{ {
gPosSyncInfo = m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition]; gPosSyncInfo = m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition];

View File

@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Register for Scene/SceneGraph events //Register for Scene/SceneGraph events
m_scene.SceneGraph.OnObjectCreate += new ObjectCreateDelegate(ScenePersistence_OnObjectCreate); m_scene.SceneGraph.OnObjectCreate += new ObjectCreateDelegate(ScenePersistence_OnObjectCreate);
m_scene.SceneGraph.OnObjectCreateBySync += new ObjectCreateBySyncDelegate(ScenePersistence_OnObjectCreateBySync); //m_scene.SceneGraph.OnObjectCreateBySync += new ObjectCreateBySyncDelegate(ScenePersistence_OnObjectCreateBySync);
} }
//Called after AddRegion() has been called for all region modules of the scene. //Called after AddRegion() has been called for all region modules of the scene.
@ -124,7 +124,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
if (!m_active) if (!m_active)
return; return;
m_log.Warn(LogHeader + " RegionLoaded() called"); m_log.Warn(LogHeader + " RegionLoaded() called");
} }
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)

View File

@ -109,6 +109,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Register for Scene/SceneGraph events //Register for Scene/SceneGraph events
//m_scene.SceneGraph.OnObjectCreate += new ObjectCreateDelegate(ScriptEngine_OnObjectCreate); //m_scene.SceneGraph.OnObjectCreate += new ObjectCreateDelegate(ScriptEngine_OnObjectCreate);
//Don't subscribe to OnObjectCreate, only subscribe OnObjectCreateBySync.
m_scene.SceneGraph.OnObjectCreateBySync += new ObjectCreateBySyncDelegate(ScriptEngine_OnObjectCreateBySync); m_scene.SceneGraph.OnObjectCreateBySync += new ObjectCreateBySyncDelegate(ScriptEngine_OnObjectCreateBySync);
m_scene.EventManager.OnSymmetricSyncStop += ScriptEngine_OnSymmetricSyncStop; m_scene.EventManager.OnSymmetricSyncStop += ScriptEngine_OnSymmetricSyncStop;

View File

@ -702,16 +702,20 @@ namespace OpenSim.Region.Framework.Scenes
{ {
SceneObjectGroup sog = (SceneObjectGroup)e; SceneObjectGroup sog = (SceneObjectGroup)e;
if (!sog.IsAttachment) if (!sog.IsAttachment)
DeleteSceneObjectBySynchronization((SceneObjectGroup)e); DeleteSceneObjectBySync((SceneObjectGroup)e);
} }
} }
} }
} }
//Similar to DeleteSceneObject, except that this does not trigger SyncDeleteObject //Similar to DeleteSceneObject, except that this does not trigger SyncDeleteObject
public void DeleteSceneObjectBySynchronization(SceneObjectGroup group) public void DeleteSceneObjectBySync(SceneObjectGroup group)
{ {
bool silent = false;
bool syncDelete = false;
DeleteSceneObject(group, silent, syncDelete);
/*
// Serialise calls to RemoveScriptInstances to avoid // Serialise calls to RemoveScriptInstances to avoid
// deadlocking on m_parts inside SceneObjectGroup // deadlocking on m_parts inside SceneObjectGroup
lock (m_deleting_scene_object) lock (m_deleting_scene_object)
@ -743,6 +747,7 @@ namespace OpenSim.Region.Framework.Scenes
bool silent = false; //do not suppress broadcasting changes to other clients, for debugging with viewers bool silent = false; //do not suppress broadcasting changes to other clients, for debugging with viewers
group.DeleteGroupFromScene(silent); group.DeleteGroupFromScene(silent);
* */
} }
public void AddNewSceneObjectPartBySync(SceneObjectPart newPart, SceneObjectGroup parentGroup) public void AddNewSceneObjectPartBySync(SceneObjectPart newPart, SceneObjectGroup parentGroup)
@ -753,6 +758,7 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.AddNewSceneObjectPart(newPart, parentGroup); m_sceneGraph.AddNewSceneObjectPart(newPart, parentGroup);
} }
public ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup sceneObject) public ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup sceneObject)
{ {
//if(attachToBackup) //if(attachToBackup)
@ -790,7 +796,10 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
return m_sceneGraph.AddNewSceneObjectBySync(sceneObject); if (m_sceneGraph.AddNewSceneObjectBySync(sceneObject))
return Scene.ObjectUpdateResult.New;
else
return Scene.ObjectUpdateResult.Error;
} }
//return m_sceneGraph.AddNewSceneObjectBySync(group); //return m_sceneGraph.AddNewSceneObjectBySync(group);
@ -2672,12 +2681,25 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
/// <summary>
/// Synchronously delete the given object from the scene. This should be called by
/// deletion that is initiated locally.
/// </summary>
/// <param name="group"></param>
/// <param name="silent"></param>
public void DeleteSceneObject(SceneObjectGroup group, bool silent)
{
DeleteSceneObject(group, silent, true);
}
/// <summary> /// <summary>
/// Synchronously delete the given object from the scene. /// Synchronously delete the given object from the scene.
/// </summary> /// </summary>
/// <param name="group">Object Id</param> /// <param name="group">Object Id</param>
/// <param name="silent">Suppress broadcasting changes to other clients.</param> /// <param name="silent">Suppress broadcasting changes to other clients.</param>
public void DeleteSceneObject(SceneObjectGroup group, bool silent) /// <param name="syncDelete">"false" if this function is called by
/// receiving SymmetricSyncMessage.MsgType.RemovedObject, "true" otherwise.</param>
public void DeleteSceneObject(SceneObjectGroup group, bool silent, bool syncDelete)
{ {
// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
@ -2719,7 +2741,7 @@ namespace OpenSim.Region.Framework.Scenes
//DSG SYNC //DSG SYNC
//Propagate the RemovedObject message //Propagate the RemovedObject message
if (RegionSyncModule != null) if (RegionSyncModule != null && syncDelete)
{ {
//RegionSyncModule.SendDeleteObject(group, false); //RegionSyncModule.SendDeleteObject(group, false);
RegionSyncModule.SyncDeleteObject(group, false); RegionSyncModule.SyncDeleteObject(group, false);

View File

@ -2101,6 +2101,7 @@ namespace OpenSim.Region.Framework.Scenes
*/ */
//This is called when an object is added due to receiving a state synchronization message from Scene or an actor. Do similar things as the original AddSceneObject(), //This is called when an object is added due to receiving a state synchronization message from Scene or an actor. Do similar things as the original AddSceneObject(),
//but call ScheduleGroupForFullUpdate_TimeStampUnchanged() instead, so as not to modify the timestamp or actorID, since the object was not created locally. //but call ScheduleGroupForFullUpdate_TimeStampUnchanged() instead, so as not to modify the timestamp or actorID, since the object was not created locally.
/*
public Scene.ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup sceneObject) public Scene.ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup sceneObject)
{ {
Scene.ObjectUpdateResult updateResult = Scene.ObjectUpdateResult.New; Scene.ObjectUpdateResult updateResult = Scene.ObjectUpdateResult.New;
@ -2190,6 +2191,7 @@ namespace OpenSim.Region.Framework.Scenes
return updateResult; return updateResult;
} }
* */
public void AddNewSceneObjectPart(SceneObjectPart newPart, SceneObjectGroup parentGroup) public void AddNewSceneObjectPart(SceneObjectPart newPart, SceneObjectGroup parentGroup)
{ {
@ -2539,6 +2541,38 @@ namespace OpenSim.Region.Framework.Scenes
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, triggerSyncNewObject); return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, triggerSyncNewObject);
} }
protected internal bool AddNewSceneObjectBySync(SceneObjectGroup sceneObject)
{
sceneObject.HasGroupChanged = true;
bool triggerSyncNewObject = false;
if (AddSceneObject(sceneObject, true, true, triggerSyncNewObject))
{
//Take some special care of the case of this object being an attachment,
//since localID of attachedAvatar is different in different sync node's
//Scene copies.
sceneObject.RootPart.SetAttachmentPoint(sceneObject.RootPart.AttachmentPoint);
if (sceneObject.IsAttachment)
{
ScenePresence avatar = m_parentScene.GetScenePresence(sceneObject.RootPart.AttachedAvatar);
//It is possible that the avatar has not been fully
//created locally when attachment objects are sync'ed.
//So we need to check if the avatar already exists.
//If not, handling of NewAvatar will evetually trigger
//calling of SetParentLocalId.
if (avatar != null)
sceneObject.RootPart.SetParentLocalId(avatar.LocalId);
}
sceneObject.HasGroupChanged = true;
sceneObject.ScheduleGroupForFullUpdate(null);
if (OnObjectCreateBySync != null)
OnObjectCreateBySync(sceneObject);
return true;
}
return false;
}
#endregion //DSG SYNC #endregion //DSG SYNC
} }
} }