diff options
author | Melanie Thielker | 2014-10-03 18:27:14 +0200 |
---|---|---|
committer | Melanie Thielker | 2014-10-03 18:27:14 +0200 |
commit | c66e4eeb7d2d22a965650b425fdfbd3bbd317d2f (patch) | |
tree | 47e8edd731b85f58d777123f5333d1962fdc5a84 /OpenSim/Framework/AnimationSet.cs | |
parent | Also fetch and store old asset for animation sets (diff) | |
download | opensim-SC-c66e4eeb7d2d22a965650b425fdfbd3bbd317d2f.zip opensim-SC-c66e4eeb7d2d22a965650b425fdfbd3bbd317d2f.tar.gz opensim-SC-c66e4eeb7d2d22a965650b425fdfbd3bbd317d2f.tar.bz2 opensim-SC-c66e4eeb7d2d22a965650b425fdfbd3bbd317d2f.tar.xz |
Also store names of assets in the AnimationSet
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 e81d978..fa71405 100644 --- a/OpenSim/Framework/AnimationSet.cs +++ b/OpenSim/Framework/AnimationSet.cs | |||
@@ -38,13 +38,43 @@ namespace OpenSim.Framework | |||
38 | private bool m_parseError = false; | 38 | private bool m_parseError = false; |
39 | 39 | ||
40 | public int AnimationCount { get; private set; } | 40 | public int AnimationCount { get; private set; } |
41 | private Dictionary<string, UUID> m_animations = new Dictionary<string, UUID>(); | 41 | private Dictionary<string, KeyValuePair<string, UUID>> m_animations = new Dictionary<string, KeyValuePair<string, UUID>>(); |
42 | |||
43 | public UUID GetAnimation(string index) | ||
44 | { | ||
45 | KeyValuePair<string, UUID> val; | ||
46 | if (m_animations.TryGetValue(index, out val)) | ||
47 | return val.Value; | ||
48 | |||
49 | return UUID.Zero; | ||
50 | } | ||
51 | |||
52 | public string GetAnimationName(string index) | ||
53 | { | ||
54 | KeyValuePair<string, UUID> val; | ||
55 | if (m_animations.TryGetValue(index, out val)) | ||
56 | return val.Key; | ||
57 | |||
58 | return String.Empty; | ||
59 | } | ||
60 | |||
61 | public void SetAnimation(string index, string name, UUID anim) | ||
62 | { | ||
63 | if (anim == UUID.Zero) | ||
64 | { | ||
65 | m_animations.Remove(index); | ||
66 | return; | ||
67 | } | ||
68 | |||
69 | m_animations[index] = new KeyValuePair<string, UUID>(name, anim); | ||
70 | } | ||
71 | |||
42 | public AnimationSet(Byte[] data) | 72 | public AnimationSet(Byte[] data) |
43 | { | 73 | { |
44 | string assetData = System.Text.Encoding.ASCII.GetString(data); | 74 | string assetData = System.Text.Encoding.ASCII.GetString(data); |
45 | Console.WriteLine("--------------------"); | 75 | Console.WriteLine("--------------------"); |
46 | Console.WriteLine("AnimationSet length {0} bytes", assetData.Length); | 76 | Console.WriteLine("AnimationSet length {0} bytes", assetData.Length); |
47 | Console.WriteLine("Data: {0}", assetData); | 77 | Console.WriteLine(assetData); |
48 | Console.WriteLine("--------------------"); | 78 | Console.WriteLine("--------------------"); |
49 | } | 79 | } |
50 | 80 | ||
@@ -59,8 +89,8 @@ namespace OpenSim.Framework | |||
59 | } | 89 | } |
60 | 90 | ||
61 | string assetData = String.Format("version 1\ncount {0}\n", m_animations.Count); | 91 | string assetData = String.Format("version 1\ncount {0}\n", m_animations.Count); |
62 | foreach (KeyValuePair<string, UUID> kvp in m_animations) | 92 | foreach (KeyValuePair<string, KeyValuePair<string, UUID>> kvp in m_animations) |
63 | assetData += String.Format("{0} {1}\n", kvp.Key, kvp.Value.ToString()); | 93 | assetData += String.Format("{0} {1} {2}\n", kvp.Key, kvp.Value.Value.ToString(), kvp.Value.Key); |
64 | return System.Text.Encoding.ASCII.GetBytes(assetData); | 94 | return System.Text.Encoding.ASCII.GetBytes(assetData); |
65 | } | 95 | } |
66 | 96 | ||
@@ -72,9 +102,9 @@ namespace OpenSim.Framework | |||
72 | List<string> badAnims = new List<string>(); | 102 | List<string> badAnims = new List<string>(); |
73 | 103 | ||
74 | bool allOk = true; | 104 | bool allOk = true; |
75 | foreach (KeyValuePair<string, UUID> kvp in m_animations) | 105 | foreach (KeyValuePair<string, KeyValuePair<string, UUID>> kvp in m_animations) |
76 | { | 106 | { |
77 | if (!val(kvp.Value)) | 107 | if (!val(kvp.Value.Value)) |
78 | { | 108 | { |
79 | allOk = false; | 109 | allOk = false; |
80 | badAnims.Add(kvp.Key); | 110 | badAnims.Add(kvp.Key); |