diff options
author | Justin Clark-Casey (justincc) | 2014-07-29 01:21:15 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-07-29 01:21:15 +0100 |
commit | 3654ae8d8cea0bf0455974efe18ff99e484d2893 (patch) | |
tree | 4daebd94efd967de9d64f69ace7d057f514635e6 /OpenSim/Region/Framework/Scenes | |
parent | minor: make "debug scene set" usage command accurate again from last commit f... (diff) | |
download | opensim-SC_OLD-3654ae8d8cea0bf0455974efe18ff99e484d2893.zip opensim-SC_OLD-3654ae8d8cea0bf0455974efe18ff99e484d2893.tar.gz opensim-SC_OLD-3654ae8d8cea0bf0455974efe18ff99e484d2893.tar.bz2 opensim-SC_OLD-3654ae8d8cea0bf0455974efe18ff99e484d2893.tar.xz |
Allow the "debug scene set physics false|true" command to work when bulletsim physics is running in a separate thread.
This will also allow the "disable physics" setting in the region debug viewer dialog to work in this circumstance.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 63 |
1 files changed, 43 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f87ae47..1639ee4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -103,7 +103,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | /// <summary> | 103 | /// <summary> |
104 | /// If false then physical objects are disabled, though collisions will continue as normal. | 104 | /// If false then physical objects are disabled, though collisions will continue as normal. |
105 | /// </summary> | 105 | /// </summary> |
106 | public bool PhysicsEnabled { get; set; } | 106 | public bool PhysicsEnabled |
107 | { | ||
108 | get | ||
109 | { | ||
110 | return m_physicsEnabled; | ||
111 | } | ||
112 | |||
113 | set | ||
114 | { | ||
115 | m_physicsEnabled = value; | ||
116 | |||
117 | if (PhysicsScene != null) | ||
118 | { | ||
119 | IPhysicsParameters physScene = PhysicsScene as IPhysicsParameters; | ||
120 | |||
121 | if (physScene != null) | ||
122 | physScene.SetPhysicsParameter( | ||
123 | "Active", m_physicsEnabled.ToString(), PhysParameterEntry.APPLY_TO_NONE); | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | |||
128 | private bool m_physicsEnabled; | ||
107 | 129 | ||
108 | /// <summary> | 130 | /// <summary> |
109 | /// If false then scripts are not enabled on the smiulator | 131 | /// If false then scripts are not enabled on the smiulator |
@@ -712,11 +734,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
712 | 734 | ||
713 | #region Constructors | 735 | #region Constructors |
714 | 736 | ||
715 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, | 737 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, |
716 | SceneCommunicationService sceneGridService, | 738 | SceneCommunicationService sceneGridService, |
717 | ISimulationDataService simDataService, IEstateDataService estateDataService, | 739 | ISimulationDataService simDataService, IEstateDataService estateDataService, |
718 | IConfigSource config, string simulatorVersion) | 740 | IConfigSource config, string simulatorVersion) |
719 | : this(regInfo) | 741 | : this(regInfo, physicsScene) |
720 | { | 742 | { |
721 | m_config = config; | 743 | m_config = config; |
722 | MinFrameTime = 0.089f; | 744 | MinFrameTime = 0.089f; |
@@ -789,21 +811,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
789 | EventManager.OnLandObjectRemoved += | 811 | EventManager.OnLandObjectRemoved += |
790 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); | 812 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); |
791 | 813 | ||
792 | m_sceneGraph = new SceneGraph(this); | ||
793 | |||
794 | // If the scene graph has an Unrecoverable error, restart this sim. | ||
795 | // Currently the only thing that causes it to happen is two kinds of specific | ||
796 | // Physics based crashes. | ||
797 | // | ||
798 | // Out of memory | ||
799 | // Operating system has killed the plugin | ||
800 | m_sceneGraph.UnRecoverableError | ||
801 | += () => | ||
802 | { | ||
803 | m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); | ||
804 | RestartNow(); | ||
805 | }; | ||
806 | |||
807 | RegisterDefaultSceneEvents(); | 814 | RegisterDefaultSceneEvents(); |
808 | 815 | ||
809 | // XXX: Don't set the public property since we don't want to activate here. This needs to be handled | 816 | // XXX: Don't set the public property since we don't want to activate here. This needs to be handled |
@@ -1014,8 +1021,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1014 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1021 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1015 | } | 1022 | } |
1016 | 1023 | ||
1017 | public Scene(RegionInfo regInfo) : base(regInfo) | 1024 | public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo) |
1018 | { | 1025 | { |
1026 | m_sceneGraph = new SceneGraph(this); | ||
1027 | m_sceneGraph.PhysicsScene = physicsScene; | ||
1028 | |||
1029 | // If the scene graph has an Unrecoverable error, restart this sim. | ||
1030 | // Currently the only thing that causes it to happen is two kinds of specific | ||
1031 | // Physics based crashes. | ||
1032 | // | ||
1033 | // Out of memory | ||
1034 | // Operating system has killed the plugin | ||
1035 | m_sceneGraph.UnRecoverableError | ||
1036 | += () => | ||
1037 | { | ||
1038 | m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); | ||
1039 | RestartNow(); | ||
1040 | }; | ||
1041 | |||
1019 | PhysicalPrims = true; | 1042 | PhysicalPrims = true; |
1020 | CollidablePrims = true; | 1043 | CollidablePrims = true; |
1021 | PhysicsEnabled = true; | 1044 | PhysicsEnabled = true; |