*TEST* add movement states SIT and SITGROUND. ScenePresence on SIT,

SITGROUND or STAND, sets directly the state, and desired sitAnimation for
default sits
avinationmerge
UbitUmarov 2014-09-10 19:30:57 +01:00
parent 0caa59b286
commit f66b58cf00
3 changed files with 74 additions and 37 deletions

View File

@ -200,23 +200,30 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (overridenAnim != UUID.Zero)
{
m_animations.SetDefaultAnimation(overridenAnim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID);
m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION});
m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION });
SendAnimPack();
ret = true;
}
else if (m_animations.TrySetDefaultAnimation(
else
{
// translate sit and sitground state animations
if (anim == "SIT" || anim == "SITGROUND")
anim = m_scenePresence.sitAnimation;
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}",
// anim, m_scenePresence.Name);
// m_log.DebugFormat(
// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}",
// anim, m_scenePresence.Name);
// 16384 is CHANGED_ANIMATION
m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION});
m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION });
SendAnimPack();
ret = true;
}
}
}
else
{
m_log.WarnFormat(
@ -236,6 +243,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
const float JUMP_PERIOD = 800f;
#region Inputs
if (m_scenePresence.SitGround)
return "SITGROUND";
if (m_scenePresence.ParentID != 0 || m_scenePresence.ParentUUID != UUID.Zero)
return "SIT";
AgentManager.ControlFlags controlFlags = (AgentManager.ControlFlags)m_scenePresence.AgentControlFlags;
PhysicsActor actor = m_scenePresence.PhysicsActor;
@ -491,15 +503,20 @@ namespace OpenSim.Region.Framework.Scenes.Animation
public bool ForceUpdateMovementAnimations()
{
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Updating movement animations for {0}", m_scenePresence.Name);
bool ret = false;
lock (m_animations)
{
string newMovementAnimation = DetermineMovementAnimation();
ret = TrySetMovementAnimation(newMovementAnimation);
CurrentMovementAnimation = DetermineMovementAnimation();
return TrySetMovementAnimation(CurrentMovementAnimation);
}
}
public bool SetMovementAnimations(string motionState)
{
lock (m_animations)
{
CurrentMovementAnimation = motionState;
return TrySetMovementAnimation(CurrentMovementAnimation);
}
return ret;
}
public UUID[] GetAnimationArray()

View File

@ -243,7 +243,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Server Side Animation Override
/// </value>
public MovementAnimationOverrides Overrides { get; private set; }
public String sitAnimation = "SIT";
/// <summary>
/// Attachments recorded on this avatar.
/// </summary>
@ -2779,7 +2779,11 @@ namespace OpenSim.Region.Framework.Scenes
SendAvatarDataToAllAgents();
}
Animator.TrySetMovementAnimation("STAND");
// reset to default sitAnimation
sitAnimation = "SIT";
// Animator.TrySetMovementAnimation("STAND");
Animator.SetMovementAnimations("STAND");
TriggerScenePresenceUpdated();
}
@ -3058,11 +3062,18 @@ namespace OpenSim.Region.Framework.Scenes
SendAvatarDataToAllAgents();
/*
if(status == 3)
Animator.TrySetMovementAnimation("SIT_GROUND");
else
Animator.TrySetMovementAnimation("SIT");
*/
if (status == 3)
sitAnimation = "SIT_GROUND";
else
sitAnimation = "SIT";
Animator.SetMovementAnimations("SIT");
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
}
@ -3164,12 +3175,13 @@ namespace OpenSim.Region.Framework.Scenes
SendAvatarDataToAllAgents();
String sitAnimation = "SIT";
sitAnimation = "SIT";
if (!String.IsNullOrEmpty(part.SitAnimation))
{
sitAnimation = part.SitAnimation;
}
Animator.TrySetMovementAnimation(sitAnimation);
// Animator.TrySetMovementAnimation(sitAnimation);
Animator.SetMovementAnimations("SIT");
TriggerScenePresenceUpdated();
}
}
@ -3181,10 +3193,14 @@ namespace OpenSim.Region.Framework.Scenes
// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick..
m_AngularVelocity = Vector3.Zero;
Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
TriggerScenePresenceUpdated();
sitAnimation = "SIT_GROUND_CONSTRAINED";
// Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
// TriggerScenePresenceUpdated();
SitGround = true;
RemoveFromPhysicalScene();
Animator.SetMovementAnimations("SITGROUND");
TriggerScenePresenceUpdated();
}
/// <summary>

View File

@ -132,25 +132,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
private Dictionary<string, string> MovementAnimationsForLSL =
new Dictionary<string, string> {
{"CROUCH", "Crouching"},
{"CROUCHWALK", "CrouchWalking"},
{"FALLDOWN", "Falling Down"},
{"FLY", "Flying"},
{"FLYSLOW", "FlyingSlow"},
{"HOVER", "Hovering"},
{"HOVER_UP", "Hovering Up"},
{"HOVER_DOWN", "Hovering Down"},
{"HOVER", "Hovering"},
{"LAND", "Landing"},
{"FALLDOWN", "Falling Down"},
{"PREJUMP", "PreJumping"},
{"JUMP", "Jumping"},
{"STANDUP", "Standing Up"},
{"SOFT_LAND", "Soft Landing"},
{"STAND", "Standing"},
{"CROUCHWALK", "CrouchWalking"},
{"LAND", "Landing"},
{"PREJUMP", "PreJumping"},
{"RUN", "Running"},
{"WALK", "Walking"},
{"CROUCH", "Crouching"},
{"SIT","Sitting"},
{"SITGROUND","Sitting on Ground"},
{"STAND", "Standing"},
{"STANDUP", "Standing Up"},
{"STRIDE","Striding"},
{"SOFT_LAND", "Soft Landing"},
{"TURNLEFT", "Turning Left"},
{"TURNRIGHT", "Turning Right"}
{"TURNRIGHT", "Turning Right"},
{"WALK", "Walking"}
};
//An array of HTTP/1.1 headers that are not allowed to be used
//as custom headers by llHTTPRequest.
private string[] HttpStandardHeaders =
@ -4884,10 +4888,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
if (presence != null)
{
if (presence.SitGround)
return "Sitting on Ground";
if (presence.ParentID != 0 || presence.ParentUUID != UUID.Zero)
return "Sitting";
// if (presence.SitGround)
// return "Sitting on Ground";
// if (presence.ParentID != 0 || presence.ParentUUID != UUID.Zero)
// return "Sitting";
string movementAnimation = presence.Animator.CurrentMovementAnimation;
string lslMovementAnimation;