Replace "scene debug true false true" console command with "scene debug scripting true" or other parameters as appropriate.

This is to allow individual switching of scene debug settings and to provide flexibiltiy for additional settings.
0.7.3-extended
Justin Clark-Casey (justincc) 2012-03-21 01:02:58 +00:00
parent 22ea441feb
commit 019fc4c1f2
3 changed files with 46 additions and 38 deletions

View File

@ -928,7 +928,7 @@ namespace OpenSim
break; break;
case "scene": case "scene":
if (args.Length == 5) if (args.Length == 4)
{ {
if (m_sceneManager.CurrentScene == null) if (m_sceneManager.CurrentScene == null)
{ {
@ -936,20 +936,17 @@ namespace OpenSim
} }
else else
{ {
bool scriptingOn = !Convert.ToBoolean(args[2]); string key = args[2];
bool collisionsOn = !Convert.ToBoolean(args[3]); string value = args[3];
bool physicsOn = !Convert.ToBoolean(args[4]); m_sceneManager.CurrentScene.SetSceneCoreDebug(
m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn); new Dictionary<string, string>() { { key, value } });
MainConsole.Instance.Output( MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value);
String.Format(
"Set debug scene scripting = {0}, collisions = {1}, physics = {2}",
!scriptingOn, !collisionsOn, !physicsOn));
} }
} }
else else
{ {
MainConsole.Instance.Output("Usage: debug scene <scripting> <collisions> <physics> (where inside <> is true/false)"); MainConsole.Instance.Output("Usage: debug scene scripting|collisions|physics true|false");
} }
break; break;

View File

@ -671,7 +671,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
Scene.RegionInfo.RegionSettings.Save(); Scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange(); TriggerRegionInfoChange();
Scene.SetSceneCoreDebug(disableScripts, disableCollisions, disablePhysics); Scene.SetSceneCoreDebug(
new Dictionary<string, string>() {
{ "scripting", (!disableScripts).ToString() },
{ "collisions", (!disableCollisions).ToString() },
{ "physics", (!disablePhysics).ToString() }
}
);
} }
private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey)

View File

@ -1030,44 +1030,49 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void SetSceneCoreDebug(bool ScriptEngine, bool CollisionEvents, bool PhysicsEngine) public void SetSceneCoreDebug(Dictionary<string, string> options)
{ {
if (m_scripts_enabled != !ScriptEngine) if (options.ContainsKey("scripting"))
{ {
if (ScriptEngine) bool enableScripts = true;
if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts)
{ {
m_log.Info("Stopping all Scripts in Scene"); if (!enableScripts)
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase ent in entities)
{ {
if (ent is SceneObjectGroup) m_log.Info("Stopping all Scripts in Scene");
((SceneObjectGroup)ent).RemoveScriptInstances(false);
}
}
else
{
m_log.Info("Starting all Scripts in Scene");
EntityBase[] entities = Entities.GetEntities(); EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase ent in entities) foreach (EntityBase ent in entities)
{
if (ent is SceneObjectGroup)
{ {
SceneObjectGroup sog = (SceneObjectGroup)ent; if (ent is SceneObjectGroup)
sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); ((SceneObjectGroup)ent).RemoveScriptInstances(false);
sog.ResumeScripts();
} }
} }
} else
{
m_log.Info("Starting all Scripts in Scene");
m_scripts_enabled = !ScriptEngine; EntityBase[] entities = Entities.GetEntities();
m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); foreach (EntityBase ent in entities)
{
if (ent is SceneObjectGroup)
{
SceneObjectGroup sog = (SceneObjectGroup)ent;
sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
sog.ResumeScripts();
}
}
}
m_scripts_enabled = enableScripts;
}
} }
if (m_physics_enabled != !PhysicsEngine) if (options.ContainsKey("physics"))
{ {
m_physics_enabled = !PhysicsEngine; bool enablePhysics = false;
if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics)
m_physics_enabled = enablePhysics;
} }
} }