aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2014-09-10 19:30:57 +0100
committerUbitUmarov2014-09-10 19:30:57 +0100
commitf66b58cf00d4dcbd9d11030809bf9766330966f2 (patch)
tree40cf47bda3160e03d1d94918a795179b01ca2778 /OpenSim
parentFix a nullref that can hit Vivox voice (diff)
downloadopensim-SC-f66b58cf00d4dcbd9d11030809bf9766330966f2.zip
opensim-SC-f66b58cf00d4dcbd9d11030809bf9766330966f2.tar.gz
opensim-SC-f66b58cf00d4dcbd9d11030809bf9766330966f2.tar.bz2
opensim-SC-f66b58cf00d4dcbd9d11030809bf9766330966f2.tar.xz
*TEST* add movement states SIT and SITGROUND. ScenePresence on SIT,
SITGROUND or STAND, sets directly the state, and desired sitAnimation for default sits
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs30
3 files changed, 71 insertions, 34 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index bbc5745..4d1d913 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -200,21 +200,28 @@ namespace OpenSim.Region.Framework.Scenes.Animation
200 if (overridenAnim != UUID.Zero) 200 if (overridenAnim != UUID.Zero)
201 { 201 {
202 m_animations.SetDefaultAnimation(overridenAnim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID); 202 m_animations.SetDefaultAnimation(overridenAnim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID);
203 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); 203 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION });
204 SendAnimPack(); 204 SendAnimPack();
205 ret = true; 205 ret = true;
206 } 206 }
207 else if (m_animations.TrySetDefaultAnimation( 207 else
208 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
209 { 208 {
210// m_log.DebugFormat( 209 // translate sit and sitground state animations
211// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}", 210 if (anim == "SIT" || anim == "SITGROUND")
212// anim, m_scenePresence.Name); 211 anim = m_scenePresence.sitAnimation;
213 212
214 // 16384 is CHANGED_ANIMATION 213 if (m_animations.TrySetDefaultAnimation(
215 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); 214 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
216 SendAnimPack(); 215 {
217 ret = true; 216 // m_log.DebugFormat(
217 // "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}",
218 // anim, m_scenePresence.Name);
219
220 // 16384 is CHANGED_ANIMATION
221 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION });
222 SendAnimPack();
223 ret = true;
224 }
218 } 225 }
219 } 226 }
220 else 227 else
@@ -236,6 +243,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
236 const float JUMP_PERIOD = 800f; 243 const float JUMP_PERIOD = 800f;
237 #region Inputs 244 #region Inputs
238 245
246 if (m_scenePresence.SitGround)
247 return "SITGROUND";
248 if (m_scenePresence.ParentID != 0 || m_scenePresence.ParentUUID != UUID.Zero)
249 return "SIT";
250
239 AgentManager.ControlFlags controlFlags = (AgentManager.ControlFlags)m_scenePresence.AgentControlFlags; 251 AgentManager.ControlFlags controlFlags = (AgentManager.ControlFlags)m_scenePresence.AgentControlFlags;
240 PhysicsActor actor = m_scenePresence.PhysicsActor; 252 PhysicsActor actor = m_scenePresence.PhysicsActor;
241 253
@@ -491,15 +503,20 @@ namespace OpenSim.Region.Framework.Scenes.Animation
491 503
492 public bool ForceUpdateMovementAnimations() 504 public bool ForceUpdateMovementAnimations()
493 { 505 {
494 // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Updating movement animations for {0}", m_scenePresence.Name); 506 lock (m_animations)
507 {
508 CurrentMovementAnimation = DetermineMovementAnimation();
509 return TrySetMovementAnimation(CurrentMovementAnimation);
510 }
511 }
495 512
496 bool ret = false; 513 public bool SetMovementAnimations(string motionState)
514 {
497 lock (m_animations) 515 lock (m_animations)
498 { 516 {
499 string newMovementAnimation = DetermineMovementAnimation(); 517 CurrentMovementAnimation = motionState;
500 ret = TrySetMovementAnimation(newMovementAnimation); 518 return TrySetMovementAnimation(CurrentMovementAnimation);
501 } 519 }
502 return ret;
503 } 520 }
504 521
505 public UUID[] GetAnimationArray() 522 public UUID[] GetAnimationArray()
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5da92f9..fd1bab6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -243,7 +243,7 @@ namespace OpenSim.Region.Framework.Scenes
243 /// Server Side Animation Override 243 /// Server Side Animation Override
244 /// </value> 244 /// </value>
245 public MovementAnimationOverrides Overrides { get; private set; } 245 public MovementAnimationOverrides Overrides { get; private set; }
246 246 public String sitAnimation = "SIT";
247 /// <summary> 247 /// <summary>
248 /// Attachments recorded on this avatar. 248 /// Attachments recorded on this avatar.
249 /// </summary> 249 /// </summary>
@@ -2779,7 +2779,11 @@ namespace OpenSim.Region.Framework.Scenes
2779 SendAvatarDataToAllAgents(); 2779 SendAvatarDataToAllAgents();
2780 } 2780 }
2781 2781
2782 Animator.TrySetMovementAnimation("STAND"); 2782 // reset to default sitAnimation
2783 sitAnimation = "SIT";
2784
2785// Animator.TrySetMovementAnimation("STAND");
2786 Animator.SetMovementAnimations("STAND");
2783 2787
2784 TriggerScenePresenceUpdated(); 2788 TriggerScenePresenceUpdated();
2785 } 2789 }
@@ -3058,11 +3062,18 @@ namespace OpenSim.Region.Framework.Scenes
3058 3062
3059 SendAvatarDataToAllAgents(); 3063 SendAvatarDataToAllAgents();
3060 3064
3065/*
3061 if(status == 3) 3066 if(status == 3)
3062 Animator.TrySetMovementAnimation("SIT_GROUND"); 3067 Animator.TrySetMovementAnimation("SIT_GROUND");
3063 else 3068 else
3064 Animator.TrySetMovementAnimation("SIT"); 3069 Animator.TrySetMovementAnimation("SIT");
3070*/
3071 if (status == 3)
3072 sitAnimation = "SIT_GROUND";
3073 else
3074 sitAnimation = "SIT";
3065 3075
3076 Animator.SetMovementAnimations("SIT");
3066 3077
3067 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); 3078 part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
3068 } 3079 }
@@ -3164,12 +3175,13 @@ namespace OpenSim.Region.Framework.Scenes
3164 3175
3165 SendAvatarDataToAllAgents(); 3176 SendAvatarDataToAllAgents();
3166 3177
3167 String sitAnimation = "SIT"; 3178 sitAnimation = "SIT";
3168 if (!String.IsNullOrEmpty(part.SitAnimation)) 3179 if (!String.IsNullOrEmpty(part.SitAnimation))
3169 { 3180 {
3170 sitAnimation = part.SitAnimation; 3181 sitAnimation = part.SitAnimation;
3171 } 3182 }
3172 Animator.TrySetMovementAnimation(sitAnimation); 3183// Animator.TrySetMovementAnimation(sitAnimation);
3184 Animator.SetMovementAnimations("SIT");
3173 TriggerScenePresenceUpdated(); 3185 TriggerScenePresenceUpdated();
3174 } 3186 }
3175 } 3187 }
@@ -3181,10 +3193,14 @@ namespace OpenSim.Region.Framework.Scenes
3181 3193
3182// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. 3194// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick..
3183 m_AngularVelocity = Vector3.Zero; 3195 m_AngularVelocity = Vector3.Zero;
3184 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); 3196 sitAnimation = "SIT_GROUND_CONSTRAINED";
3185 TriggerScenePresenceUpdated(); 3197// Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
3198// TriggerScenePresenceUpdated();
3186 SitGround = true; 3199 SitGround = true;
3187 RemoveFromPhysicalScene(); 3200 RemoveFromPhysicalScene();
3201
3202 Animator.SetMovementAnimations("SITGROUND");
3203 TriggerScenePresenceUpdated();
3188 } 3204 }
3189 3205
3190 /// <summary> 3206 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 755646f..ca682d3 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -132,25 +132,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
132 132
133 private Dictionary<string, string> MovementAnimationsForLSL = 133 private Dictionary<string, string> MovementAnimationsForLSL =
134 new Dictionary<string, string> { 134 new Dictionary<string, string> {
135 {"CROUCH", "Crouching"},
136 {"CROUCHWALK", "CrouchWalking"},
137 {"FALLDOWN", "Falling Down"},
135 {"FLY", "Flying"}, 138 {"FLY", "Flying"},
136 {"FLYSLOW", "FlyingSlow"}, 139 {"FLYSLOW", "FlyingSlow"},
140 {"HOVER", "Hovering"},
137 {"HOVER_UP", "Hovering Up"}, 141 {"HOVER_UP", "Hovering Up"},
138 {"HOVER_DOWN", "Hovering Down"}, 142 {"HOVER_DOWN", "Hovering Down"},
139 {"HOVER", "Hovering"}, 143 {"JUMP", "Jumping"},
140 {"LAND", "Landing"}, 144 {"LAND", "Landing"},
141 {"FALLDOWN", "Falling Down"},
142 {"PREJUMP", "PreJumping"}, 145 {"PREJUMP", "PreJumping"},
143 {"JUMP", "Jumping"}, 146 {"RUN", "Running"},
147 {"SIT","Sitting"},
148 {"SITGROUND","Sitting on Ground"},
149 {"STAND", "Standing"},
144 {"STANDUP", "Standing Up"}, 150 {"STANDUP", "Standing Up"},
151 {"STRIDE","Striding"},
145 {"SOFT_LAND", "Soft Landing"}, 152 {"SOFT_LAND", "Soft Landing"},
146 {"STAND", "Standing"},
147 {"CROUCHWALK", "CrouchWalking"},
148 {"RUN", "Running"},
149 {"WALK", "Walking"},
150 {"CROUCH", "Crouching"},
151 {"TURNLEFT", "Turning Left"}, 153 {"TURNLEFT", "Turning Left"},
152 {"TURNRIGHT", "Turning Right"} 154 {"TURNRIGHT", "Turning Right"},
155 {"WALK", "Walking"}
153 }; 156 };
157
154 //An array of HTTP/1.1 headers that are not allowed to be used 158 //An array of HTTP/1.1 headers that are not allowed to be used
155 //as custom headers by llHTTPRequest. 159 //as custom headers by llHTTPRequest.
156 private string[] HttpStandardHeaders = 160 private string[] HttpStandardHeaders =
@@ -4884,10 +4888,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4884 { 4888 {
4885 if (presence != null) 4889 if (presence != null)
4886 { 4890 {
4887 if (presence.SitGround) 4891// if (presence.SitGround)
4888 return "Sitting on Ground"; 4892// return "Sitting on Ground";
4889 if (presence.ParentID != 0 || presence.ParentUUID != UUID.Zero) 4893// if (presence.ParentID != 0 || presence.ParentUUID != UUID.Zero)
4890 return "Sitting"; 4894// return "Sitting";
4891 4895
4892 string movementAnimation = presence.Animator.CurrentMovementAnimation; 4896 string movementAnimation = presence.Animator.CurrentMovementAnimation;
4893 string lslMovementAnimation; 4897 string lslMovementAnimation;