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

View File

@ -108,8 +108,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation;
//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;
}
@ -173,19 +171,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private string LogHeader = "[ClientManagerSyncModule]";
/// <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>
private void ClientManager_OnObjectCreateBySync(EntityBase entity)
{
if (entity is SceneObjectGroup)
{
}
}
public void ClientManager_OnSymmetricSyncStop()
{
//remove all objects
m_scene.DeleteAllSceneObjects();
//m_scene.DeleteAllSceneObjects();
}
#endregion //ScriptEngineSyncModule

View File

@ -115,8 +115,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation;
//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;
}
@ -180,7 +178,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private string LogHeader = "[PhysicsEngineSyncModule]";
/// <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>
private void PhysicsEngine_OnObjectCreateBySync(EntityBase entity)
{

View File

@ -1880,8 +1880,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
shape = true;
}
}
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);
//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);
return;
}
@ -2198,7 +2198,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{
m_primSyncInfoManager.RemovePrimSyncInfo(part);
}
m_scene.DeleteSceneObjectBySynchronization(sog);
m_scene.DeleteSceneObjectBySync(sog);
}
else
{
@ -3531,6 +3531,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SceneObjectGroup group;
Dictionary<UUID, PrimSyncInfo> primsSyncInfo;
SceneObjectDecoder(data, out group, out primsSyncInfo);
if (group == null)
@ -3585,7 +3586,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
OSDMap rootData = (OSDMap)data["RootPart"];
//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();
if (root != null)
@ -6768,6 +6778,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
part.ParentGroup.AbsolutePosition = (Vector3)pSyncInfo.LastUpdateValue;
PropertySyncInfo gPosSyncInfo;
if (part.IsAttachment)
return;
if (m_propertiesSyncInfo.ContainsKey(SceneObjectPartSyncProperties.GroupPosition))
{
gPosSyncInfo = m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition];

View File

@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Register for Scene/SceneGraph events
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.
@ -124,7 +124,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
if (!m_active)
return;
m_log.Warn(LogHeader + " RegionLoaded() called");
}
public void RemoveRegion(Scene scene)

View File

@ -109,6 +109,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Register for Scene/SceneGraph events
//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.EventManager.OnSymmetricSyncStop += ScriptEngine_OnSymmetricSyncStop;

View File

@ -702,16 +702,20 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectGroup sog = (SceneObjectGroup)e;
if (!sog.IsAttachment)
DeleteSceneObjectBySynchronization((SceneObjectGroup)e);
DeleteSceneObjectBySync((SceneObjectGroup)e);
}
}
}
}
//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
// deadlocking on m_parts inside SceneObjectGroup
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
group.DeleteGroupFromScene(silent);
* */
}
public void AddNewSceneObjectPartBySync(SceneObjectPart newPart, SceneObjectGroup parentGroup)
@ -753,6 +758,7 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.AddNewSceneObjectPart(newPart, parentGroup);
}
public ObjectUpdateResult AddNewSceneObjectBySync(SceneObjectGroup sceneObject)
{
//if(attachToBackup)
@ -790,7 +796,10 @@ namespace OpenSim.Region.Framework.Scenes
}
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);
@ -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>
/// Synchronously delete the given object from the scene.
/// </summary>
/// <param name="group">Object Id</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);
@ -2719,7 +2741,7 @@ namespace OpenSim.Region.Framework.Scenes
//DSG SYNC
//Propagate the RemovedObject message
if (RegionSyncModule != null)
if (RegionSyncModule != null && syncDelete)
{
//RegionSyncModule.SendDeleteObject(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(),
//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)
{
Scene.ObjectUpdateResult updateResult = Scene.ObjectUpdateResult.New;
@ -2190,6 +2191,7 @@ namespace OpenSim.Region.Framework.Scenes
return updateResult;
}
* */
public void AddNewSceneObjectPart(SceneObjectPart newPart, SceneObjectGroup parentGroup)
{
@ -2539,6 +2541,38 @@ namespace OpenSim.Region.Framework.Scenes
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
}
}

View File

@ -23,104 +23,104 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
namespace OpenSim.Region.OptionalModules.World.AutoBackup
{
/// <summary>AutoBackupModuleState: Auto-Backup state for one region (scene).
/// If you use this class in any way outside of AutoBackupModule, you should treat the class as opaque.
/// Since it is not part of the framework, you really should not rely upon it outside of the AutoBackupModule implementation.
/// </summary>
///
public class AutoBackupModuleState
{
private Dictionary<Guid, string> m_liveRequests = null;
public AutoBackupModuleState()
{
this.Enabled = false;
this.BackupDir = ".";
this.BusyCheck = true;
this.Timer = null;
this.NamingType = NamingType.Time;
this.Script = null;
}
public Dictionary<Guid, string> LiveRequests
{
get {
return this.m_liveRequests ??
(this.m_liveRequests = new Dictionary<Guid, string>(1));
}
}
public bool Enabled
{
get;
set;
}
public System.Timers.Timer Timer
{
get;
set;
}
public double IntervalMinutes
{
get
{
if (this.Timer == null)
{
return -1.0;
}
else
{
return this.Timer.Interval / 60000.0;
}
}
}
public bool BusyCheck
{
get;
set;
}
public string Script
{
get;
set;
}
public string BackupDir
{
get;
set;
}
public NamingType NamingType
{
get;
set;
}
public new string ToString()
{
string retval = "";
retval += "[AUTO BACKUP]: AutoBackup: " + (Enabled ? "ENABLED" : "DISABLED") + "\n";
retval += "[AUTO BACKUP]: Interval: " + IntervalMinutes + " minutes" + "\n";
retval += "[AUTO BACKUP]: Do Busy Check: " + (BusyCheck ? "Yes" : "No") + "\n";
retval += "[AUTO BACKUP]: Naming Type: " + NamingType.ToString() + "\n";
retval += "[AUTO BACKUP]: Backup Dir: " + BackupDir + "\n";
retval += "[AUTO BACKUP]: Script: " + Script + "\n";
return retval;
}
}
}
*/
using System;
using System.Collections.Generic;
namespace OpenSim.Region.OptionalModules.World.AutoBackup
{
/// <summary>AutoBackupModuleState: Auto-Backup state for one region (scene).
/// If you use this class in any way outside of AutoBackupModule, you should treat the class as opaque.
/// Since it is not part of the framework, you really should not rely upon it outside of the AutoBackupModule implementation.
/// </summary>
///
public class AutoBackupModuleState
{
private Dictionary<Guid, string> m_liveRequests = null;
public AutoBackupModuleState()
{
this.Enabled = false;
this.BackupDir = ".";
this.BusyCheck = true;
this.Timer = null;
this.NamingType = NamingType.Time;
this.Script = null;
}
public Dictionary<Guid, string> LiveRequests
{
get {
return this.m_liveRequests ??
(this.m_liveRequests = new Dictionary<Guid, string>(1));
}
}
public bool Enabled
{
get;
set;
}
public System.Timers.Timer Timer
{
get;
set;
}
public double IntervalMinutes
{
get
{
if (this.Timer == null)
{
return -1.0;
}
else
{
return this.Timer.Interval / 60000.0;
}
}
}
public bool BusyCheck
{
get;
set;
}
public string Script
{
get;
set;
}
public string BackupDir
{
get;
set;
}
public NamingType NamingType
{
get;
set;
}
public new string ToString()
{
string retval = "";
retval += "[AUTO BACKUP]: AutoBackup: " + (Enabled ? "ENABLED" : "DISABLED") + "\n";
retval += "[AUTO BACKUP]: Interval: " + IntervalMinutes + " minutes" + "\n";
retval += "[AUTO BACKUP]: Do Busy Check: " + (BusyCheck ? "Yes" : "No") + "\n";
retval += "[AUTO BACKUP]: Naming Type: " + NamingType.ToString() + "\n";
retval += "[AUTO BACKUP]: Backup Dir: " + BackupDir + "\n";
retval += "[AUTO BACKUP]: Script: " + Script + "\n";
return retval;
}
}
}