*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

@ -204,7 +204,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
SendAnimPack(); SendAnimPack();
ret = true; 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)) anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
@ -217,6 +223,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
ret = true; ret = true;
} }
} }
}
else else
{ {
m_log.WarnFormat( m_log.WarnFormat(
@ -236,6 +243,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
const float JUMP_PERIOD = 800f; const float JUMP_PERIOD = 800f;
#region Inputs #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; AgentManager.ControlFlags controlFlags = (AgentManager.ControlFlags)m_scenePresence.AgentControlFlags;
PhysicsActor actor = m_scenePresence.PhysicsActor; PhysicsActor actor = m_scenePresence.PhysicsActor;
@ -491,15 +503,20 @@ namespace OpenSim.Region.Framework.Scenes.Animation
public bool ForceUpdateMovementAnimations() public bool ForceUpdateMovementAnimations()
{ {
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Updating movement animations for {0}", m_scenePresence.Name);
bool ret = false;
lock (m_animations) lock (m_animations)
{ {
string newMovementAnimation = DetermineMovementAnimation(); CurrentMovementAnimation = DetermineMovementAnimation();
ret = TrySetMovementAnimation(newMovementAnimation); return TrySetMovementAnimation(CurrentMovementAnimation);
}
}
public bool SetMovementAnimations(string motionState)
{
lock (m_animations)
{
CurrentMovementAnimation = motionState;
return TrySetMovementAnimation(CurrentMovementAnimation);
} }
return ret;
} }
public UUID[] GetAnimationArray() public UUID[] GetAnimationArray()

View File

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

View File

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