29 using System.Collections.Generic;
31 using System.Reflection;
37 using OpenSim.Framework;
38 using OpenSim.Framework.Console;
39 using OpenSim.Framework.Monitoring;
40 using OpenSim.Region.ClientStack.LindenUDP;
41 using OpenSim.Region.Framework.Interfaces;
42 using OpenSim.Region.Framework.Scenes;
44 using OpenSim.Services.Interfaces;
52 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"AnimationsCommandModule")]
57 private List<Scene> m_scenes =
new List<Scene>();
59 public string Name {
get {
return "Animations Command Module"; } }
61 public Type ReplaceableInterface {
get {
return null; } }
88 m_scenes.Remove(scene);
99 "Users",
this,
"show animations",
100 "show animations [<first-name> <last-name>]",
101 "Show animation information for avatars in this simulator.",
102 "If no name is supplied then information for all avatars is shown.\n"
103 +
"Please note that for inventory animations, the animation name is the name under which the animation was originally uploaded\n"
104 +
", which is not necessarily the current inventory name.",
105 HandleShowAnimationsCommand);
110 if (cmd.Length != 2 && cmd.Length < 4)
112 MainConsole.Instance.OutputFormat(
"Usage: show animations [<first-name> <last-name>]");
116 bool targetNameSupplied =
false;
117 string optionalTargetFirstName = null;
118 string optionalTargetLastName = null;
122 targetNameSupplied =
true;
123 optionalTargetFirstName = cmd[2];
124 optionalTargetLastName = cmd[3];
127 StringBuilder sb =
new StringBuilder();
131 foreach (
Scene scene
in m_scenes)
133 if (targetNameSupplied)
135 ScenePresence sp = scene.GetScenePresence(optionalTargetFirstName, optionalTargetLastName);
137 GetAttachmentsReport(sp, sb);
141 scene.ForEachRootScenePresence(sp => GetAttachmentsReport(sp, sb));
146 MainConsole.Instance.Output(sb.ToString());
149 private void GetAttachmentsReport(
ScenePresence sp, StringBuilder sb)
151 sb.AppendFormat(
"Animations for {0}\n", sp.Name);
157 string cma = spa.CurrentMovementAnimation;
159 "Current movement anim",
160 string.Format(
"{0}, {1}", DefaultAvatarAnimations.GetDefaultAnimation(cma), cma));
162 UUID defaultAnimId = anims.DefaultAnimation.AnimID;
165 string.Format(
"{0}, {1}", defaultAnimId, sp.Animator.GetAnimName(defaultAnimId)));
167 UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID;
169 "Implicit default anim",
170 string.Format(
"{0}, {1}",
171 implicitDefaultAnimId, sp.Animator.GetAnimName(implicitDefaultAnimId)));
173 cdl.AddToStringBuilder(sb);
176 cdt.AddColumn(
"Animation ID", 36);
177 cdt.AddColumn(
"Name", 20);
178 cdt.AddColumn(
"Seq", 3);
179 cdt.AddColumn(
"Object ID", 36);
182 int[] sequenceNumbers;
185 sp.Animator.Animations.GetArrays(out animIds, out sequenceNumbers, out objectIds);
187 for (
int i = 0; i < animIds.Length; i++)
189 UUID animId = animIds[i];
190 string animName = sp.Animator.GetAnimName(animId);
191 int seq = sequenceNumbers[i];
192 UUID objectId = objectIds[i];
194 cdt.AddRow(animId, animName, seq, objectId);
197 cdt.AddToStringBuilder(sb);
Used to generated a formatted table for the console.
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
Used to generated a formatted table for the console.
A module that just holds commands for inspecting avatar animations.
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
Handle all animation duties for a scene presence
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
Interactive OpenSim region server
OpenSim.Framework.Animation Animation
void HandleShowAnimationsCommand(string module, string[] cmd)
OpenSim.Region.Framework.Scenes.Animation.AnimationSet AnimationSet