aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2012-03-21 20:34:51 -0400
committerBlueWall2012-03-21 20:34:51 -0400
commitc98e3a6422be9a1fc8fef45a6ddb5ba7e37c5dda (patch)
tree3e88ccd53c6b19b0f9bed5345fda7ca5a1b34940
parentFix typo (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-c98e3a6422be9a1fc8fef45a6ddb5ba7e37c5dda.zip
opensim-SC-c98e3a6422be9a1fc8fef45a6ddb5ba7e37c5dda.tar.gz
opensim-SC-c98e3a6422be9a1fc8fef45a6ddb5ba7e37c5dda.tar.bz2
opensim-SC-c98e3a6422be9a1fc8fef45a6ddb5ba7e37c5dda.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/IClientAPI.cs3
-rw-r--r--OpenSim/Framework/SLUtil.cs50
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs81
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs8
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs5
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs6
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs5
10 files changed, 85 insertions, 99 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index c85e599..3f560d0 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -1215,10 +1215,9 @@ namespace OpenSim.Framework
1215 /// <param name="OrbitalPosition">The orbital position is given in radians, and must be "adjusted" for the linden client, see LLClientView</param> 1215 /// <param name="OrbitalPosition">The orbital position is given in radians, and must be "adjusted" for the linden client, see LLClientView</param>
1216 void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, 1216 void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear,
1217 float OrbitalPosition); 1217 float OrbitalPosition);
1218 1218
1219 void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks); 1219 void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks);
1220 void SendViewerTime(int phase); 1220 void SendViewerTime(int phase);
1221 UUID GetDefaultAnimation(string name);
1222 1221
1223 void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, string flAbout, 1222 void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, string flAbout,
1224 uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID); 1223 uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID);
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs
index f9cb851..db4541e 100644
--- a/OpenSim/Framework/SLUtil.cs
+++ b/OpenSim/Framework/SLUtil.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Reflection; 31using System.Reflection;
31using System.Xml; 32using System.Xml;
32using log4net; 33using log4net;
@@ -40,13 +41,6 @@ namespace OpenSim.Framework
40 41
41 #region SL / file extension / content-type conversions 42 #region SL / file extension / content-type conversions
42 43
43 public static Dictionary<string, UUID> DefaultAvatarAnimations = new Dictionary<string, UUID>();
44
45 static SLUtil()
46 {
47 DefaultAvatarAnimations = LoadDefaultAvatarAnimations("data/avataranimations.xml");
48 }
49
50 public static string SLAssetTypeToContentType(int assetType) 44 public static string SLAssetTypeToContentType(int assetType)
51 { 45 {
52 switch ((AssetType)assetType) 46 switch ((AssetType)assetType)
@@ -382,47 +376,5 @@ namespace OpenSim.Framework
382 376
383 return output; 377 return output;
384 } 378 }
385
386 /// <summary>
387 /// Load the default SL avatar animations.
388 /// </summary>
389 /// <returns></returns>
390 public static Dictionary<string, UUID> LoadDefaultAvatarAnimations(string path)
391 {
392 Dictionary<string, UUID> animations = new Dictionary<string, UUID>();
393
394 using (XmlTextReader reader = new XmlTextReader(path))
395 {
396 XmlDocument doc = new XmlDocument();
397 doc.Load(reader);
398 if (doc.DocumentElement != null)
399 {
400 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
401 {
402 if (nod.Attributes["name"] != null)
403 {
404 string name = nod.Attributes["name"].Value.ToLower();
405 string id = nod.InnerText;
406 animations.Add(name, (UUID)id);
407 }
408 }
409 }
410 }
411
412 return animations;
413 }
414
415 /// <summary>
416 /// Get the default SL avatar animation with the given name.
417 /// </summary>
418 /// <param name="name"></param>
419 /// <returns></returns>
420 public static UUID GetDefaultAvatarAnimation(string name)
421 {
422 if (DefaultAvatarAnimations.ContainsKey(name))
423 return DefaultAvatarAnimations[name];
424
425 return UUID.Zero;
426 }
427 } 379 }
428} \ No newline at end of file 380} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index b388b10..68aae14 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -11202,15 +11202,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11202 scriptQuestion.Data.Questions = question; 11202 scriptQuestion.Data.Questions = question;
11203 scriptQuestion.Data.ObjectName = Util.StringToBytes256(taskName); 11203 scriptQuestion.Data.ObjectName = Util.StringToBytes256(taskName);
11204 scriptQuestion.Data.ObjectOwner = Util.StringToBytes256(ownerName); 11204 scriptQuestion.Data.ObjectOwner = Util.StringToBytes256(ownerName);
11205 11205
11206 OutPacket(scriptQuestion, ThrottleOutPacketType.Task); 11206 OutPacket(scriptQuestion, ThrottleOutPacketType.Task);
11207 } 11207 }
11208 11208
11209 public UUID GetDefaultAnimation(string name)
11210 {
11211 return SLUtil.GetDefaultAvatarAnimation(name);
11212 }
11213
11214 /// <summary> 11209 /// <summary>
11215 /// Handler called when we receive a logout packet. 11210 /// Handler called when we receive a logout packet.
11216 /// </summary> 11211 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
index 9176d3d..240a424 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
@@ -27,8 +27,10 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework; 30using System.Reflection;
31using log4net;
31using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework;
32 34
33using Animation = OpenSim.Framework.Animation; 35using Animation = OpenSim.Framework.Animation;
34 36
@@ -37,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
37 [Serializable] 39 [Serializable]
38 public class AnimationSet 40 public class AnimationSet
39 { 41 {
40 public static AvatarAnimations Animations = new AvatarAnimations(); 42// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 43
42 private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); 44 private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation();
43 private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>(); 45 private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>();
@@ -132,9 +134,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
132 /// </summary> 134 /// </summary>
133 public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID) 135 public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID)
134 { 136 {
135 if (Animations.AnimsUUID.ContainsKey(anim)) 137// m_log.DebugFormat(
138// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}",
139// anim, sequenceNum, objectID);
140
141 if (AvatarAnimations.AnimsUUID.ContainsKey(anim))
136 { 142 {
137 return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum, objectID); 143 return SetDefaultAnimation(AvatarAnimations.AnimsUUID[anim], sequenceNum, objectID);
138 } 144 }
139 return false; 145 return false;
140 } 146 }
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs
index 659c3a5..ec928f4 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs
@@ -26,38 +26,83 @@
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection;
29using System.Xml; 30using System.Xml;
31using log4net;
30using OpenMetaverse; 32using OpenMetaverse;
31 33
32namespace OpenSim.Region.Framework.Scenes.Animation 34namespace OpenSim.Region.Framework.Scenes.Animation
33{ 35{
34 public class AvatarAnimations 36 public class AvatarAnimations
35 { 37 {
36 public Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>(); 38// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
37 public Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
38 public Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
39 39
40 public AvatarAnimations() 40 public static readonly string DefaultAnimationsPath = "data/avataranimations.xml";
41
42 public static Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
43 public static Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
44 public static Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
45
46 static AvatarAnimations()
47 {
48 LoadAnimations(DefaultAnimationsPath);
49 }
50
51 /// <summary>
52 /// Load the default SL avatar animations.
53 /// </summary>
54 /// <returns></returns>
55 private static void LoadAnimations(string path)
41 { 56 {
42 using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) 57// Dictionary<string, UUID> animations = new Dictionary<string, UUID>();
58
59 using (XmlTextReader reader = new XmlTextReader(path))
43 { 60 {
44 XmlDocument doc = new XmlDocument(); 61 XmlDocument doc = new XmlDocument();
45 doc.Load(reader); 62 doc.Load(reader);
46 foreach (XmlNode nod in doc.DocumentElement.ChildNodes) 63// if (doc.DocumentElement != null)
47 { 64// {
48 if (nod.Attributes["name"] != null) 65 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
49 { 66 {
50 string name = (string)nod.Attributes["name"].Value; 67 if (nod.Attributes["name"] != null)
51 UUID id = (UUID)nod.InnerText; 68 {
52 string animState = (string)nod.Attributes["state"].Value; 69 string name = nod.Attributes["name"].Value;
53 70 UUID id = (UUID)nod.InnerText;
54 AnimsUUID.Add(name, id); 71 string animState = (string)nod.Attributes["state"].Value;
55 AnimsNames.Add(id, name); 72
56 if (animState != "") 73 AnimsUUID.Add(name, id);
57 AnimStateNames.Add(id, animState); 74 AnimsNames.Add(id, name);
75 if (animState != "")
76 AnimStateNames.Add(id, animState);
77
78// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState);
79 }
58 } 80 }
59 } 81// }
82 }
83
84// return animations;
85 }
86
87 /// <summary>
88 /// Get the default avatar animation with the given name.
89 /// </summary>
90 /// <param name="name"></param>
91 /// <returns></returns>
92 public static UUID GetDefaultAnimation(string name)
93 {
94// m_log.DebugFormat(
95// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name);
96
97 if (AnimsUUID.ContainsKey(name))
98 {
99// m_log.DebugFormat(
100// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name);
101
102 return AnimsUUID[name];
60 } 103 }
104
105 return UUID.Zero;
61 } 106 }
62 } 107 }
63} 108} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 3584cda..9038ebc 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -97,7 +97,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
97 if (m_scenePresence.IsChildAgent) 97 if (m_scenePresence.IsChildAgent)
98 return; 98 return;
99 99
100 UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); 100 // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
101 // are referenced with lower case names!
102 UUID animID = AvatarAnimations.GetDefaultAnimation(name.ToUpper());
101 if (animID == UUID.Zero) 103 if (animID == UUID.Zero)
102 return; 104 return;
103 105
@@ -121,7 +123,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
121 if (m_scenePresence.IsChildAgent) 123 if (m_scenePresence.IsChildAgent)
122 return; 124 return;
123 125
124 UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); 126 // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
127 // are referenced with lower case names!
128 UUID animID = AvatarAnimations.GetDefaultAnimation(name);
125 if (animID == UUID.Zero) 129 if (animID == UUID.Zero)
126 return; 130 return;
127 131
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index d3c96e2..5cf478a 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -1203,11 +1203,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
1203 1203
1204 } 1204 }
1205 1205
1206 public UUID GetDefaultAnimation(string name)
1207 {
1208 return UUID.Zero;
1209 }
1210
1211 public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID) 1206 public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID)
1212 { 1207 {
1213 1208
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 24b9e6b..16ec34f 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -133,11 +133,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
133 133
134 } 134 }
135 135
136 public UUID GetDefaultAnimation(string name)
137 {
138 return SLUtil.GetDefaultAvatarAnimation(name);
139 }
140
141 public Vector3 Position 136 public Vector3 Position
142 { 137 {
143 get { return m_scene.Entities[m_uuid].AbsolutePosition; } 138 get { return m_scene.Entities[m_uuid].AbsolutePosition; }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index bb374ed..27f7c03 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4314,7 +4314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4314 4314
4315 if (m_host.RegionHandle == presence.RegionHandle) 4315 if (m_host.RegionHandle == presence.RegionHandle)
4316 { 4316 {
4317 Dictionary<UUID, string> animationstateNames = AnimationSet.Animations.AnimStateNames; 4317 Dictionary<UUID, string> animationstateNames = AvatarAnimations.AnimStateNames;
4318 4318
4319 if (presence != null) 4319 if (presence != null)
4320 { 4320 {
@@ -5600,7 +5600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5600 } 5600 }
5601 5601
5602 if (agent.Animator.Animations.DefaultAnimation.AnimID 5602 if (agent.Animator.Animations.DefaultAnimation.AnimID
5603 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 5603 == AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
5604 { 5604 {
5605 flags |= ScriptBaseClass.AGENT_SITTING; 5605 flags |= ScriptBaseClass.AGENT_SITTING;
5606 } 5606 }
@@ -7714,7 +7714,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7714 LSL_Vector lower; 7714 LSL_Vector lower;
7715 LSL_Vector upper; 7715 LSL_Vector upper;
7716 if (presence.Animator.Animations.DefaultAnimation.AnimID 7716 if (presence.Animator.Animations.DefaultAnimation.AnimID
7717 == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) 7717 == AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
7718 { 7718 {
7719 // This is for ground sitting avatars 7719 // This is for ground sitting avatars
7720 float height = presence.Appearance.AvatarHeight / 2.66666667f; 7720 float height = presence.Appearance.AvatarHeight / 2.66666667f;
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 14c1287..455b51e 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -700,11 +700,6 @@ namespace OpenSim.Tests.Common.Mock
700 { 700 {
701 } 701 }
702 702
703 public UUID GetDefaultAnimation(string name)
704 {
705 return UUID.Zero;
706 }
707
708 public void SendTakeControls(int controls, bool passToAgent, bool TakeControls) 703 public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
709 { 704 {
710 } 705 }