diff options
author | Justin Clark-Casey (justincc) | 2013-01-10 23:49:48 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-01-25 23:50:15 +0000 |
commit | 0ba0ac4669e6bc1061ab024d23c1c2db3059a871 (patch) | |
tree | d2b4b3768e1d233f91388bf20c46456291c6ef25 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | minor: Capitalize GroupsModule command category (diff) | |
download | opensim-SC_OLD-0ba0ac4669e6bc1061ab024d23c1c2db3059a871.zip opensim-SC_OLD-0ba0ac4669e6bc1061ab024d23c1c2db3059a871.tar.gz opensim-SC_OLD-0ba0ac4669e6bc1061ab024d23c1c2db3059a871.tar.bz2 opensim-SC_OLD-0ba0ac4669e6bc1061ab024d23c1c2db3059a871.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/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 153 |
1 files changed, 59 insertions, 94 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5c3521c..0c8aa6c 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; |
@@ -1535,7 +1500,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1535 | } | 1500 | } |
1536 | 1501 | ||
1537 | tmpMS = Util.EnvironmentTickCount(); | 1502 | tmpMS = Util.EnvironmentTickCount(); |
1538 | if ((Frame % m_update_physics == 0) && m_physics_enabled) | 1503 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1539 | m_sceneGraph.UpdatePreparePhysics(); | 1504 | m_sceneGraph.UpdatePreparePhysics(); |
1540 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); | 1505 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1541 | 1506 | ||
@@ -1550,7 +1515,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1550 | tmpMS = Util.EnvironmentTickCount(); | 1515 | tmpMS = Util.EnvironmentTickCount(); |
1551 | if (Frame % m_update_physics == 0) | 1516 | if (Frame % m_update_physics == 0) |
1552 | { | 1517 | { |
1553 | if (m_physics_enabled) | 1518 | if (PhysicsEnabled) |
1554 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); | 1519 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); |
1555 | 1520 | ||
1556 | if (SynchronizeScene != null) | 1521 | if (SynchronizeScene != null) |