aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs5
5 files changed, 69 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
index 65ae445..66edfed 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
@@ -87,13 +87,24 @@ namespace OpenSim.Region.Framework.Scenes.Animation
87 return false; 87 return false;
88 } 88 }
89 89
90 public bool Remove(UUID animID) 90 /// <summary>
91 /// Remove the specified animation
92 /// </summary>
93 /// <param name='animID'></param>
94 /// <param name='allowNoDefault'>
95 /// If true, then the default animation can be entirely removed.
96 /// If false, then removing the default animation will reset it to the simulator default (currently STAND).
97 /// </param>
98 public bool Remove(UUID animID, bool allowNoDefault)
91 { 99 {
92 lock (m_animations) 100 lock (m_animations)
93 { 101 {
94 if (m_defaultAnimation.AnimID == animID) 102 if (m_defaultAnimation.AnimID == animID)
95 { 103 {
96 m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero); 104 if (allowNoDefault)
105 m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero);
106 else
107 ResetDefaultAnimation();
97 } 108 }
98 else if (HasAnimation(animID)) 109 else if (HasAnimation(animID))
99 { 110 {
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 5b16b67..e92a087 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -86,7 +86,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
86 if (m_scenePresence.IsChildAgent) 86 if (m_scenePresence.IsChildAgent)
87 return; 87 return;
88 88
89// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); 89 if (m_scenePresence.Scene.DebugAnimations)
90 m_log.DebugFormat(
91 "[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}",
92 GetAnimName(animID), animID, m_scenePresence.Name);
90 93
91 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) 94 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
92 SendAnimPack(); 95 SendAnimPack();
@@ -109,14 +112,25 @@ namespace OpenSim.Region.Framework.Scenes.Animation
109 AddAnimation(animID, objectID); 112 AddAnimation(animID, objectID);
110 } 113 }
111 114
112 public void RemoveAnimation(UUID animID) 115 /// <summary>
116 /// Remove the specified animation
117 /// </summary>
118 /// <param name='animID'></param>
119 /// <param name='allowNoDefault'>
120 /// If true, then the default animation can be entirely removed.
121 /// If false, then removing the default animation will reset it to the simulator default (currently STAND).
122 /// </param>
123 public void RemoveAnimation(UUID animID, bool allowNoDefault)
113 { 124 {
114 if (m_scenePresence.IsChildAgent) 125 if (m_scenePresence.IsChildAgent)
115 return; 126 return;
116 127
117// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Removing animation {0} for {1}", animID, m_scenePresence.Name); 128 if (m_scenePresence.Scene.DebugAnimations)
129 m_log.DebugFormat(
130 "[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}",
131 GetAnimName(animID), animID, m_scenePresence.Name);
118 132
119 if (m_animations.Remove(animID)) 133 if (m_animations.Remove(animID, allowNoDefault))
120 SendAnimPack(); 134 SendAnimPack();
121 } 135 }
122 136
@@ -132,14 +146,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
132 if (animID == UUID.Zero) 146 if (animID == UUID.Zero)
133 return; 147 return;
134 148
135 RemoveAnimation(animID); 149 RemoveAnimation(animID, true);
136 } 150 }
137 151
138 public void ResetAnimations() 152 public void ResetAnimations()
139 { 153 {
140// m_log.DebugFormat( 154 if (m_scenePresence.Scene.DebugAnimations)
141// "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", 155 m_log.DebugFormat(
142// m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); 156 "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}",
157 m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName);
143 158
144 m_animations.Clear(); 159 m_animations.Clear();
145 } 160 }
@@ -550,5 +565,21 @@ namespace OpenSim.Region.Framework.Scenes.Animation
550 565
551 SendAnimPack(animIDs, sequenceNums, objectIDs); 566 SendAnimPack(animIDs, sequenceNums, objectIDs);
552 } 567 }
568
569 public string GetAnimName(UUID animId)
570 {
571 string animName;
572
573 if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName))
574 {
575 AssetMetadata amd = m_scenePresence.Scene.AssetService.GetMetadata(animId.ToString());
576 if (amd != null)
577 animName = amd.Name;
578 else
579 animName = "Unknown";
580 }
581
582 return animName;
583 }
553 } 584 }
554} 585}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4859dff..5778176 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -68,6 +68,11 @@ namespace OpenSim.Region.Framework.Scenes
68 public bool EmergencyMonitoring = false; 68 public bool EmergencyMonitoring = false;
69 69
70 /// <summary> 70 /// <summary>
71 /// Show debug information about animations.
72 /// </summary>
73 public bool DebugAnimations { get; set; }
74
75 /// <summary>
71 /// Show debug information about teleports. 76 /// Show debug information about teleports.
72 /// </summary> 77 /// </summary>
73 public bool DebugTeleporting { get; set; } 78 public bool DebugTeleporting { get; set; }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 44e8fdf..e0ea344 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1952,6 +1952,16 @@ namespace OpenSim.Region.Framework.Scenes
1952 PhysicsActor pa = PhysActor; 1952 PhysicsActor pa = PhysActor;
1953 1953
1954 if (pa != null) 1954 if (pa != null)
1955 return new Vector3(pa.GeometricCenter.X, pa.GeometricCenter.Y, pa.GeometricCenter.Z);
1956 else
1957 return new Vector3(0, 0, 0);
1958 }
1959
1960 public Vector3 GetCenterOfMass()
1961 {
1962 PhysicsActor pa = PhysActor;
1963
1964 if (pa != null)
1955 return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z); 1965 return new Vector3(pa.CenterOfMass.X, pa.CenterOfMass.Y, pa.CenterOfMass.Z);
1956 else 1966 else
1957 return new Vector3(0, 0, 0); 1967 return new Vector3(0, 0, 0);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6979c33..a90872e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1954,8 +1954,7 @@ namespace OpenSim.Region.Framework.Scenes
1954 { 1954 {
1955 if (ParentID != 0) 1955 if (ParentID != 0)
1956 { 1956 {
1957 var targetPart = m_scene.GetSceneObjectPart(targetID); 1957 if (ParentPart.UUID == targetID)
1958 if (targetPart != null && targetPart.LocalId == ParentID)
1959 return; // already sitting here, ignore 1958 return; // already sitting here, ignore
1960 1959
1961 StandUp(); 1960 StandUp();
@@ -2260,7 +2259,7 @@ namespace OpenSim.Region.Framework.Scenes
2260 2259
2261 public void HandleStopAnim(IClientAPI remoteClient, UUID animID) 2260 public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
2262 { 2261 {
2263 Animator.RemoveAnimation(animID); 2262 Animator.RemoveAnimation(animID, false);
2264 } 2263 }
2265 2264
2266 /// <summary> 2265 /// <summary>