some retouchs on animationset code
parent
47563564b7
commit
21728b3129
|
@ -182,13 +182,14 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
{
|
{
|
||||||
lock (m_animations)
|
lock (m_animations)
|
||||||
{
|
{
|
||||||
int defaultSize = 0;
|
int j = 0;
|
||||||
if (m_defaultAnimation.AnimID != UUID.Zero)
|
if (m_defaultAnimation.AnimID != UUID.Zero)
|
||||||
defaultSize++;
|
++j;
|
||||||
|
|
||||||
animIDs = new UUID[m_animations.Count + defaultSize];
|
int defaultSize = m_animations.Count + j;
|
||||||
sequenceNums = new int[m_animations.Count + defaultSize];
|
animIDs = new UUID[defaultSize];
|
||||||
objectIDs = new UUID[m_animations.Count + defaultSize];
|
sequenceNums = new int[defaultSize];
|
||||||
|
objectIDs = new UUID[defaultSize];
|
||||||
|
|
||||||
if (m_defaultAnimation.AnimID != UUID.Zero)
|
if (m_defaultAnimation.AnimID != UUID.Zero)
|
||||||
{
|
{
|
||||||
|
@ -197,35 +198,40 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
objectIDs[0] = m_defaultAnimation.ObjectID;
|
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;
|
animIDs[j] = m_animations[i].AnimID;
|
||||||
sequenceNums[i + defaultSize] = m_animations[i].SequenceNum;
|
sequenceNums[j] = m_animations[i].SequenceNum;
|
||||||
objectIDs[i + defaultSize] = m_animations[i].ObjectID;
|
objectIDs[j] = m_animations[i].ObjectID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenSim.Framework.Animation[] ToArray()
|
public OpenSim.Framework.Animation[] ToArray()
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Animation[] theArray = new OpenSim.Framework.Animation[m_animations.Count];
|
OpenSim.Framework.Animation[] theArray = null;
|
||||||
uint i = 0;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (OpenSim.Framework.Animation anim in m_animations)
|
theArray = m_animations.ToArray();
|
||||||
theArray[i++] = anim;
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
/* S%^t happens. Ignore. */
|
return new OpenSim.Framework.Animation[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return theArray;
|
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)
|
foreach (OpenSim.Framework.Animation anim in theArray)
|
||||||
|
{
|
||||||
m_animations.Add(anim);
|
m_animations.Add(anim);
|
||||||
|
if(anim.SequenceNum > ret)
|
||||||
|
ret = anim.SequenceNum;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create representation of this AnimationSet as an OSDArray.
|
// Create representation of this AnimationSet as an OSDArray.
|
||||||
|
|
|
@ -237,8 +237,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
if (anim == "SIT" || anim == "SITGROUND")
|
if (anim == "SIT" || anim == "SITGROUND")
|
||||||
anim = m_scenePresence.sitAnimation;
|
anim = m_scenePresence.sitAnimation;
|
||||||
|
|
||||||
if (m_animations.TrySetDefaultAnimation(
|
if (m_animations.TrySetDefaultAnimation(anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
|
||||||
anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
|
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}",
|
// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}",
|
||||||
|
|
Loading…
Reference in New Issue