From 749c3fef8ad2d3af97fcd9ab9c72740675e46715 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 8 Mar 2012 01:51:37 +0000 Subject: Change "help" to display categories/module list then "help " to display commands in a category. This is to deal with the hundred lines of command splurge when one previously typed "help" Modelled somewhat on the mysql console One can still type help to get per command help at any point. Categories capitalized to avoid conflict with the all-lowercase commands (except for commander system, as of yet). Does not affect command parsing or any other aspects of the console apart from the help system. Backwards compatible with existing modules. --- OpenSim/Region/Framework/Scenes/SceneBase.cs | 71 +++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneBase.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 712e094..495cede 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -472,6 +472,63 @@ namespace OpenSim.Region.Framework.Scenes /// /// Call this from a region module to add a command to the OpenSim console. /// + /// + /// The use of IRegionModuleBase is a cheap trick to get a different method signature, + /// though all new modules should be using interfaces descended from IRegionModuleBase anyway. + /// + /// + /// Category of the command. This is the section under which it will appear when the user asks for help + /// + /// + /// + /// + /// + public void AddCommand( + string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) + { + AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback); + } + + /// + /// Call this from a region module to add a command to the OpenSim console. + /// + /// + /// + /// + /// + /// + /// + public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) + { + string moduleName = ""; + + if (mod != null) + { + if (mod is IRegionModule) + { + IRegionModule module = (IRegionModule)mod; + moduleName = module.Name; + } + else if (mod is IRegionModuleBase) + { + IRegionModuleBase module = (IRegionModuleBase)mod; + moduleName = module.Name; + } + else + { + throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); + } + } + + AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback); + } + + /// + /// Call this from a region module to add a command to the OpenSim console. + /// + /// + /// Category of the command. This is the section under which it will appear when the user asks for help + /// /// /// /// @@ -479,12 +536,12 @@ namespace OpenSim.Region.Framework.Scenes /// /// public void AddCommand( - object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) + string category, object mod, string command, + string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) { if (MainConsole.Instance == null) return; - string modulename = String.Empty; bool shared = false; if (mod != null) @@ -492,20 +549,20 @@ namespace OpenSim.Region.Framework.Scenes if (mod is IRegionModule) { IRegionModule module = (IRegionModule)mod; - modulename = module.Name; shared = module.IsSharedModule; } else if (mod is IRegionModuleBase) { - IRegionModuleBase module = (IRegionModuleBase)mod; - modulename = module.Name; shared = mod is ISharedRegionModule; } - else throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); + else + { + throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); + } } MainConsole.Instance.Commands.AddCommand( - modulename, shared, command, shorthelp, longhelp, descriptivehelp, callback); + category, shared, command, shorthelp, longhelp, descriptivehelp, callback); } public virtual ISceneObject DeserializeObject(string representation) -- cgit v1.1 From 30b2a8c778d02926e038bc62977c4a4c9dbec5ee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 20 Mar 2012 23:12:21 +0000 Subject: Move frame loop entirely within Scene.Update() for better future performance analysis and stat accuracy. Update() now accepts a frames parameter which can control the number of frames updated. -1 will update until shutdown. The watchdog updating moves above the maintc recalculation for any required sleep since it should be accounted for within the frame. --- OpenSim/Region/Framework/Scenes/SceneBase.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneBase.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 495cede..9c6b884 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -149,9 +149,13 @@ namespace OpenSim.Region.Framework.Scenes #region Update Methods /// - /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation) + /// Called to update the scene loop by a number of frames and until shutdown. /// - public abstract void Update(); + /// + /// Number of frames to update. Exits on shutdown even if there are frames remaining. + /// If -1 then updates until shutdown. + /// + public abstract void Update(int frames); #endregion -- cgit v1.1