Added AddNewSceneObjectByRez, which when called, won't trigger RegionSyncModule.SyncNewObject.
The caller of AddNewSceneObjectByRez will trigger that later when all object properties have been set. Also, added calling aggregateScriptEventSubscriptions() after AddNewSceneObjectBySync(), so that collision events in PhysActor, after it is created, are subscribed.dsg
parent
854cb58d6d
commit
f5e648f54a
|
@ -764,13 +764,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
// one full update during the attachment
|
// one full update during the attachment
|
||||||
// process causes some clients to fail to display the
|
// process causes some clients to fail to display the
|
||||||
// attachment properly.
|
// attachment properly.
|
||||||
m_Scene.AddNewSceneObject(group, true, false);
|
//m_Scene.AddNewSceneObject(group, true, false);
|
||||||
|
//DSG SYNC: tell RegionSyncModule not to call SyncNewObject
|
||||||
|
// yet, as not all properties have been set yet
|
||||||
|
bool triggerSyncNewObject = false;
|
||||||
|
m_Scene.AddNewSceneObjectByRez(group, true, false, triggerSyncNewObject);
|
||||||
|
|
||||||
// if attachment we set it's asset id so object updates
|
// if attachment we set it's asset id so object updates
|
||||||
// can reflect that, if not, we set it's position in world.
|
// can reflect that, if not, we set it's position in world.
|
||||||
if (!attachment)
|
if (!attachment)
|
||||||
{
|
{
|
||||||
group.ScheduleGroupForFullUpdate(new List<SceneObjectPartSyncProperties>(){SceneObjectPartSyncProperties.FullUpdate});
|
group.ScheduleGroupForFullUpdate(null);
|
||||||
|
|
||||||
group.AbsolutePosition = pos + veclist[i];
|
group.AbsolutePosition = pos + veclist[i];
|
||||||
}
|
}
|
||||||
|
@ -857,7 +861,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
// Fire on_rez
|
// Fire on_rez
|
||||||
group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1);
|
group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1);
|
||||||
rootPart.ParentGroup.ResumeScripts();
|
rootPart.ParentGroup.ResumeScripts();
|
||||||
rootPart.ScheduleFullUpdate(new List<SceneObjectPartSyncProperties>() { SceneObjectPartSyncProperties.FullUpdate });
|
rootPart.ScheduleFullUpdate(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -876,6 +880,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//DSG SYNC: now all properties have been set, sending NewObject message,
|
||||||
|
if (m_Scene.RegionSyncModule != null)
|
||||||
|
{
|
||||||
|
m_Scene.RegionSyncModule.SyncNewObject(group);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1977,9 +1977,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
{
|
{
|
||||||
pos = part.PhysActor.Position;
|
pos = part.PhysActor.Position;
|
||||||
}
|
}
|
||||||
m_log.WarnFormat("-- part {0}, UUID {1}, LocalID {2}, GroupPos {3}, offset-position {4}, Position {5}, AggregateScriptEvents ={6}, Flags = {7}, LocalFlags {8}, Scale {9}",
|
m_log.WarnFormat("-- part {0}, UUID {1}, LocalID {2}, GroupPos {3}, offset-position {4}, Position {5}, AggregateScriptEvents ={6}, AttachedAvatar={7}, AttachmentPoint = {8}, AttachedPos={9}",
|
||||||
part.Name, part.UUID, part.LocalId, part.GroupPosition, part.OffsetPosition,
|
//Flags = {7}, LocalFlags {8}, Scale {9}",
|
||||||
pos, part.AggregateScriptEvents, part.Flags, part.LocalFlags, part.Scale);
|
part.Name, part.UUID, part.LocalId, part.GroupPosition, part.OffsetPosition,
|
||||||
|
pos, part.AggregateScriptEvents,
|
||||||
|
//part.Flags, part.LocalFlags, part.Scale);
|
||||||
|
part.AttachedAvatar, part.AttachmentPoint, part.AttachedPos
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3870,11 +3874,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
||||||
Scene.ObjectUpdateResult updateResult = m_scene.AddNewSceneObjectBySync(group);
|
Scene.ObjectUpdateResult updateResult = m_scene.AddNewSceneObjectBySync(group);
|
||||||
|
|
||||||
//Now the PhysActor of each part in sog have been created, let's
|
//Now the PhysActor of each part in sog have been created, let's
|
||||||
//set the PhysActor's properties
|
//set the PhysActor's properties. Also trigger aggregateScriptEventSubscriptions
|
||||||
|
//since it may access PhysActor to link collision events
|
||||||
foreach (SceneObjectPart part in group.Parts)
|
foreach (SceneObjectPart part in group.Parts)
|
||||||
{
|
{
|
||||||
//primsSyncInfo[part.UUID].SetSOPPhyscActorProperties(part);
|
|
||||||
m_primSyncInfoManager.SetSOPPhyscActorProperties(part);
|
m_primSyncInfoManager.SetSOPPhyscActorProperties(part);
|
||||||
|
part.aggregateScriptEventSubscriptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2237,7 +2237,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
|
sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddNewSceneObject(group, true);
|
//AddNewSceneObject(group, true);
|
||||||
|
//DSG SYNC
|
||||||
|
bool triggerSyncNewObject = false;
|
||||||
|
AddNewSceneObjectByRez(group, true, true, triggerSyncNewObject);
|
||||||
|
|
||||||
group.AbsolutePosition = pos;
|
group.AbsolutePosition = pos;
|
||||||
group.Velocity = vel;
|
group.Velocity = vel;
|
||||||
|
@ -2256,8 +2259,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
|
group.CreateScriptInstances(param, true, DefaultScriptEngine, 3);
|
||||||
|
|
||||||
//group.ScheduleGroupForFullUpdate();
|
//group.ScheduleGroupForFullUpdate();
|
||||||
group.ScheduleGroupForFullUpdate(new List<SceneObjectPartSyncProperties>(){SceneObjectPartSyncProperties.FullUpdate}); //new object, all properties have new value
|
group.ScheduleGroupForFullUpdate(null); //new object, all properties have new value
|
||||||
|
|
||||||
|
//DSG SYNC: now all properties have been set, sending NewObject message,
|
||||||
|
if (RegionSyncModule != null)
|
||||||
|
{
|
||||||
|
RegionSyncModule.SyncNewObject(group);
|
||||||
|
}
|
||||||
|
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -882,6 +882,29 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a newly created object to the scene
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sceneObject"></param>
|
||||||
|
/// <param name="attachToBackup">
|
||||||
|
/// If true, the object is made persistent into the scene.
|
||||||
|
/// If false, the object will not persist over server restarts
|
||||||
|
/// </param>
|
||||||
|
/// <param name="sendClientUpdates">
|
||||||
|
/// If true, updates for the new scene object are sent to all viewers in range.
|
||||||
|
/// If false, it is left to the caller to schedule the update
|
||||||
|
/// </param>
|
||||||
|
public bool AddNewSceneObjectByRez(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates, bool triggerSyncNewObject)
|
||||||
|
{
|
||||||
|
if (m_sceneGraph.AddNewSceneObjectByRez(sceneObject, attachToBackup, sendClientUpdates, triggerSyncNewObject))
|
||||||
|
{
|
||||||
|
EventManager.TriggerObjectAddedToScene(sceneObject);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion //DSG SYNC
|
#endregion //DSG SYNC
|
||||||
|
|
||||||
public ICapabilitiesModule CapsModule
|
public ICapabilitiesModule CapsModule
|
||||||
|
|
|
@ -288,7 +288,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
sceneObject.HasGroupChanged = true;
|
sceneObject.HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, false);
|
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -310,7 +310,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (attachToBackup)
|
if (attachToBackup)
|
||||||
sceneObject.HasGroupChanged = true;
|
sceneObject.HasGroupChanged = true;
|
||||||
|
|
||||||
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, false);
|
//DSG SYNC: passing true to trigger SyncNewObject
|
||||||
|
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -368,7 +369,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// true if the object was added, false if an object with the same uuid was already in the scene
|
/// true if the object was added, false if an object with the same uuid was already in the scene
|
||||||
/// </returns>
|
/// </returns>
|
||||||
protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates, bool addedByDelink)
|
protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates, bool triggerSyncNewObject)
|
||||||
{
|
{
|
||||||
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
|
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
|
||||||
return false;
|
return false;
|
||||||
|
@ -434,7 +435,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
sceneObject.ScheduleGroupForFullUpdate(null);
|
sceneObject.ScheduleGroupForFullUpdate(null);
|
||||||
|
|
||||||
//DSG SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate
|
//DSG SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate
|
||||||
if (m_parentScene.RegionSyncModule != null && !addedByDelink)
|
if (m_parentScene.RegionSyncModule != null && triggerSyncNewObject)
|
||||||
{
|
{
|
||||||
m_parentScene.RegionSyncModule.SyncNewObject(sceneObject);
|
m_parentScene.RegionSyncModule.SyncNewObject(sceneObject);
|
||||||
}
|
}
|
||||||
|
@ -2569,8 +2570,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (attachToBackup)
|
if (attachToBackup)
|
||||||
sceneObject.HasGroupChanged = true;
|
sceneObject.HasGroupChanged = true;
|
||||||
|
|
||||||
bool addedByDelink = true;
|
bool triggerSyncNewObject = false;
|
||||||
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, addedByDelink);
|
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, triggerSyncNewObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected internal bool AddNewSceneObjectByRez(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates, bool triggerSyncNewObject)
|
||||||
|
{
|
||||||
|
// Ensure that we persist this new scene object if it's not an
|
||||||
|
// attachment
|
||||||
|
if (attachToBackup)
|
||||||
|
sceneObject.HasGroupChanged = true;
|
||||||
|
|
||||||
|
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, triggerSyncNewObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion //DSG SYNC
|
#endregion //DSG SYNC
|
||||||
|
|
Loading…
Reference in New Issue