aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorUbitUmarov2014-09-29 20:36:03 +0100
committerUbitUmarov2014-09-29 20:36:03 +0100
commitcfb1a2730045420319f0678ccc70e61d6a46df82 (patch)
treeae0e0c7684a4d9da05b0ac04f4892bffcfb7209d /OpenSim/Framework
parent change avatar physics and motion control. Still not that good :( (diff)
parentAlso fetch and store old asset for animation sets (diff)
downloadopensim-SC_OLD-cfb1a2730045420319f0678ccc70e61d6a46df82.zip
opensim-SC_OLD-cfb1a2730045420319f0678ccc70e61d6a46df82.tar.gz
opensim-SC_OLD-cfb1a2730045420319f0678ccc70e61d6a46df82.tar.bz2
opensim-SC_OLD-cfb1a2730045420319f0678ccc70e61d6a46df82.tar.xz
Merge branch 'master' into ubitworkmaster
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AnimationSet.cs61
1 files changed, 26 insertions, 35 deletions
diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs
index 56e1068..8ac9081 100644
--- a/OpenSim/Framework/AnimationSet.cs
+++ b/OpenSim/Framework/AnimationSet.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Framework
35 35
36 public class AnimationSet 36 public class AnimationSet
37 { 37 {
38 private readonly int m_maxAnimations = 255; 38 private bool m_parseError = false;
39 39
40 public const uint createBasePermitions = (uint)(PermissionMask.All); // no export ? 40 public const uint createBasePermitions = (uint)(PermissionMask.All); // no export ?
41 public const uint createNextPermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify); 41 public const uint createNextPermitions = (uint)(PermissionMask.Copy | PermissionMask.Modify);
@@ -86,50 +86,41 @@ namespace OpenSim.Framework
86 } 86 }
87 87
88 public int AnimationCount { get; private set; } 88 public int AnimationCount { get; private set; }
89 private Dictionary<int, UUID> m_animations = new Dictionary<int, UUID>(); 89 private Dictionary<string, UUID> m_animations = new Dictionary<string, UUID>();
90 90 public AnimationSet(Byte[] data)
91 public UUID AnimationAt(int index)
92 {
93 if (m_animations.ContainsKey(index))
94 return m_animations[index];
95 return UUID.Zero;
96 }
97
98 public void SetAnimation(int index, UUID animation)
99 {
100 if (index < 0 || index > m_maxAnimations)
101 return;
102
103 m_animations[index] = animation;
104 }
105
106 public AnimationSet(Byte[] assetData)
107 { 91 {
108 if (assetData.Length < 2) 92 string assetData = System.Text.Encoding.ASCII.GetString(data);
109 throw new System.ArgumentException(); 93 Console.WriteLine("--------------------");
110 94 Console.WriteLine("AnimationSet length {0} bytes", assetData.Length);
111 if (assetData[0] != 1) // Only version 1 is supported 95 Console.WriteLine("Data: {0}", assetData);
112 throw new System.ArgumentException(); 96 Console.WriteLine("--------------------");
113
114 AnimationCount = assetData[1];
115 if (assetData.Length - 2 != 16 * AnimationCount)
116 throw new System.ArgumentException();
117
118 // TODO: Read anims from blob
119 } 97 }
120 98
121 public Byte[] ToBytes() 99 public Byte[] ToBytes()
122 { 100 {
123 // TODO: Make blob from anims 101 // If there was an error parsing the input, we give back an
124 return new Byte[0]; 102 // empty set rather than the original data.
103 if (m_parseError)
104 {
105 string dummy = "version 1\ncount 0\n";
106 return System.Text.Encoding.ASCII.GetBytes(dummy);
107 }
108
109 string assetData = String.Format("version 1\ncount {0}\n", m_animations.Count);
110 foreach (KeyValuePair<string, UUID> kvp in m_animations)
111 assetData += String.Format("{0} {1}\n", kvp.Key, kvp.Value.ToString());
112 return System.Text.Encoding.ASCII.GetBytes(assetData);
125 } 113 }
126 114
127 public bool Validate(AnimationSetValidator val) 115 public bool Validate(AnimationSetValidator val)
128 { 116 {
129 List<int> badAnims = new List<int>(); 117 if (m_parseError)
118 return false;
119
120 List<string> badAnims = new List<string>();
130 121
131 bool allOk = true; 122 bool allOk = true;
132 foreach (KeyValuePair<int, UUID> kvp in m_animations) 123 foreach (KeyValuePair<string, UUID> kvp in m_animations)
133 { 124 {
134 if (!val(kvp.Value)) 125 if (!val(kvp.Value))
135 { 126 {
@@ -138,7 +129,7 @@ namespace OpenSim.Framework
138 } 129 }
139 } 130 }
140 131
141 foreach (int idx in badAnims) 132 foreach (string idx in badAnims)
142 m_animations.Remove(idx); 133 m_animations.Remove(idx);
143 134
144 return allOk; 135 return allOk;