From da0e90fb7c3dcbc4a0188a76aa4e786f136b5916 Mon Sep 17 00:00:00 2001 From: Jim Radford Date: Tue, 27 Oct 2009 07:26:28 +0000 Subject: [PATCH] LIBOMV-686 More improvements to ObjectManager, removed Attachment related updates in favor of a boolean in PrimEventArgs to show if a prim is normal is is attached to an Avatar git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3177 52acb1d6-8a22-11de-b505-999d5b087335 --- OpenMetaverse/ObjectManager.cs | 41 ++++++++-------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/OpenMetaverse/ObjectManager.cs b/OpenMetaverse/ObjectManager.cs index 0fdd941b..ab76dcf8 100644 --- a/OpenMetaverse/ObjectManager.cs +++ b/OpenMetaverse/ObjectManager.cs @@ -185,31 +185,7 @@ namespace OpenMetaverse add { lock (m_ObjectUpdateLock) { m_ObjectUpdate += value; } } remove { lock (m_ObjectUpdateLock) { m_ObjectUpdate -= value; } } } - - /// The event subscribers, null of no subscribers - private EventHandler m_AttachmentUpdate; - - ///Raises the AttachmentUpdate Event - /// A AttachmentUpdateEventArgs object containing - /// the data sent from the simulator - protected virtual void OnAttachmentUpdate(PrimEventArgs e) - { - EventHandler handler = m_AttachmentUpdate; - if (handler != null) - handler(this, e); - } - - /// Thread sync lock object - private readonly object m_AttachmentUpdateLock = new object(); - - /// Raised when the simulator sends us data containing - /// a new primitive that is an Attachment - public event EventHandler AttachmentUpdate - { - add { lock (m_AttachmentUpdateLock) { m_AttachmentUpdate += value; } } - remove { lock (m_AttachmentUpdateLock) { m_AttachmentUpdate -= value; } } - } - + /// The event subscribers, null of no subscribers private EventHandler m_ObjectProperties; @@ -1880,10 +1856,7 @@ namespace OpenMetaverse prim.AngularVelocity = objectupdate.AngularVelocity; #endregion - if (attachment) - OnAttachmentUpdate(new PrimEventArgs(simulator, prim, update.RegionData.TimeDilation)); - else - OnObjectUpdate(new PrimEventArgs(simulator, prim, update.RegionData.TimeDilation)); + OnObjectUpdate(new PrimEventArgs(simulator, prim, update.RegionData.TimeDilation, attachment)); break; #endregion Prim and Foliage @@ -2352,11 +2325,11 @@ namespace OpenMetaverse if ((flags & CompressedFlags.HasNameValues) != 0 && prim.ParentID != 0) { - OnAttachmentUpdate(new PrimEventArgs(simulator, prim, update.RegionData.TimeDilation)); + OnObjectUpdate(new PrimEventArgs(simulator, prim, update.RegionData.TimeDilation, true)); } else { - OnObjectUpdate(new PrimEventArgs(simulator, prim, update.RegionData.TimeDilation)); + OnObjectUpdate(new PrimEventArgs(simulator, prim, update.RegionData.TimeDilation, false)); } #endregion @@ -3012,6 +2985,7 @@ namespace OpenMetaverse public class PrimEventArgs : EventArgs { private readonly Simulator m_Simulator; + private readonly bool m_IsAttachment; private readonly Primitive m_Prim; private readonly ushort m_TimeDilation; @@ -3019,6 +2993,7 @@ namespace OpenMetaverse public Simulator Simulator { get { return m_Simulator; } } /// Get the primitive details public Primitive Prim { get { return m_Prim; } } + public bool IsAttachment { get { return m_IsAttachment; } } /// Get the simulator Time Dilation public ushort TimeDilation { get { return m_TimeDilation; } } @@ -3027,10 +3002,12 @@ namespace OpenMetaverse /// /// The simulator the object originated from /// The Primitive + /// true of the primitive represents an attachment to an agent /// The simulator time dilation - public PrimEventArgs(Simulator simulator, Primitive prim, ushort timeDilation) + public PrimEventArgs(Simulator simulator, Primitive prim, ushort timeDilation, bool isAttachment) { this.m_Simulator = simulator; + this.m_IsAttachment = IsAttachment; this.m_Prim = prim; this.m_TimeDilation = timeDilation; }