aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2013-01-11 02:13:10 +0000
committerMelanie2013-01-11 02:13:10 +0000
commitf74915ed4f8831344ee588d9036b7ac866ea4294 (patch)
tree5f1021165cf4acc9043b3015c2aac468128fa1dc /OpenSim/Region/Framework
parentMerge branch 'master' into careminster (diff)
parentFix a regression in the last few scene commands changes where setting these v... (diff)
downloadopensim-SC_OLD-f74915ed4f8831344ee588d9036b7ac866ea4294.zip
opensim-SC_OLD-f74915ed4f8831344ee588d9036b7ac866ea4294.tar.gz
opensim-SC_OLD-f74915ed4f8831344ee588d9036b7ac866ea4294.tar.bz2
opensim-SC_OLD-f74915ed4f8831344ee588d9036b7ac866ea4294.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISceneCommandsModule.cs43
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs183
2 files changed, 123 insertions, 103 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 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();