29 using System.Collections.Generic;
31 using System.Reflection;
33 using System.Threading;
38 using OpenSim.Framework;
39 using OpenSim.Framework.Console;
40 using OpenSim.Framework.Monitoring;
41 using OpenSim.Region.Framework.Interfaces;
42 using OpenSim.Region.Framework.Scenes;
44 namespace OpenSim.
Region.OptionalModules.
Avatar.Attachments
49 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"SceneCommandsModule")]
54 private Scene m_scene;
56 public string Name {
get {
return "Scene Commands Module"; } }
58 public Type ReplaceableInterface {
get {
return null; } }
94 "Debug",
this,
"debug scene get",
96 "List current scene options.",
97 "active - if false then main scene update and maintenance loops are suspended.\n"
98 +
"animations - if true then extra animations debug information is logged.\n"
99 +
"appear-refresh - if true then appearance is resent to other avatars every 60 seconds.\n"
100 +
"child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n"
101 +
"client-pos-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
102 +
"client-rot-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
103 +
"client-vel-upd - the tolerance before clients are updated with new velocity information for an avatar.\n"
104 +
"root-upd-per - if greater than 1, terse updates are only sent to root agents other than the originator on every n updates.\n"
105 +
"child-upd-per - if greater than 1, terse updates are only sent to child agents on every n updates.\n"
106 +
"collisions - if false then collisions with other objects are turned off.\n"
107 +
"pbackup - if false then periodic scene backup is turned off.\n"
108 +
"physics - if false then all physics objects are non-physical.\n"
109 +
"scripting - if false then no scripting operations happen.\n"
110 +
"teleport - if true then some extra teleport debug information is logged.\n"
111 +
"update-on-timer - If true then the scene is updated via a timer. If false then a thread with sleep is used.\n"
112 +
"updates - if true then any frame which exceeds double the maximum desired frame time is logged.",
113 HandleDebugSceneGetCommand);
116 "Debug",
this,
"debug scene set",
117 "debug scene set <param> <value>",
118 "Turn on scene debugging options.",
119 "active - if false then main scene update and maintenance loops are suspended.\n"
120 +
"animations - if true then extra animations debug information is logged.\n"
121 +
"appear-refresh - if true then appearance is resent to other avatars every 60 seconds.\n"
122 +
"child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n"
123 +
"client-pos-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
124 +
"client-rot-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
125 +
"client-vel-upd - the tolerance before clients are updated with new velocity information for an avatar.\n"
126 +
"root-upd-per - if greater than 1, terse updates are only sent to root agents other than the originator on every n updates.\n"
127 +
"child-upd-per - if greater than 1, terse updates are only sent to child agents on every n updates.\n"
128 +
"collisions - if false then collisions with other objects are turned off.\n"
129 +
"pbackup - if false then periodic scene backup is turned off.\n"
130 +
"physics - if false then all physics objects are non-physical.\n"
131 +
"scripting - if false then no scripting operations happen.\n"
132 +
"teleport - if true then some extra teleport debug information is logged.\n"
133 +
"update-on-timer - If true then the scene is updated via a timer. If false then a thread with sleep is used.\n"
134 +
"updates - if true then any frame which exceeds double the maximum desired frame time is logged.",
135 HandleDebugSceneSetCommand);
138 private void HandleDebugSceneGetCommand(
string module,
string[] args)
140 if (args.Length == 3)
145 OutputSceneDebugOptions();
149 MainConsole.Instance.Output(
"Usage: debug scene get");
153 private void OutputSceneDebugOptions()
156 cdl.AddRow(
"active", m_scene.Active);
157 cdl.AddRow(
"animations", m_scene.DebugAnimations);
158 cdl.AddRow(
"appear-refresh", m_scene.SendPeriodicAppearanceUpdates);
159 cdl.AddRow(
"child-repri", m_scene.ChildReprioritizationDistance);
160 cdl.AddRow(
"client-pos-upd", m_scene.RootPositionUpdateTolerance);
161 cdl.AddRow(
"client-rot-upd", m_scene.RootRotationUpdateTolerance);
162 cdl.AddRow(
"client-vel-upd", m_scene.RootVelocityUpdateTolerance);
163 cdl.AddRow(
"root-upd-per", m_scene.RootTerseUpdatePeriod);
164 cdl.AddRow(
"child-upd-per", m_scene.ChildTerseUpdatePeriod);
165 cdl.AddRow(
"pbackup", m_scene.PeriodicBackup);
166 cdl.AddRow(
"physics", m_scene.PhysicsEnabled);
167 cdl.AddRow(
"scripting", m_scene.ScriptsEnabled);
168 cdl.AddRow(
"teleport", m_scene.DebugTeleporting);
170 cdl.AddRow(
"updates", m_scene.DebugUpdates);
172 MainConsole.Instance.OutputFormat(
"Scene {0} options:", m_scene.Name);
173 MainConsole.Instance.Output(cdl.ToString());
176 private void HandleDebugSceneSetCommand(
string module,
string[] args)
178 if (args.Length == 5)
183 string key = args[3];
184 string value = args[4];
185 SetSceneDebugOptions(
new Dictionary<string, string>() { {
key, value } });
187 MainConsole.Instance.OutputFormat(
"Set {0} debug scene {1} = {2}", m_scene.Name,
key, value);
191 MainConsole.Instance.Output(
"Usage: debug scene set <param> <value>");
197 if (options.ContainsKey(
"active"))
201 if (
bool.TryParse(options[
"active"], out active))
202 m_scene.Active = active;
205 if (options.ContainsKey(
"animations"))
209 if (
bool.TryParse(options[
"animations"], out active))
210 m_scene.DebugAnimations = active;
213 if (options.ContainsKey(
"appear-refresh"))
219 m_scene.SendPeriodicAppearanceUpdates = newValue;
222 if (options.ContainsKey(
"child-repri"))
228 m_scene.ChildReprioritizationDistance = (
float)newValue;
231 if (options.ContainsKey(
"client-pos-upd"))
237 m_scene.RootPositionUpdateTolerance = newValue;
240 if (options.ContainsKey(
"client-rot-upd"))
246 m_scene.RootRotationUpdateTolerance = newValue;
249 if (options.ContainsKey(
"client-vel-upd"))
255 m_scene.RootVelocityUpdateTolerance = newValue;
258 if (options.ContainsKey(
"root-upd-per"))
264 m_scene.RootTerseUpdatePeriod = newValue;
267 if (options.ContainsKey(
"child-upd-per"))
273 m_scene.ChildTerseUpdatePeriod = newValue;
276 if (options.ContainsKey(
"pbackup"))
280 if (
bool.TryParse(options[
"pbackup"], out active))
281 m_scene.PeriodicBackup = active;
284 if (options.ContainsKey(
"scripting"))
286 bool enableScripts =
true;
287 if (
bool.TryParse(options[
"scripting"], out enableScripts))
288 m_scene.ScriptsEnabled = enableScripts;
291 if (options.ContainsKey(
"physics"))
294 if (
bool.TryParse(options[
"physics"], out enablePhysics))
295 m_scene.PhysicsEnabled = enablePhysics;
304 if (options.ContainsKey(
"teleport"))
306 bool enableTeleportDebugging;
307 if (
bool.TryParse(options[
"teleport"], out enableTeleportDebugging))
308 m_scene.DebugTeleporting = enableTeleportDebugging;
311 if (options.ContainsKey(
"update-on-timer"))
313 bool enableUpdateOnTimer;
314 if (
bool.TryParse(options[
"update-on-timer"], out enableUpdateOnTimer))
317 m_scene.Active =
false;
319 while (m_scene.IsRunning)
322 m_scene.Active =
true;
326 if (options.ContainsKey(
"updates"))
328 bool enableUpdateDebugging;
329 if (
bool.TryParse(options[
"updates"], out enableUpdateDebugging))
331 m_scene.DebugUpdates = enableUpdateDebugging;
332 GcNotify.Enabled = enableUpdateDebugging;
Used to generated a formatted table for the console.
static bool TryParseConsoleDouble(ICommandConsole console, string rawConsoleInput, out double i)
Convert a console input to a double, automatically complaining if a console is given.
static bool TryParseConsoleBool(ICommandConsole console, string rawConsoleString, out bool b)
Convert a console input to a bool, automatically complaining if a console is given.
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString key
A module that just holds commands for inspecting avatar appearance.
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void SetSceneDebugOptions(Dictionary< string, string > options)
Sets the scene debug options.
static ICommandConsole Instance
static bool TryParseConsoleFloat(ICommandConsole console, string rawConsoleInput, out float i)
Convert a console input to a float, automatically complaining if a console is given.
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
static bool TryParseConsoleNaturalInt(ICommandConsole console, string rawConsoleInt, out int i)
Convert a console integer to a natural int, automatically complaining if a console is given...
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...