From d733dbb0c84079673b9cab05c19af57491a0d336 Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Wed, 31 Jan 2007 00:47:33 +0000 Subject: [PATCH] Allow ObjectManager subclasses to track Avatars too. git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@927 52acb1d6-8a22-11de-b505-999d5b087335 --- libsecondlife-cs/ObjectManager.cs | 48 ++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/libsecondlife-cs/ObjectManager.cs b/libsecondlife-cs/ObjectManager.cs index a52180e3..989eb9c9 100644 --- a/libsecondlife-cs/ObjectManager.cs +++ b/libsecondlife-cs/ObjectManager.cs @@ -1184,9 +1184,9 @@ namespace libsecondlife } } - if (OnNewAvatar != null) + if ( AlwaysDecode || (OnNewAvatar != null)) { - Avatar avatar = new Avatar(); + Avatar avatar = GetAvatar(simulator, block.ID, block.FullID); #region Update Avatar with decoded data avatar.ID = block.FullID; @@ -1313,16 +1313,29 @@ namespace libsecondlife // TODO: this really only needs to be called when this class is an instance of a subclass of this class... // Get primitive from factory, so subclasses can have a chance to have cached data updated - Primitive prim = GetPrimitive(simulator, update.LocalID, null); - prim.Acceleration = update.Acceleration; - prim.AngularVelocity = update.AngularVelocity; - prim.CollisionPlane = update.CollisionPlane; - prim.Position = update.Position; - prim.Rotation = update.Rotation; - prim.Textures = update.Textures; - prim.Velocity = update.Velocity; + if (AlwaysDecode) + { + LLObject obj; - llObjectUpdated(simulator, prim); + if (update.Avatar) + { + obj = GetAvatar(simulator, update.LocalID, null); + } + else + { + obj = GetPrimitive(simulator, update.LocalID, null); + } + + obj.Acceleration = update.Acceleration; + obj.AngularVelocity = update.AngularVelocity; + obj.CollisionPlane = update.CollisionPlane; + obj.Position = update.Position; + obj.Rotation = update.Rotation; + obj.Textures = update.Textures; + obj.Velocity = update.Velocity; + + llObjectUpdated(simulator, obj); + } // Fire the callback FireOnObjectUpdated(simulator, update, terse.RegionData.RegionHandle, terse.RegionData.TimeDilation); @@ -1790,6 +1803,19 @@ namespace libsecondlife return new Primitive(); } + /// + /// Primitive Factory, this allows a subclass to lookup a copy of the Avatar + /// and return it for updating, rather then always creating a new Avatar + /// + /// + /// + /// + /// + virtual protected Avatar GetAvatar(Simulator simulator, uint LocalID, LLUUID UUID) + { + return new Avatar(); + } + /// /// Used to flag to a subclass that an LLObject was updated/created ///