diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 4d350dd..43c9288 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | |||
@@ -182,13 +182,14 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
182 | { | 182 | { |
183 | lock (m_animations) | 183 | lock (m_animations) |
184 | { | 184 | { |
185 | int defaultSize = 0; | 185 | int j = 0; |
186 | if (m_defaultAnimation.AnimID != UUID.Zero) | 186 | if (m_defaultAnimation.AnimID != UUID.Zero) |
187 | defaultSize++; | 187 | ++j; |
188 | 188 | ||
189 | animIDs = new UUID[m_animations.Count + defaultSize]; | 189 | int defaultSize = m_animations.Count + j; |
190 | sequenceNums = new int[m_animations.Count + defaultSize]; | 190 | animIDs = new UUID[defaultSize]; |
191 | objectIDs = new UUID[m_animations.Count + defaultSize]; | 191 | sequenceNums = new int[defaultSize]; |
192 | objectIDs = new UUID[defaultSize]; | ||
192 | 193 | ||
193 | if (m_defaultAnimation.AnimID != UUID.Zero) | 194 | if (m_defaultAnimation.AnimID != UUID.Zero) |
194 | { | 195 | { |
@@ -197,35 +198,40 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
197 | objectIDs[0] = m_defaultAnimation.ObjectID; | 198 | objectIDs[0] = m_defaultAnimation.ObjectID; |
198 | } | 199 | } |
199 | 200 | ||
200 | for (int i = 0; i < m_animations.Count; ++i) | 201 | for (int i = 0; i < m_animations.Count; ++i,++j) |
201 | { | 202 | { |
202 | animIDs[i + defaultSize] = m_animations[i].AnimID; | 203 | animIDs[j] = m_animations[i].AnimID; |
203 | sequenceNums[i + defaultSize] = m_animations[i].SequenceNum; | 204 | sequenceNums[j] = m_animations[i].SequenceNum; |
204 | objectIDs[i + defaultSize] = m_animations[i].ObjectID; | 205 | objectIDs[j] = m_animations[i].ObjectID; |
205 | } | 206 | } |
206 | } | 207 | } |
207 | } | 208 | } |
208 | 209 | ||
209 | public OpenSim.Framework.Animation[] ToArray() | 210 | public OpenSim.Framework.Animation[] ToArray() |
210 | { | 211 | { |
211 | OpenSim.Framework.Animation[] theArray = new OpenSim.Framework.Animation[m_animations.Count]; | 212 | OpenSim.Framework.Animation[] theArray = null; |
212 | uint i = 0; | ||
213 | try | 213 | try |
214 | { | 214 | { |
215 | foreach (OpenSim.Framework.Animation anim in m_animations) | 215 | theArray = m_animations.ToArray(); |
216 | theArray[i++] = anim; | ||
217 | } | 216 | } |
218 | catch | 217 | catch |
219 | { | 218 | { |
220 | /* S%^t happens. Ignore. */ | 219 | return new OpenSim.Framework.Animation[0]; |
221 | } | 220 | } |
221 | |||
222 | return theArray; | 222 | return theArray; |
223 | } | 223 | } |
224 | 224 | ||
225 | public void FromArray(OpenSim.Framework.Animation[] theArray) | 225 | public int FromArray(OpenSim.Framework.Animation[] theArray) |
226 | { | 226 | { |
227 | int ret = 0; | ||
227 | foreach (OpenSim.Framework.Animation anim in theArray) | 228 | foreach (OpenSim.Framework.Animation anim in theArray) |
229 | { | ||
228 | m_animations.Add(anim); | 230 | m_animations.Add(anim); |
231 | if(anim.SequenceNum > ret) | ||
232 | ret = anim.SequenceNum; | ||
233 | } | ||
234 | return ret; | ||
229 | } | 235 | } |
230 | 236 | ||
231 | // Create representation of this AnimationSet as an OSDArray. | 237 | // Create representation of this AnimationSet as an OSDArray. |