aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJeff Ames2008-02-06 10:19:30 +0000
committerJeff Ames2008-02-06 10:19:30 +0000
commit3b42b5f0984fd10de8f49794764f1efd688e8dcd (patch)
tree1d1ea31c04bfd56bd5ac71d425f14b29f239c1e4 /OpenSim/Region
parent* Fixed script count incrementer. Was decrementing but only incrementing wh... (diff)
downloadopensim-SC-3b42b5f0984fd10de8f49794764f1efd688e8dcd.zip
opensim-SC-3b42b5f0984fd10de8f49794764f1efd688e8dcd.tar.gz
opensim-SC-3b42b5f0984fd10de8f49794764f1efd688e8dcd.tar.bz2
opensim-SC-3b42b5f0984fd10de8f49794764f1efd688e8dcd.tar.xz
Consolidated LoadAnims and AvatarAnimations constructor.
Fixes locking issues with Animations in ScenePresence (bug #324)
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Scenes/AvatarAnimations.cs31
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs16
3 files changed, 9 insertions, 40 deletions
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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Xml; 31using System.Xml;
@@ -35,18 +36,11 @@ namespace OpenSim.Region.Environment.Scenes
35{ 36{
36 public class AvatarAnimations 37 public class AvatarAnimations
37 { 38 {
38 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
39
40 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>(); 39 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>();
41 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>(); 40 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>();
42 41
43 public AvatarAnimations() 42 public AvatarAnimations()
44 { 43 {
45 }
46
47 public void LoadAnims()
48 {
49 //m_log.Info("[CLIENT]: Loading avatar animations");
50 using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) 44 using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
51 { 45 {
52 XmlDocument doc = new XmlDocument(); 46 XmlDocument doc = new XmlDocument();
@@ -55,25 +49,14 @@ namespace OpenSim.Region.Environment.Scenes
55 { 49 {
56 if (nod.Attributes["name"] != null) 50 if (nod.Attributes["name"] != null)
57 { 51 {
58 AnimsLLUUID.Add((string)nod.Attributes["name"].Value, (LLUUID)nod.InnerText); 52 string name = (string)nod.Attributes["name"].Value;
59 } 53 LLUUID id = (LLUUID)nod.InnerText;
60 }
61 }
62
63 // m_log.Info("[CLIENT]: Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)");
64 54
65 try 55 AnimsLLUUID.Add(name, id);
66 { 56 AnimsNames.Add(id, name);
67 //Mantis: 0000224: 2755 - Enumeration Operation may not execute [immediate crash] (ODE/2750/WIN2003) 57 }
68 foreach (KeyValuePair<string, LLUUID> kp in ScenePresence.Animations.AnimsLLUUID)
69 {
70 AnimsNames.Add(kp.Value, kp.Key);
71 } 58 }
72 } 59 }
73 catch (InvalidOperationException)
74 {
75 m_log.Warn("[AVATAR]: Unable to load animation names for an Avatar");
76 }
77 } 60 }
78 } 61 }
79} \ No newline at end of file 62}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 40a80c4..b4283ae 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -278,8 +278,6 @@ namespace OpenSim.Region.Environment.Scenes
278 m_log.Info("[SCENE]: Creating LandMap"); 278 m_log.Info("[SCENE]: Creating LandMap");
279 Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY); 279 Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY);
280 280
281 ScenePresence.LoadAnims();
282
283 httpListener = httpServer; 281 httpListener = httpServer;
284 m_dumpAssetsToFile = dumpAssetsToFile; 282 m_dumpAssetsToFile = dumpAssetsToFile;
285 283
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 5c33dfc..109f23c 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -41,8 +41,9 @@ namespace OpenSim.Region.Environment.Scenes
41 { 41 {
42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 public static AvatarAnimations Animations; 44 public static AvatarAnimations Animations = new AvatarAnimations();
45 public static byte[] DefaultTexture; 45 public static byte[] DefaultTexture;
46
46 public LLUUID currentParcelUUID = LLUUID.Zero; 47 public LLUUID currentParcelUUID = LLUUID.Zero;
47 private List<LLUUID> m_animations = new List<LLUUID>(); 48 private List<LLUUID> m_animations = new List<LLUUID>();
48 private List<int> m_animationSeqs = new List<int>(); 49 private List<int> m_animationSeqs = new List<int>();
@@ -333,12 +334,6 @@ namespace OpenSim.Region.Environment.Scenes
333 334
334 AbsolutePosition = m_controllingClient.StartPos; 335 AbsolutePosition = m_controllingClient.StartPos;
335 336
336 Animations = new AvatarAnimations();
337 lock (Animations)
338 {
339 Animations.LoadAnims();
340 }
341
342 // TODO: m_animations and m_animationSeqs should always be of the same length. 337 // TODO: m_animations and m_animationSeqs should always be of the same length.
343 // Move them into an object to (hopefully) avoid threading issues. 338 // Move them into an object to (hopefully) avoid threading issues.
344 try 339 try
@@ -1643,13 +1638,6 @@ namespace OpenSim.Region.Environment.Scenes
1643 } 1638 }
1644 1639
1645 /// <summary> 1640 /// <summary>
1646 ///
1647 /// </summary>
1648 public static void LoadAnims()
1649 {
1650 }
1651
1652 /// <summary>
1653 /// Handles part of the PID controller function for moving an avatar. 1641 /// Handles part of the PID controller function for moving an avatar.
1654 /// </summary> 1642 /// </summary>
1655 public override void UpdateMovement() 1643 public override void UpdateMovement()