aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs183
1 files changed, 80 insertions, 103 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a5ef2b7..784fc91 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -70,12 +70,77 @@ 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
80 /// <summary>
81 /// If true then the scene is saved to persistent storage periodically, every m_update_backup frames and
82 /// if objects meet required conditions (m_dontPersistBefore and m_dontPersistAfter).
83 /// </summary>
84 /// <remarks>
85 /// Even if false, the scene will still be saved on clean shutdown.
86 /// FIXME: Currently, setting this to false will mean that objects are not periodically returned from parcels.
87 /// This needs to be fixed.
88 /// </remarks>
89 public bool PeriodicBackup { get; set; }
90
91 /// <summary>
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.
94 /// </summary>
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;
79 144
80 public SynchronizeSceneHandler SynchronizeScene; 145 public SynchronizeSceneHandler SynchronizeScene;
81 146
@@ -284,8 +349,6 @@ namespace OpenSim.Region.Framework.Scenes
284 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); 349 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
285 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); 350 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
286 351
287 private bool m_physics_enabled = true;
288 private bool m_scripts_enabled = true;
289 private string m_defaultScriptEngine; 352 private string m_defaultScriptEngine;
290 353
291 /// <summary> 354 /// <summary>
@@ -348,7 +411,6 @@ namespace OpenSim.Region.Framework.Scenes
348 411
349 private Timer m_mapGenerationTimer = new Timer(); 412 private Timer m_mapGenerationTimer = new Timer();
350 private bool m_generateMaptiles; 413 private bool m_generateMaptiles;
351 private bool m_useBackup = true;
352 414
353 #endregion Fields 415 #endregion Fields
354 416
@@ -614,11 +676,6 @@ namespace OpenSim.Region.Framework.Scenes
614 get { return m_authenticateHandler; } 676 get { return m_authenticateHandler; }
615 } 677 }
616 678
617 public bool UseBackup
618 {
619 get { return m_useBackup; }
620 }
621
622 // an instance to the physics plugin's Scene object. 679 // an instance to the physics plugin's Scene object.
623 public PhysicsScene PhysicsScene 680 public PhysicsScene PhysicsScene
624 { 681 {
@@ -773,9 +830,11 @@ namespace OpenSim.Region.Framework.Scenes
773 830
774 DumpAssetsToFile = dumpAssetsToFile; 831 DumpAssetsToFile = dumpAssetsToFile;
775 832
833 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
834 // better in the future.
776 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; 835 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
777 836
778 m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; 837 PhysicsEnabled = !RegionInfo.RegionSettings.DisablePhysics;
779 838
780 m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")"; 839 m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
781 840
@@ -792,8 +851,8 @@ namespace OpenSim.Region.Framework.Scenes
792 StartDisabled = startupConfig.GetBoolean("StartDisabled", false); 851 StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
793 852
794 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); 853 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
795 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); 854 UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
796 if (!m_useBackup) 855 if (!UseBackup)
797 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); 856 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
798 857
799 //Animation states 858 //Animation states
@@ -970,6 +1029,10 @@ namespace OpenSim.Region.Framework.Scenes
970 { 1029 {
971 PhysicalPrims = true; 1030 PhysicalPrims = true;
972 CollidablePrims = true; 1031 CollidablePrims = true;
1032 PhysicsEnabled = true;
1033
1034 PeriodicBackup = true;
1035 UseBackup = true;
973 1036
974 BordersLocked = true; 1037 BordersLocked = true;
975 Border northBorder = new Border(); 1038 Border northBorder = new Border();
@@ -1212,83 +1275,6 @@ namespace OpenSim.Region.Framework.Scenes
1212 } 1275 }
1213 } 1276 }
1214 1277
1215 public void SetSceneCoreDebug(Dictionary<string, string> options)
1216 {
1217 if (options.ContainsKey("active"))
1218 {
1219 bool active;
1220
1221 if (bool.TryParse(options["active"], out active))
1222 Active = active;
1223 }
1224
1225 if (options.ContainsKey("scripting"))
1226 {
1227 bool enableScripts = true;
1228 if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts)
1229 {
1230 if (!enableScripts)
1231 {
1232 m_log.Info("Stopping all Scripts in Scene");
1233
1234 EntityBase[] entities = Entities.GetEntities();
1235 foreach (EntityBase ent in entities)
1236 {
1237 if (ent is SceneObjectGroup)
1238 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
1239 }
1240 }
1241 else
1242 {
1243 m_log.Info("Starting all Scripts in Scene");
1244
1245 EntityBase[] entities = Entities.GetEntities();
1246 foreach (EntityBase ent in entities)
1247 {
1248 if (ent is SceneObjectGroup)
1249 {
1250 SceneObjectGroup sog = (SceneObjectGroup)ent;
1251 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
1252 sog.ResumeScripts();
1253 }
1254 }
1255 }
1256
1257 m_scripts_enabled = enableScripts;
1258 }
1259 }
1260
1261 if (options.ContainsKey("physics"))
1262 {
1263 bool enablePhysics;
1264 if (bool.TryParse(options["physics"], out enablePhysics))
1265 m_physics_enabled = enablePhysics;
1266 }
1267
1268// if (options.ContainsKey("collisions"))
1269// {
1270// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow
1271// // the avatar themselves to collide with the ground.
1272// }
1273
1274 if (options.ContainsKey("teleport"))
1275 {
1276 bool enableTeleportDebugging;
1277 if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
1278 DebugTeleporting = enableTeleportDebugging;
1279 }
1280
1281 if (options.ContainsKey("updates"))
1282 {
1283 bool enableUpdateDebugging;
1284 if (bool.TryParse(options["updates"], out enableUpdateDebugging))
1285 {
1286 DebugUpdates = enableUpdateDebugging;
1287 GcNotify.Enabled = DebugUpdates;
1288 }
1289 }
1290 }
1291
1292 public int GetInaccurateNeighborCount() 1278 public int GetInaccurateNeighborCount()
1293 { 1279 {
1294 return m_neighbours.Count; 1280 return m_neighbours.Count;
@@ -1337,16 +1323,7 @@ namespace OpenSim.Region.Framework.Scenes
1337 1323
1338 m_log.Debug("[SCENE]: Persisting changed objects"); 1324 m_log.Debug("[SCENE]: Persisting changed objects");
1339 1325
1340 EntityBase[] entities = GetEntities(); 1326 Backup(false);
1341 foreach (EntityBase entity in entities)
1342 {
1343 if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
1344 {
1345 ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false);
1346 }
1347 }
1348
1349 m_log.Debug("[SCENE]: Graph close");
1350 m_sceneGraph.Close(); 1327 m_sceneGraph.Close();
1351 1328
1352 if (!GridService.DeregisterRegion(RegionInfo.RegionID)) 1329 if (!GridService.DeregisterRegion(RegionInfo.RegionID))
@@ -1573,7 +1550,7 @@ namespace OpenSim.Region.Framework.Scenes
1573 } 1550 }
1574 1551
1575 tmpMS = Util.EnvironmentTickCount(); 1552 tmpMS = Util.EnvironmentTickCount();
1576 if ((Frame % m_update_physics == 0) && m_physics_enabled) 1553 if (PhysicsEnabled && Frame % m_update_physics == 0)
1577 m_sceneGraph.UpdatePreparePhysics(); 1554 m_sceneGraph.UpdatePreparePhysics();
1578 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); 1555 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
1579 1556
@@ -1588,7 +1565,7 @@ namespace OpenSim.Region.Framework.Scenes
1588 tmpMS = Util.EnvironmentTickCount(); 1565 tmpMS = Util.EnvironmentTickCount();
1589 if (Frame % m_update_physics == 0) 1566 if (Frame % m_update_physics == 0)
1590 { 1567 {
1591 if (m_physics_enabled) 1568 if (PhysicsEnabled)
1592 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); 1569 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
1593 1570
1594 if (SynchronizeScene != null) 1571 if (SynchronizeScene != null)
@@ -1630,7 +1607,7 @@ namespace OpenSim.Region.Framework.Scenes
1630 eventMS = Util.EnvironmentTickCountSubtract(tmpMS); 1607 eventMS = Util.EnvironmentTickCountSubtract(tmpMS);
1631 } 1608 }
1632 1609
1633 if (Frame % m_update_backup == 0) 1610 if (PeriodicBackup && Frame % m_update_backup == 0)
1634 { 1611 {
1635 tmpMS = Util.EnvironmentTickCount(); 1612 tmpMS = Util.EnvironmentTickCount();
1636 UpdateStorageBackup(); 1613 UpdateStorageBackup();