Stop the pointless double setting of every attachment in AvatarAppearance.

The second was already being filtered out so this has no user level effect
remove-scene-viewer
Justin Clark-Casey (justincc) 2011-09-06 00:29:37 +01:00
parent cf73afec35
commit 0cb0140a1d
3 changed files with 13 additions and 10 deletions

View File

@ -402,8 +402,13 @@ namespace OpenSim.Framework
internal void AppendAttachment(AvatarAttachment attach) internal void AppendAttachment(AvatarAttachment attach)
{ {
if (! m_attachments.ContainsKey(attach.AttachPoint)) // m_log.DebugFormat(
// "[AVATAR APPEARNCE]: Appending itemID={0}, assetID={1} at {2}",
// attach.ItemID, attach.AssetID, attach.AttachPoint);
if (!m_attachments.ContainsKey(attach.AttachPoint))
m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
m_attachments[attach.AttachPoint].Add(attach); m_attachments[attach.AttachPoint].Add(attach);
} }
@ -430,13 +435,13 @@ namespace OpenSim.Framework
/// </returns> /// </returns>
public bool SetAttachment(int attachpoint, UUID item, UUID asset) public bool SetAttachment(int attachpoint, UUID item, UUID asset)
{ {
if (attachpoint == 0)
return false;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[AVATAR APPEARANCE]: Setting attachment at {0} with item ID {1}, asset ID {2}", // "[AVATAR APPEARANCE]: Setting attachment at {0} with item ID {1}, asset ID {2}",
// attachpoint, item, asset); // attachpoint, item, asset);
if (attachpoint == 0)
return false;
if (item == UUID.Zero) if (item == UUID.Zero)
{ {
if (m_attachments.ContainsKey(attachpoint)) if (m_attachments.ContainsKey(attachpoint))
@ -465,6 +470,7 @@ namespace OpenSim.Framework
{ {
ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset)); ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset));
} }
return true; return true;
} }

View File

@ -242,7 +242,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})",
// group.Name, group.LocalId, sp.Name, AttachmentPt, silent); // group.Name, group.LocalId, sp.Name, attachmentPt, silent);
if (sp.GetAttachments(attachmentPt).Contains(group)) if (sp.GetAttachments(attachmentPt).Contains(group))
{ {
@ -356,8 +356,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{ {
if (att == null) if (att == null)
DetachSingleAttachmentToInv(itemID, sp.ControllingClient); DetachSingleAttachmentToInv(itemID, sp.ControllingClient);
else
ShowAttachInUserInventory(att, sp, itemID, AttachmentPt);
} }
return att; return att;
@ -386,9 +384,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (objatt != null) if (objatt != null)
{ {
// Loading the inventory from XML will have set this, but // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller.
// there is no way the object could have changed yet,
// since scripts aren't running yet. So, clear it here.
objatt.HasGroupChanged = false; objatt.HasGroupChanged = false;
bool tainted = false; bool tainted = false;
if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint)

View File

@ -150,6 +150,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(attSo.IsTemporary, Is.False); Assert.That(attSo.IsTemporary, Is.False);
// Check appearance status // Check appearance status
Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(1));
Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest)); Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest));
} }