Fix bug where approximately half the time, attachments would rez only their root prim until right clicked (or otherwise updated).

The root cause of this problem was that multiple ObjectUpdates were being sent on attachment which differed enough to confuse the client.
Sometimes these would eliminate each other and sometimes not, depending on whether the scheduler looked at the queued updates.
The solution here is to only schedule the ObjectUpdate once the attachment code has done all it needs to do.
This commit is contained in:
Justin Clark-Casey (justincc)
2010-03-03 22:14:06 +00:00
parent 660ebe52cf
commit edb176447b
7 changed files with 145 additions and 43 deletions

View File

@@ -229,7 +229,7 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.HasGroupChanged = true;
}
return AddSceneObject(sceneObject, attachToBackup);
return AddSceneObject(sceneObject, attachToBackup, true);
}
/// <summary>
@@ -244,12 +244,12 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
{
// Ensure that we persist this new scene object
sceneObject.HasGroupChanged = true;
return AddSceneObject(sceneObject, attachToBackup);
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
}
/// <summary>
@@ -261,12 +261,19 @@ namespace OpenSim.Region.Framework.Scenes
/// If true, the object is made persistent into the scene.
/// If false, the object will not persist over server restarts
/// </param>
/// <returns>true if the object was added, false if an object with the same uuid was already in the scene
/// <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>
/// <returns>
/// true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
{
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
return false;
bool alreadyExisted = false;
if (m_parentScene.m_clampPrimSize)
{
@@ -287,6 +294,9 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.AttachToScene(m_parentScene);
if (sendClientUpdates)
sceneObject.ScheduleGroupForFullUpdate();
lock (sceneObject)
{
if (!Entities.ContainsKey(sceneObject.UUID))
@@ -310,12 +320,14 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
}
}
return true;
}
else
{
alreadyExisted = true;
}
}
return false;
return alreadyExisted;
}
/// <summary>
@@ -525,7 +537,10 @@ namespace OpenSim.Region.Framework.Scenes
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
false, false, remoteClient.AgentId, true);
// m_log.DebugFormat(
// "[SCENE GRAPH]: Retrieved single object {0} for attachment to {1} on point {2}",
// objatt.Name, remoteClient.Name, AttachmentPt);
if (objatt != null)
{
bool tainted = false;
@@ -533,7 +548,7 @@ namespace OpenSim.Region.Framework.Scenes
tainted = true;
AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
objatt.ScheduleGroupForFullUpdate();
//objatt.ScheduleGroupForFullUpdate();
if (tainted)
objatt.HasGroupChanged = true;
@@ -544,8 +559,16 @@ namespace OpenSim.Region.Framework.Scenes
// Do this last so that event listeners have access to all the effects of the attachment
m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
}
else
{
m_log.WarnFormat(
"[SCENE GRAPH]: Could not retrieve item {0} for attaching to avatar {1} at point {2}",
itemID, remoteClient.Name, AttachmentPt);
}
return objatt;
}
return null;
}