mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
some cleaup; simplify some animations code
This commit is contained in:
@@ -179,6 +179,27 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
return false;
|
||||
}
|
||||
|
||||
public void GetAnimationIDsArray(out UUID[] animIDs)
|
||||
{
|
||||
lock (m_animations)
|
||||
{
|
||||
int j = m_defaultAnimation.AnimID.IsZero() ? 0 : 1;
|
||||
|
||||
int defaultSize = m_animations.Count + j;
|
||||
animIDs = new UUID[defaultSize];
|
||||
|
||||
if (j > 0)
|
||||
{
|
||||
animIDs[0] = m_defaultAnimation.AnimID;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_animations.Count; ++i, ++j)
|
||||
{
|
||||
animIDs[j] = m_animations[i].AnimID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GetArrays(out UUID[] animIDs, out int[] sequenceNums, out UUID[] objectIDs)
|
||||
{
|
||||
lock (m_animations)
|
||||
@@ -190,7 +211,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
sequenceNums = new int[defaultSize];
|
||||
objectIDs = new UUID[defaultSize];
|
||||
|
||||
if (m_defaultAnimation.AnimID.IsNotZero())
|
||||
if (j > 0)
|
||||
{
|
||||
animIDs[0] = m_defaultAnimation.AnimID;
|
||||
sequenceNums[0] = m_defaultAnimation.SequenceNum;
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
public ScenePresenceAnimator(ScenePresence sp)
|
||||
{
|
||||
m_scenePresence = sp;
|
||||
CurrentMovementAnimation = "CROUCH";
|
||||
CurrentMovementAnimation = "STAND";
|
||||
}
|
||||
|
||||
public void AddAnimation(UUID animID, UUID objectID)
|
||||
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
if (m_scenePresence.IsChildAgent)
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
|
||||
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
|
||||
if (m_scenePresence.Scene.DebugAnimations)
|
||||
m_log.DebugFormat(
|
||||
"[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}",
|
||||
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
if (animID.IsZero())
|
||||
return;
|
||||
|
||||
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name);
|
||||
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name);
|
||||
|
||||
AddAnimation(animID, objectID);
|
||||
}
|
||||
@@ -154,7 +154,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
m_animations.Remove(animID, false);
|
||||
}
|
||||
if (sendPack)
|
||||
SendAnimPack(false);
|
||||
SendAnimPack();
|
||||
}
|
||||
|
||||
// Called from scripts
|
||||
@@ -616,13 +616,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
|
||||
public UUID[] GetAnimationArray()
|
||||
{
|
||||
UUID[] animIDs;
|
||||
int[] sequenceNums;
|
||||
UUID[] objectIDs;
|
||||
m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs);
|
||||
m_animations.GetAnimationIDsArray(out UUID[] animIDs);
|
||||
return animIDs;
|
||||
}
|
||||
|
||||
public bool HasAnimation(UUID animID)
|
||||
{
|
||||
return m_animations.HasAnimation(animID);
|
||||
}
|
||||
|
||||
public BinBVHAnimation GenerateRandomAnimation()
|
||||
{
|
||||
int rnditerations = 3;
|
||||
@@ -853,7 +855,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
/// <summary>
|
||||
/// Send animation information about this avatar to all clients.
|
||||
/// </summary>
|
||||
public void SendAnimPack(bool selfIncluded = true)
|
||||
public void SendAnimPack()
|
||||
{
|
||||
//m_log.Debug("Sending animation pack to all");
|
||||
|
||||
@@ -866,11 +868,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
|
||||
m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs);
|
||||
|
||||
//SendAnimPack(animIDs, sequenceNums, objectIDs);
|
||||
//if(selfIncluded)
|
||||
m_scenePresence.SendAnimPack(animIDs, sequenceNums, objectIDs);
|
||||
//else
|
||||
// m_scenePresence.SendAnimPackToOthers(animIDs, sequenceNums, objectIDs);
|
||||
m_scenePresence.SendAnimPack(animIDs, sequenceNums, objectIDs);
|
||||
}
|
||||
|
||||
public string GetAnimName(UUID animId)
|
||||
|
||||
@@ -6476,6 +6476,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
/// AGENT_BUSY
|
||||
/// Remove as they are done
|
||||
/// </summary>
|
||||
static readonly UUID busyAnimation = new UUID("efcf670c-2d18-8128-973a-034ebc806b67");
|
||||
|
||||
public LSL_Integer llGetAgentInfo(LSL_Key id)
|
||||
{
|
||||
|
||||
@@ -6522,9 +6524,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
flags |= ScriptBaseClass.AGENT_AWAY;
|
||||
}
|
||||
|
||||
UUID busy = new UUID("efcf670c-2d18-8128-973a-034ebc806b67");
|
||||
UUID[] anims = agent.Animator.GetAnimationArray();
|
||||
if (Array.Exists<UUID>(anims, a => { return a == busy; }))
|
||||
if(agent.Animator.HasAnimation(busyAnimation))
|
||||
{
|
||||
flags |= ScriptBaseClass.AGENT_BUSY;
|
||||
}
|
||||
@@ -8071,15 +8071,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
public LSL_Integer llScriptDanger(LSL_Vector pos)
|
||||
{
|
||||
bool result = World.LSLScriptDanger(m_host, pos);
|
||||
if (result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return World.LSLScriptDanger(m_host, pos) ? 1 : 0;
|
||||
}
|
||||
|
||||
public void llDialog(LSL_Key avatar, LSL_String message, LSL_List buttons, int chat_channel)
|
||||
@@ -10917,8 +10909,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if (av == null || av.IsChildAgent) // only if in the region
|
||||
return new LSL_List();
|
||||
|
||||
UUID[] anims;
|
||||
anims = av.Animator.GetAnimationArray();
|
||||
UUID[] anims = av.Animator.GetAnimationArray();
|
||||
LSL_List l = new LSL_List();
|
||||
foreach (UUID foo in anims)
|
||||
l.Add(new LSL_Key(foo.ToString()));
|
||||
|
||||
Reference in New Issue
Block a user