From 9671e43497c7bc09903d0ef34a45ee9ad1665927 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 21 Mar 2012 01:02:58 +0000 Subject: [PATCH] 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. --- OpenSim/Region/Application/OpenSim.cs | 17 +++--- .../World/Estate/EstateManagementModule.cs | 8 ++- OpenSim/Region/Framework/Scenes/Scene.cs | 59 ++++++++++--------- 3 files changed, 46 insertions(+), 38 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index e955a58527..169efbd10c 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -919,7 +919,7 @@ namespace OpenSim break; case "scene": - if (args.Length == 5) + if (args.Length == 4) { if (m_sceneManager.CurrentScene == null) { @@ -927,20 +927,17 @@ namespace OpenSim } else { - bool scriptingOn = !Convert.ToBoolean(args[2]); - bool collisionsOn = !Convert.ToBoolean(args[3]); - bool physicsOn = !Convert.ToBoolean(args[4]); - m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn); + string key = args[2]; + string value = args[3]; + m_sceneManager.CurrentScene.SetSceneCoreDebug( + new Dictionary() { { key, value } }); - MainConsole.Instance.Output( - String.Format( - "Set debug scene scripting = {0}, collisions = {1}, physics = {2}", - !scriptingOn, !collisionsOn, !physicsOn)); + MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value); } } else { - MainConsole.Instance.Output("Usage: debug scene (where inside <> is true/false)"); + MainConsole.Instance.Output("Usage: debug scene scripting|collisions|physics true|false"); } break; diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 1adeb88aa2..fc217b0d4b 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -670,7 +670,13 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); - Scene.SetSceneCoreDebug(disableScripts, disableCollisions, disablePhysics); + Scene.SetSceneCoreDebug( + new Dictionary() { + { "scripting", (!disableScripts).ToString() }, + { "collisions", (!disableCollisions).ToString() }, + { "physics", (!disablePhysics).ToString() } + } + ); } private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 790ec637b8..f2200da257 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1020,44 +1020,49 @@ namespace OpenSim.Region.Framework.Scenes } } - public void SetSceneCoreDebug(bool ScriptEngine, bool CollisionEvents, bool PhysicsEngine) + public void SetSceneCoreDebug(Dictionary 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"); - - EntityBase[] entities = Entities.GetEntities(); - foreach (EntityBase ent in entities) + if (!enableScripts) { - if (ent is SceneObjectGroup) - ((SceneObjectGroup)ent).RemoveScriptInstances(false); - } - } - else - { - m_log.Info("Starting all Scripts in Scene"); - - EntityBase[] entities = Entities.GetEntities(); - foreach (EntityBase ent in entities) - { - if (ent is SceneObjectGroup) + m_log.Info("Stopping all Scripts in Scene"); + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) { - SceneObjectGroup sog = (SceneObjectGroup)ent; - sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); - sog.ResumeScripts(); + if (ent is SceneObjectGroup) + ((SceneObjectGroup)ent).RemoveScriptInstances(false); + } + } + else + { + m_log.Info("Starting all Scripts in Scene"); + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) + { + if (ent is SceneObjectGroup) + { + SceneObjectGroup sog = (SceneObjectGroup)ent; + sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); + sog.ResumeScripts(); + } } } - } - m_scripts_enabled = !ScriptEngine; - m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); + 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; } }