Stop attempts to rewear already worn items from removing and reattaching.
Viewer 2/3 will sometimes attempt to rewear attachments, even though they have already been attached during the main login process. This change ignores those attempts. This stops script failures during login, as the rewearing was racing with the script startup code. It might also help with attachments being abnormally put into deleted state. Hopefully resolves some more of http://opensimulator.org/mantis/view.php?id=5644remove-scene-viewer
parent
618277e797
commit
8880aea728
|
@ -147,18 +147,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
|
||||
foreach (SceneObjectGroup grp in sp.GetAttachments())
|
||||
{
|
||||
if (grp.HasGroupChanged) // Resizer scripts?
|
||||
{
|
||||
// if (grp.HasGroupChanged) // Resizer scripts?
|
||||
// {
|
||||
grp.IsAttachment = false;
|
||||
grp.AbsolutePosition = grp.RootPart.AttachedPos;
|
||||
UpdateKnownItem(sp.ControllingClient, grp, grp.GetFromItemID(), grp.OwnerID);
|
||||
grp.IsAttachment = true;
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}",
|
||||
// m_scene.RegionInfo.RegionName, sp.Name, silent);
|
||||
|
||||
foreach (SceneObjectGroup sop in sp.GetAttachments())
|
||||
{
|
||||
sop.Scene.DeleteSceneObject(sop, silent);
|
||||
|
@ -214,7 +218,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
|
||||
// Save avatar attachment information
|
||||
m_log.Info(
|
||||
m_log.Debug(
|
||||
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
|
||||
+ ", AttachmentPoint: " + AttachmentPt);
|
||||
|
||||
|
@ -339,6 +343,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
|
||||
lock (sp.AttachmentsSyncLock)
|
||||
{
|
||||
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name);
|
||||
|
||||
foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
|
||||
{
|
||||
RezSingleAttachmentFromInventory(sp, obj.ItemID, obj.AttachmentPt);
|
||||
|
@ -375,6 +381,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
// be removed when that functionality is implemented in opensim
|
||||
AttachmentPt &= 0x7f;
|
||||
|
||||
// Viewer 2/3 sometimes asks to re-wear items that are already worn (and show up in it's inventory as such).
|
||||
// This often happens during login - not sure the exact reason.
|
||||
// For now, we will ignore the request. Unfortunately, this means that we need to dig through all the
|
||||
// ScenePresence attachments. We can't use the data in AvatarAppearance because that's present at login
|
||||
// before anything has actually been attached.
|
||||
bool alreadyOn = false;
|
||||
List<SceneObjectGroup> existingAttachments = sp.GetAttachments();
|
||||
foreach (SceneObjectGroup so in existingAttachments)
|
||||
{
|
||||
if (so.GetFromItemID() == itemID)
|
||||
{
|
||||
alreadyOn = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if (sp.Appearance.GetAttachmentForItem(itemID) != null)
|
||||
if (alreadyOn)
|
||||
{
|
||||
// m_log.WarnFormat(
|
||||
// "[ATTACHMENTS MODULE]: Ignoring request by {0} to wear item {1} at {2} since it is already worn",
|
||||
// sp.Name, itemID, AttachmentPt);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt);
|
||||
|
||||
if (att == null)
|
||||
|
@ -468,7 +500,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}",
|
||||
// att.Name, remoteClient.Name, AttachmentPt, itemID);
|
||||
// att.Name, sp.Name, AttachmentPt, itemID);
|
||||
|
||||
if (UUID.Zero == itemID)
|
||||
{
|
||||
|
@ -524,7 +556,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: DetachSingleAttachmentToGround() for {0}, object {1}",
|
||||
// remoteClient.Name, sceneObjectID);
|
||||
// remoteClient.Name, soLocalId);
|
||||
|
||||
SceneObjectGroup so = m_scene.GetGroupByPrim(soLocalId);
|
||||
|
||||
|
@ -677,15 +709,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
{
|
||||
if (grp != null)
|
||||
{
|
||||
if (!grp.HasGroupChanged)
|
||||
if (grp.HasGroupChanged || grp.ContainsScripts())
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
|
@ -718,6 +743,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[ATTACHMENTS MODULE]: Don't need to update asset for unchanged attachment {0}, attachpoint {1}",
|
||||
grp.UUID, grp.AttachmentPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -735,7 +767,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
private void AttachToAgent(
|
||||
IScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent)
|
||||
{
|
||||
// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}",
|
||||
// so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos);
|
||||
|
||||
so.DetachFromBackup();
|
||||
|
@ -788,7 +821,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
/// <returns>The user inventory item created that holds the attachment.</returns>
|
||||
private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IClientAPI remoteClient, SceneObjectGroup grp)
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2} {3} {4}", grp.Name, grp.LocalId, remoteClient.Name, remoteClient.AgentId, AgentId);
|
||||
// m_log.DebugFormat(
|
||||
// "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}",
|
||||
// grp.Name, grp.LocalId, remoteClient.Name);
|
||||
|
||||
Vector3 inventoryStoredPosition = new Vector3
|
||||
(((grp.AbsolutePosition.X > (int)Constants.RegionSize)
|
||||
|
|
|
@ -389,5 +389,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
for (int i = 0; i < parts.Length; i++)
|
||||
parts[i].Inventory.ResumeScripts();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if any part in the scene object contains scripts, false otherwise.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ContainsScripts()
|
||||
{
|
||||
foreach (SceneObjectPart part in Parts)
|
||||
if (part.Inventory.ContainsScripts())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1035,10 +1035,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.BasePermissions = perms;
|
||||
}
|
||||
}
|
||||
|
||||
m_inventorySerial++;
|
||||
HasInventoryChanged = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this part inventory contains any scripts. False otherwise.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ContainsScripts()
|
||||
{
|
||||
lock (m_items)
|
||||
|
|
Loading…
Reference in New Issue