diff options
Merge branch 'avination-current' of ssh://3dhosting.de/var/git/careminster into avination-current
Conflicts:
bin/Regions/Regions.ini.example
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 | 57 |
2 files changed, 62 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 9458079..65c279e 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -26,9 +26,10 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Threading; | ||
30 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | ||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | ||
32 | using log4net; | 33 | using log4net; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -86,6 +87,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
86 | return; | 87 | return; |
87 | 88 | ||
88 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); | 89 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); |
90 | if (m_scenePresence.Scene.DebugAnimations) | ||
91 | m_log.DebugFormat( | ||
92 | "[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", | ||
93 | GetAnimName(animID), animID, m_scenePresence.Name); | ||
89 | 94 | ||
90 | if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) | 95 | if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) |
91 | SendAnimPack(); | 96 | SendAnimPack(); |
@@ -108,12 +113,25 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
108 | AddAnimation(animID, objectID); | 113 | AddAnimation(animID, objectID); |
109 | } | 114 | } |
110 | 115 | ||
111 | public void RemoveAnimation(UUID animID) | 116 | /// <summary> |
117 | /// Remove the specified animation | ||
118 | /// </summary> | ||
119 | /// <param name='animID'></param> | ||
120 | /// <param name='allowNoDefault'> | ||
121 | /// If true, then the default animation can be entirely removed. | ||
122 | /// If false, then removing the default animation will reset it to the simulator default (currently STAND). | ||
123 | /// </param> | ||
124 | public void RemoveAnimation(UUID animID, bool allowNoDefault) | ||
112 | { | 125 | { |
113 | if (m_scenePresence.IsChildAgent) | 126 | if (m_scenePresence.IsChildAgent) |
114 | return; | 127 | return; |
115 | 128 | ||
116 | if (m_animations.Remove(animID)) | 129 | if (m_scenePresence.Scene.DebugAnimations) |
130 | m_log.DebugFormat( | ||
131 | "[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}", | ||
132 | GetAnimName(animID), animID, m_scenePresence.Name); | ||
133 | |||
134 | if (m_animations.Remove(animID, allowNoDefault)) | ||
117 | SendAnimPack(); | 135 | SendAnimPack(); |
118 | } | 136 | } |
119 | 137 | ||
@@ -127,7 +145,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
127 | if (addRemove) | 145 | if (addRemove) |
128 | m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero); | 146 | m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero); |
129 | else | 147 | else |
130 | m_animations.Remove(animID); | 148 | m_animations.Remove(animID, true); |
131 | } | 149 | } |
132 | if(sendPack) | 150 | if(sendPack) |
133 | SendAnimPack(); | 151 | SendAnimPack(); |
@@ -145,14 +163,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
145 | if (animID == UUID.Zero) | 163 | if (animID == UUID.Zero) |
146 | return; | 164 | return; |
147 | 165 | ||
148 | RemoveAnimation(animID); | 166 | RemoveAnimation(animID, true); |
149 | } | 167 | } |
150 | 168 | ||
151 | public void ResetAnimations() | 169 | public void ResetAnimations() |
152 | { | 170 | { |
153 | // m_log.DebugFormat( | 171 | if (m_scenePresence.Scene.DebugAnimations) |
154 | // "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", | 172 | m_log.DebugFormat( |
155 | // m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); | 173 | "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", |
174 | m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); | ||
156 | 175 | ||
157 | m_animations.Clear(); | 176 | m_animations.Clear(); |
158 | } | 177 | } |
@@ -519,6 +538,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
519 | if (m_scenePresence.IsChildAgent) | 538 | if (m_scenePresence.IsChildAgent) |
520 | return; | 539 | return; |
521 | 540 | ||
541 | // m_log.DebugFormat( | ||
542 | // "[SCENE PRESENCE ANIMATOR]: Sending anim pack with animations '{0}', sequence '{1}', uuids '{2}'", | ||
543 | // string.Join(",", Array.ConvertAll<UUID, string>(animations, a => a.ToString())), | ||
544 | // string.Join(",", Array.ConvertAll<int, string>(seqs, s => s.ToString())), | ||
545 | // string.Join(",", Array.ConvertAll<UUID, string>(objectIDs, o => o.ToString()))); | ||
546 | |||
522 | m_scenePresence.Scene.ForEachClient( | 547 | m_scenePresence.Scene.ForEachClient( |
523 | delegate(IClientAPI client) | 548 | delegate(IClientAPI client) |
524 | { | 549 | { |
@@ -557,5 +582,21 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
557 | 582 | ||
558 | SendAnimPack(animIDs, sequenceNums, objectIDs); | 583 | SendAnimPack(animIDs, sequenceNums, objectIDs); |
559 | } | 584 | } |
585 | |||
586 | public string GetAnimName(UUID animId) | ||
587 | { | ||
588 | string animName; | ||
589 | |||
590 | if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName)) | ||
591 | { | ||
592 | AssetMetadata amd = m_scenePresence.Scene.AssetService.GetMetadata(animId.ToString()); | ||
593 | if (amd != null) | ||
594 | animName = amd.Name; | ||
595 | else | ||
596 | animName = "Unknown"; | ||
597 | } | ||
598 | |||
599 | return animName; | ||
600 | } | ||
560 | } | 601 | } |
561 | } | 602 | } |