some retouchs on animationset code

0.9.1.0-post-fixes
UbitUmarov 2018-12-28 11:38:00 +00:00
parent 47563564b7
commit 21728b3129
2 changed files with 22 additions and 17 deletions

View File

@ -182,13 +182,14 @@ namespace OpenSim.Region.Framework.Scenes.Animation
{
lock (m_animations)
{
int defaultSize = 0;
int j = 0;
if (m_defaultAnimation.AnimID != UUID.Zero)
defaultSize++;
++j;
animIDs = new UUID[m_animations.Count + defaultSize];
sequenceNums = new int[m_animations.Count + defaultSize];
objectIDs = new UUID[m_animations.Count + defaultSize];
int defaultSize = m_animations.Count + j;
animIDs = new UUID[defaultSize];
sequenceNums = new int[defaultSize];
objectIDs = new UUID[defaultSize];
if (m_defaultAnimation.AnimID != UUID.Zero)
{
@ -197,35 +198,40 @@ namespace OpenSim.Region.Framework.Scenes.Animation
objectIDs[0] = m_defaultAnimation.ObjectID;
}
for (int i = 0; i < m_animations.Count; ++i)
for (int i = 0; i < m_animations.Count; ++i,++j)
{
animIDs[i + defaultSize] = m_animations[i].AnimID;
sequenceNums[i + defaultSize] = m_animations[i].SequenceNum;
objectIDs[i + defaultSize] = m_animations[i].ObjectID;
animIDs[j] = m_animations[i].AnimID;
sequenceNums[j] = m_animations[i].SequenceNum;
objectIDs[j] = m_animations[i].ObjectID;
}
}
}
public OpenSim.Framework.Animation[] ToArray()
{
OpenSim.Framework.Animation[] theArray = new OpenSim.Framework.Animation[m_animations.Count];
uint i = 0;
OpenSim.Framework.Animation[] theArray = null;
try
{
foreach (OpenSim.Framework.Animation anim in m_animations)
theArray[i++] = anim;
theArray = m_animations.ToArray();
}
catch
{
/* S%^t happens. Ignore. */
return new OpenSim.Framework.Animation[0];
}
return theArray;
}
public void FromArray(OpenSim.Framework.Animation[] theArray)
public int FromArray(OpenSim.Framework.Animation[] theArray)
{
int ret = 0;
foreach (OpenSim.Framework.Animation anim in theArray)
{
m_animations.Add(anim);
if(anim.SequenceNum > ret)
ret = anim.SequenceNum;
}
return ret;
}
// Create representation of this AnimationSet as an OSDArray.

View File

@ -237,8 +237,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (anim == "SIT" || anim == "SITGROUND")
anim = m_scenePresence.sitAnimation;
if (m_animations.TrySetDefaultAnimation(
anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
if (m_animations.TrySetDefaultAnimation(anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
{
// m_log.DebugFormat(
// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}",