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

@@ -1842,9 +1842,18 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerOnAttach(localID, itemID, avatarID);
}
public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID,
uint AttachmentPt)
/// <summary>
/// Called when the client receives a request to rez a single attachment on to the avatar from inventory
/// (RezSingleAttachmentFromInv packet).
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <returns></returns>
public UUID RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{
m_log.DebugFormat("[USER INVENTORY]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
SceneObjectGroup att = m_sceneGraph.RezSingleAttachment(remoteClient, itemID, AttachmentPt);
if (att == null)
@@ -1856,9 +1865,20 @@ namespace OpenSim.Region.Framework.Scenes
return RezSingleAttachment(att, remoteClient, itemID, AttachmentPt);
}
public UUID RezSingleAttachment(SceneObjectGroup att,
IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
/// <summary>
/// Update the user inventory to reflect an attachment
/// </summary>
/// <param name="att"></param>
/// <param name="remoteClient"></param>
/// <param name="itemID"></param>
/// <param name="AttachmentPt"></param>
/// <returns></returns>
public UUID RezSingleAttachment(SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{
m_log.DebugFormat(
"[USER INVENTORY]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
remoteClient.Name, att.Name, itemID);
if (!att.IsDeleted)
AttachmentPt = att.RootPart.AttachmentPoint;
@@ -1897,8 +1917,19 @@ namespace OpenSim.Region.Framework.Scenes
return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent);
}
/// <summary>
/// This registers the item as attached in a user's inventory
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="AttachmentPt"></param>
/// <param name="itemID"></param>
/// <param name="att"></param>
public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
{
// m_log.DebugFormat(
// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}",
// att.Name, remoteClient.Name, AttachmentPt, itemID);
if (UUID.Zero == itemID)
{
m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID.");
@@ -1926,10 +1957,7 @@ namespace OpenSim.Region.Framework.Scenes
presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */);
if (m_AvatarFactory != null)
{
m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
}
}
}
@@ -2012,6 +2040,7 @@ namespace OpenSim.Region.Framework.Scenes
{
sog.SetOwnerId(ownerID);
sog.SetGroup(groupID, remoteClient);
sog.ScheduleGroupForFullUpdate();
foreach (SceneObjectPart child in sog.Children.Values)
child.Inventory.ChangeInventoryOwner(ownerID);
@@ -2033,6 +2062,7 @@ namespace OpenSim.Region.Framework.Scenes
sog.SetOwnerId(groupID);
sog.ApplyNextOwnerPermissions();
}
}
foreach (uint localID in localIDs)