aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-01-10 23:49:48 +0000
committerJustin Clark-Casey (justincc)2013-01-10 23:49:48 +0000
commita16ae5d7e3e687fdcdae39f848f66087f16433a2 (patch)
treefe0c7fe3aaff713bdce71f1ba2a86c1a9170f291 /OpenSim/Region/Framework
parentrefactor: route the final scene backup through the same code that handles per... (diff)
downloadopensim-SC_OLD-a16ae5d7e3e687fdcdae39f848f66087f16433a2.zip
opensim-SC_OLD-a16ae5d7e3e687fdcdae39f848f66087f16433a2.tar.gz
opensim-SC_OLD-a16ae5d7e3e687fdcdae39f848f66087f16433a2.tar.bz2
opensim-SC_OLD-a16ae5d7e3e687fdcdae39f848f66087f16433a2.tar.xz
Move scene debug commands into separate module. Command changes from "debug scene <key> <value>" to "debug scene set <key> <value>" to accomodate future settings
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs43
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs153
2 files changed, 102 insertions, 94 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs b/OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs
new file mode 100644
index 0000000..c5e678b
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs
@@ -0,0 +1,43 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes;
33
34namespace OpenSim.Region.Framework.Interfaces
35{
36 public interface ISceneCommandsModule
37 {
38 /// <summary>
39 /// Sets the scene debug options.
40 /// </summary>
41 void SetSceneDebugOptions(Dictionary<string, string> options);
42 }
43} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 515184c..4859dff 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -70,12 +70,12 @@ namespace OpenSim.Region.Framework.Scenes
70 /// <summary> 70 /// <summary>
71 /// Show debug information about teleports. 71 /// Show debug information about teleports.
72 /// </summary> 72 /// </summary>
73 public bool DebugTeleporting { get; private set; } 73 public bool DebugTeleporting { get; set; }
74 74
75 /// <summary> 75 /// <summary>
76 /// Show debug information about the scene loop. 76 /// Show debug information about the scene loop.
77 /// </summary> 77 /// </summary>
78 public bool DebugUpdates { get; private set; } 78 public bool DebugUpdates { get; set; }
79 79
80 /// <summary> 80 /// <summary>
81 /// If true then the scene is saved to persistent storage periodically, every m_update_backup frames and 81 /// If true then the scene is saved to persistent storage periodically, every m_update_backup frames and
@@ -86,13 +86,61 @@ namespace OpenSim.Region.Framework.Scenes
86 /// FIXME: Currently, setting this to false will mean that objects are not periodically returned from parcels. 86 /// FIXME: Currently, setting this to false will mean that objects are not periodically returned from parcels.
87 /// This needs to be fixed. 87 /// This needs to be fixed.
88 /// </remarks> 88 /// </remarks>
89 public bool PeriodicBackup { get; private set; } 89 public bool PeriodicBackup { get; set; }
90 90
91 /// <summary> 91 /// <summary>
92 /// If false then the scene is never saved to persistence storage even if PeriodicBackup == true and even 92 /// If false then the scene is never saved to persistence storage even if PeriodicBackup == true and even
93 /// if the scene is being shut down for the final time. 93 /// if the scene is being shut down for the final time.
94 /// </summary> 94 /// </summary>
95 public bool UseBackup { get; private set; } 95 public bool UseBackup { get; set; }
96
97 /// <summary>
98 /// If false then physical objects are disabled, though collisions will continue as normal.
99 /// </summary>
100 public bool PhysicsEnabled { get; set; }
101
102 /// <summary>
103 /// If false then scripts are not enabled on the smiulator
104 /// </summary>
105 public bool ScriptsEnabled
106 {
107 get { return m_scripts_enabled; }
108 set
109 {
110 if (m_scripts_enabled != value)
111 {
112 if (!value)
113 {
114 m_log.Info("Stopping all Scripts in Scene");
115
116 EntityBase[] entities = Entities.GetEntities();
117 foreach (EntityBase ent in entities)
118 {
119 if (ent is SceneObjectGroup)
120 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
121 }
122 }
123 else
124 {
125 m_log.Info("Starting all Scripts in Scene");
126
127 EntityBase[] entities = Entities.GetEntities();
128 foreach (EntityBase ent in entities)
129 {
130 if (ent is SceneObjectGroup)
131 {
132 SceneObjectGroup sog = (SceneObjectGroup)ent;
133 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
134 sog.ResumeScripts();
135 }
136 }
137 }
138
139 m_scripts_enabled = value;
140 }
141 }
142 }
143 private bool m_scripts_enabled;
96 144
97 public SynchronizeSceneHandler SynchronizeScene; 145 public SynchronizeSceneHandler SynchronizeScene;
98 146
@@ -299,8 +347,6 @@ namespace OpenSim.Region.Framework.Scenes
299 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); 347 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
300 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); 348 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
301 349
302 private bool m_physics_enabled = true;
303 private bool m_scripts_enabled = true;
304 private string m_defaultScriptEngine; 350 private string m_defaultScriptEngine;
305 351
306 /// <summary> 352 /// <summary>
@@ -762,9 +808,11 @@ namespace OpenSim.Region.Framework.Scenes
762 808
763 DumpAssetsToFile = dumpAssetsToFile; 809 DumpAssetsToFile = dumpAssetsToFile;
764 810
811 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
812 // better in the future.
765 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; 813 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
766 814
767 m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; 815 PhysicsEnabled = !RegionInfo.RegionSettings.DisablePhysics;
768 816
769 m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; 817 m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
770 818
@@ -948,6 +996,8 @@ namespace OpenSim.Region.Framework.Scenes
948 { 996 {
949 PhysicalPrims = true; 997 PhysicalPrims = true;
950 CollidablePrims = true; 998 CollidablePrims = true;
999 PhysicsEnabled = true;
1000
951 PeriodicBackup = true; 1001 PeriodicBackup = true;
952 UseBackup = true; 1002 UseBackup = true;
953 1003
@@ -1192,91 +1242,6 @@ namespace OpenSim.Region.Framework.Scenes
1192 } 1242 }
1193 } 1243 }
1194 1244
1195 public void SetSceneCoreDebug(Dictionary<string, string> options)
1196 {
1197 if (options.ContainsKey("active"))
1198 {
1199 bool active;
1200
1201 if (bool.TryParse(options["active"], out active))
1202 Active = active;
1203 }
1204
1205 if (options.ContainsKey("pbackup"))
1206 {
1207 bool active;
1208
1209 if (bool.TryParse(options["pbackup"], out active))
1210 PeriodicBackup = active;
1211 }
1212
1213 if (options.ContainsKey("scripting"))
1214 {
1215 bool enableScripts = true;
1216 if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts)
1217 {
1218 if (!enableScripts)
1219 {
1220 m_log.Info("Stopping all Scripts in Scene");
1221
1222 EntityBase[] entities = Entities.GetEntities();
1223 foreach (EntityBase ent in entities)
1224 {
1225 if (ent is SceneObjectGroup)
1226 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
1227 }
1228 }
1229 else
1230 {
1231 m_log.Info("Starting all Scripts in Scene");
1232
1233 EntityBase[] entities = Entities.GetEntities();
1234 foreach (EntityBase ent in entities)
1235 {
1236 if (ent is SceneObjectGroup)
1237 {
1238 SceneObjectGroup sog = (SceneObjectGroup)ent;
1239 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
1240 sog.ResumeScripts();
1241 }
1242 }
1243 }
1244
1245 m_scripts_enabled = enableScripts;
1246 }
1247 }
1248
1249 if (options.ContainsKey("physics"))
1250 {
1251 bool enablePhysics;
1252 if (bool.TryParse(options["physics"], out enablePhysics))
1253 m_physics_enabled = enablePhysics;
1254 }
1255
1256// if (options.ContainsKey("collisions"))
1257// {
1258// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow
1259// // the avatar themselves to collide with the ground.
1260// }
1261
1262 if (options.ContainsKey("teleport"))
1263 {
1264 bool enableTeleportDebugging;
1265 if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
1266 DebugTeleporting = enableTeleportDebugging;
1267 }
1268
1269 if (options.ContainsKey("updates"))
1270 {
1271 bool enableUpdateDebugging;
1272 if (bool.TryParse(options["updates"], out enableUpdateDebugging))
1273 {
1274 DebugUpdates = enableUpdateDebugging;
1275 GcNotify.Enabled = DebugUpdates;
1276 }
1277 }
1278 }
1279
1280 public int GetInaccurateNeighborCount() 1245 public int GetInaccurateNeighborCount()
1281 { 1246 {
1282 return m_neighbours.Count; 1247 return m_neighbours.Count;
@@ -1526,7 +1491,7 @@ namespace OpenSim.Region.Framework.Scenes
1526 } 1491 }
1527 1492
1528 tmpMS = Util.EnvironmentTickCount(); 1493 tmpMS = Util.EnvironmentTickCount();
1529 if ((Frame % m_update_physics == 0) && m_physics_enabled) 1494 if (PhysicsEnabled && Frame % m_update_physics == 0)
1530 m_sceneGraph.UpdatePreparePhysics(); 1495 m_sceneGraph.UpdatePreparePhysics();
1531 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); 1496 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
1532 1497
@@ -1541,7 +1506,7 @@ namespace OpenSim.Region.Framework.Scenes
1541 tmpMS = Util.EnvironmentTickCount(); 1506 tmpMS = Util.EnvironmentTickCount();
1542 if (Frame % m_update_physics == 0) 1507 if (Frame % m_update_physics == 0)
1543 { 1508 {
1544 if (m_physics_enabled) 1509 if (PhysicsEnabled)
1545 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); 1510 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
1546 1511
1547 if (SynchronizeScene != null) 1512 if (SynchronizeScene != null)