diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Animation')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 47 |
2 files changed, 52 insertions, 10 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 | } |