diff options
Diffstat (limited to 'OpenSim/Framework/AnimationSet.cs')
-rw-r--r-- | OpenSim/Framework/AnimationSet.cs | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/OpenSim/Framework/AnimationSet.cs b/OpenSim/Framework/AnimationSet.cs index 8ac9081..6c5b15c 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs | |||
@@ -86,13 +86,43 @@ namespace OpenSim.Framework | |||
86 | } | 86 | } |
87 | 87 | ||
88 | public int AnimationCount { get; private set; } | 88 | public int AnimationCount { get; private set; } |
89 | private Dictionary<string, UUID> m_animations = new Dictionary<string, UUID>(); | 89 | private Dictionary<string, KeyValuePair<string, UUID>> m_animations = new Dictionary<string, KeyValuePair<string, UUID>>(); |
90 | |||
91 | public UUID GetAnimation(string index) | ||
92 | { | ||
93 | KeyValuePair<string, UUID> val; | ||
94 | if (m_animations.TryGetValue(index, out val)) | ||
95 | return val.Value; | ||
96 | |||
97 | return UUID.Zero; | ||
98 | } | ||
99 | |||
100 | public string GetAnimationName(string index) | ||
101 | { | ||
102 | KeyValuePair<string, UUID> val; | ||
103 | if (m_animations.TryGetValue(index, out val)) | ||
104 | return val.Key; | ||
105 | |||
106 | return String.Empty; | ||
107 | } | ||
108 | |||
109 | public void SetAnimation(string index, string name, UUID anim) | ||
110 | { | ||
111 | if (anim == UUID.Zero) | ||
112 | { | ||
113 | m_animations.Remove(index); | ||
114 | return; | ||
115 | } | ||
116 | |||
117 | m_animations[index] = new KeyValuePair<string, UUID>(name, anim); | ||
118 | } | ||
119 | |||
90 | public AnimationSet(Byte[] data) | 120 | public AnimationSet(Byte[] data) |
91 | { | 121 | { |
92 | string assetData = System.Text.Encoding.ASCII.GetString(data); | 122 | string assetData = System.Text.Encoding.ASCII.GetString(data); |
93 | Console.WriteLine("--------------------"); | 123 | Console.WriteLine("--------------------"); |
94 | Console.WriteLine("AnimationSet length {0} bytes", assetData.Length); | 124 | Console.WriteLine("AnimationSet length {0} bytes", assetData.Length); |
95 | Console.WriteLine("Data: {0}", assetData); | 125 | Console.WriteLine(assetData); |
96 | Console.WriteLine("--------------------"); | 126 | Console.WriteLine("--------------------"); |
97 | } | 127 | } |
98 | 128 | ||
@@ -107,8 +137,8 @@ namespace OpenSim.Framework | |||
107 | } | 137 | } |
108 | 138 | ||
109 | string assetData = String.Format("version 1\ncount {0}\n", m_animations.Count); | 139 | string assetData = String.Format("version 1\ncount {0}\n", m_animations.Count); |
110 | foreach (KeyValuePair<string, UUID> kvp in m_animations) | 140 | foreach (KeyValuePair<string, KeyValuePair<string, UUID>> kvp in m_animations) |
111 | assetData += String.Format("{0} {1}\n", kvp.Key, kvp.Value.ToString()); | 141 | assetData += String.Format("{0} {1} {2}\n", kvp.Key, kvp.Value.Value.ToString(), kvp.Value.Key); |
112 | return System.Text.Encoding.ASCII.GetBytes(assetData); | 142 | return System.Text.Encoding.ASCII.GetBytes(assetData); |
113 | } | 143 | } |
114 | 144 | ||
@@ -120,9 +150,9 @@ namespace OpenSim.Framework | |||
120 | List<string> badAnims = new List<string>(); | 150 | List<string> badAnims = new List<string>(); |
121 | 151 | ||
122 | bool allOk = true; | 152 | bool allOk = true; |
123 | foreach (KeyValuePair<string, UUID> kvp in m_animations) | 153 | foreach (KeyValuePair<string, KeyValuePair<string, UUID>> kvp in m_animations) |
124 | { | 154 | { |
125 | if (!val(kvp.Value)) | 155 | if (!val(kvp.Value.Value)) |
126 | { | 156 | { |
127 | allOk = false; | 157 | allOk = false; |
128 | badAnims.Add(kvp.Key); | 158 | badAnims.Add(kvp.Key); |