From 3b42b5f0984fd10de8f49794764f1efd688e8dcd Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Wed, 6 Feb 2008 10:19:30 +0000 Subject: Consolidated LoadAnims and AvatarAnimations constructor. Fixes locking issues with Animations in ScenePresence (bug #324) --- .../Region/Environment/Scenes/AvatarAnimations.cs | 31 +++++----------------- 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/AvatarAnimations.cs') diff --git a/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs b/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs index daaa319..be882e0 100644 --- a/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs +++ b/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.Collections.Generic; using System.Xml; @@ -35,18 +36,11 @@ namespace OpenSim.Region.Environment.Scenes { public class AvatarAnimations { - private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public Dictionary AnimsLLUUID = new Dictionary(); public Dictionary AnimsNames = new Dictionary(); public AvatarAnimations() { - } - - public void LoadAnims() - { - //m_log.Info("[CLIENT]: Loading avatar animations"); using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) { XmlDocument doc = new XmlDocument(); @@ -55,25 +49,14 @@ namespace OpenSim.Region.Environment.Scenes { if (nod.Attributes["name"] != null) { - AnimsLLUUID.Add((string)nod.Attributes["name"].Value, (LLUUID)nod.InnerText); - } - } - } - - // m_log.Info("[CLIENT]: Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); + string name = (string)nod.Attributes["name"].Value; + LLUUID id = (LLUUID)nod.InnerText; - try - { - //Mantis: 0000224: 2755 - Enumeration Operation may not execute [immediate crash] (ODE/2750/WIN2003) - foreach (KeyValuePair kp in ScenePresence.Animations.AnimsLLUUID) - { - AnimsNames.Add(kp.Value, kp.Key); + AnimsLLUUID.Add(name, id); + AnimsNames.Add(id, name); + } } } - catch (InvalidOperationException) - { - m_log.Warn("[AVATAR]: Unable to load animation names for an Avatar"); - } } } -} \ No newline at end of file +} -- cgit v1.1