aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs239
1 files changed, 113 insertions, 126 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 5d27d86..68c05f8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -619,7 +619,7 @@ namespace OpenSim.Region.Framework.Scenes
619 619
620 #endregion Region Settings 620 #endregion Region Settings
621 621
622 MainConsole.Instance.Commands.AddCommand("region", false, "reload estate", 622 MainConsole.Instance.Commands.AddCommand("Estates", false, "reload estate",
623 "reload estate", 623 "reload estate",
624 "Reload the estate data", HandleReloadEstate); 624 "Reload the estate data", HandleReloadEstate);
625 625
@@ -651,101 +651,104 @@ namespace OpenSim.Region.Framework.Scenes
651 651
652 #region Region Config 652 #region Region Config
653 653
654 // Region config overrides global config
655 //
654 try 656 try
655 { 657 {
656 // Region config overrides global config 658 if (m_config.Configs["Startup"] != null)
657 // 659 {
658 IConfig startupConfig = m_config.Configs["Startup"]; 660 IConfig startupConfig = m_config.Configs["Startup"];
659 661
660 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); 662 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
661 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); 663 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
662 if (!m_useBackup) 664 if (!m_useBackup)
663 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); 665 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
664 666
665 //Animation states 667 //Animation states
666 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 668 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
667 669
668 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 670 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
669 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 671 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
670 672
671 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); 673 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
672 if (RegionInfo.NonphysPrimMax > 0) 674 if (RegionInfo.NonphysPrimMax > 0)
673 { 675 {
674 m_maxNonphys = RegionInfo.NonphysPrimMax; 676 m_maxNonphys = RegionInfo.NonphysPrimMax;
675 } 677 }
676 678
677 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); 679 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
678 680
679 if (RegionInfo.PhysPrimMax > 0) 681 if (RegionInfo.PhysPrimMax > 0)
680 { 682 {
681 m_maxPhys = RegionInfo.PhysPrimMax; 683 m_maxPhys = RegionInfo.PhysPrimMax;
682 } 684 }
683 685
684 // Here, if clamping is requested in either global or 686 // Here, if clamping is requested in either global or
685 // local config, it will be used 687 // local config, it will be used
686 // 688 //
687 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); 689 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
688 if (RegionInfo.ClampPrimSize) 690 if (RegionInfo.ClampPrimSize)
689 { 691 {
690 m_clampPrimSize = true; 692 m_clampPrimSize = true;
691 } 693 }
692 694
693 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); 695 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
694 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); 696 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
695 m_dontPersistBefore = 697 m_dontPersistBefore =
696 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); 698 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
697 m_dontPersistBefore *= 10000000; 699 m_dontPersistBefore *= 10000000;
698 m_persistAfter = 700 m_persistAfter =
699 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); 701 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
700 m_persistAfter *= 10000000; 702 m_persistAfter *= 10000000;
701 703
702 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); 704 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
703 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); 705 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
704 706
705 IConfig packetConfig = m_config.Configs["PacketPool"]; 707 IConfig packetConfig = m_config.Configs["PacketPool"];
706 if (packetConfig != null) 708 if (packetConfig != null)
707 { 709 {
708 PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); 710 PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true);
709 PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); 711 PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true);
710 } 712 }
711 713
712 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); 714 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
713 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); 715 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
714 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); 716 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
715 717
716 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); 718 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
717 if (m_generateMaptiles) 719 if (m_generateMaptiles)
718 {
719 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
720 if (maptileRefresh != 0)
721 { 720 {
722 m_mapGenerationTimer.Interval = maptileRefresh * 1000; 721 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
723 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; 722 if (maptileRefresh != 0)
724 m_mapGenerationTimer.AutoReset = true; 723 {
725 m_mapGenerationTimer.Start(); 724 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
725 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
726 m_mapGenerationTimer.AutoReset = true;
727 m_mapGenerationTimer.Start();
728 }
726 } 729 }
727 } 730 else
728 else
729 {
730 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
731 UUID tileID;
732
733 if (UUID.TryParse(tile, out tileID))
734 { 731 {
735 RegionInfo.RegionSettings.TerrainImageID = tileID; 732 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
733 UUID tileID;
734
735 if (UUID.TryParse(tile, out tileID))
736 {
737 RegionInfo.RegionSettings.TerrainImageID = tileID;
738 }
736 } 739 }
737 }
738 740
739 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); 741 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
740 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); 742 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
741 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); 743 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
742 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); 744 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
743 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); 745 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
744 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); 746 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
745 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); 747 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
746 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); 748 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
747 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); 749 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
748 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); 750 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
751 }
749 } 752 }
750 catch (Exception e) 753 catch (Exception e)
751 { 754 {
@@ -756,37 +759,34 @@ namespace OpenSim.Region.Framework.Scenes
756 759
757 #region Interest Management 760 #region Interest Management
758 761
759 if (m_config != null) 762 IConfig interestConfig = m_config.Configs["InterestManagement"];
763 if (interestConfig != null)
760 { 764 {
761 IConfig interestConfig = m_config.Configs["InterestManagement"]; 765 string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
762 if (interestConfig != null)
763 {
764 string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
765
766 try
767 {
768 m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
769 }
770 catch (Exception)
771 {
772 m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
773 m_priorityScheme = UpdatePrioritizationSchemes.Time;
774 }
775 766
776 m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true); 767 try
777 m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0); 768 {
778 m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0); 769 m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
779 m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0);
780 } 770 }
771 catch (Exception)
772 {
773 m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
774 m_priorityScheme = UpdatePrioritizationSchemes.Time;
775 }
776
777 m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true);
778 m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0);
779 m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0);
780 m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0);
781 } 781 }
782 782
783 m_log.InfoFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme); 783 m_log.DebugFormat("[SCENE]: Using the {0} prioritization scheme", m_priorityScheme);
784 784
785 #endregion Interest Management 785 #endregion Interest Management
786 786
787 StatsReporter = new SimStatsReporter(this); 787 StatsReporter = new SimStatsReporter(this);
788 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 788 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
789 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 789 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
790 } 790 }
791 791
792 /// <summary> 792 /// <summary>
@@ -1102,6 +1102,8 @@ namespace OpenSim.Region.Framework.Scenes
1102 { 1102 {
1103 m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName); 1103 m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
1104 1104
1105 StatsReporter.Close();
1106
1105 m_restartTimer.Stop(); 1107 m_restartTimer.Stop();
1106 m_restartTimer.Close(); 1108 m_restartTimer.Close();
1107 1109
@@ -1181,7 +1183,7 @@ namespace OpenSim.Region.Framework.Scenes
1181 1183
1182 HeartbeatThread 1184 HeartbeatThread
1183 = Watchdog.StartThread( 1185 = Watchdog.StartThread(
1184 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false); 1186 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
1185 } 1187 }
1186 1188
1187 /// <summary> 1189 /// <summary>
@@ -1219,6 +1221,13 @@ namespace OpenSim.Region.Framework.Scenes
1219 try 1221 try
1220 { 1222 {
1221 m_eventManager.TriggerOnRegionStarted(this); 1223 m_eventManager.TriggerOnRegionStarted(this);
1224
1225 // The first frame can take a very long time due to physics actors being added on startup. Therefore,
1226 // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
1227 // alarms for scenes with many objects.
1228 Update();
1229 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1230
1222 while (!shuttingdown) 1231 while (!shuttingdown)
1223 Update(); 1232 Update();
1224 } 1233 }
@@ -1244,7 +1253,7 @@ namespace OpenSim.Region.Framework.Scenes
1244 1253
1245 ++Frame; 1254 ++Frame;
1246 1255
1247// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); 1256// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1248 1257
1249 try 1258 try
1250 { 1259 {
@@ -1406,26 +1415,10 @@ namespace OpenSim.Region.Framework.Scenes
1406 { 1415 {
1407 throw; 1416 throw;
1408 } 1417 }
1409 catch (AccessViolationException e)
1410 {
1411 m_log.ErrorFormat(
1412 "[REGION]: Failed on region {0} with exception {1}{2}",
1413 RegionInfo.RegionName, e.Message, e.StackTrace);
1414 }
1415 //catch (NullReferenceException e)
1416 //{
1417 // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1418 //}
1419 catch (InvalidOperationException e)
1420 {
1421 m_log.ErrorFormat(
1422 "[REGION]: Failed on region {0} with exception {1}{2}",
1423 RegionInfo.RegionName, e.Message, e.StackTrace);
1424 }
1425 catch (Exception e) 1418 catch (Exception e)
1426 { 1419 {
1427 m_log.ErrorFormat( 1420 m_log.ErrorFormat(
1428 "[REGION]: Failed on region {0} with exception {1}{2}", 1421 "[SCENE]: Failed on region {0} with exception {1}{2}",
1429 RegionInfo.RegionName, e.Message, e.StackTrace); 1422 RegionInfo.RegionName, e.Message, e.StackTrace);
1430 } 1423 }
1431 1424
@@ -1467,7 +1460,6 @@ namespace OpenSim.Region.Framework.Scenes
1467 entry.checkAtTargets(); 1460 entry.checkAtTargets();
1468 } 1461 }
1469 1462
1470
1471 /// <summary> 1463 /// <summary>
1472 /// Send out simstats data to all clients 1464 /// Send out simstats data to all clients
1473 /// </summary> 1465 /// </summary>
@@ -4342,16 +4334,11 @@ namespace OpenSim.Region.Framework.Scenes
4342 public bool PipeEventsForScript(uint localID) 4334 public bool PipeEventsForScript(uint localID)
4343 { 4335 {
4344 SceneObjectPart part = GetSceneObjectPart(localID); 4336 SceneObjectPart part = GetSceneObjectPart(localID);
4337
4345 if (part != null) 4338 if (part != null)
4346 { 4339 {
4347 // Changed so that child prims of attachments return ScriptDanger for their parent, so that
4348 // their scripts will actually run.
4349 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008
4350 SceneObjectPart parent = part.ParentGroup.RootPart; 4340 SceneObjectPart parent = part.ParentGroup.RootPart;
4351 if (part.ParentGroup.IsAttachment) 4341 return ScriptDanger(parent, parent.GetWorldPosition());
4352 return ScriptDanger(parent, parent.GetWorldPosition());
4353 else
4354 return ScriptDanger(part, part.GetWorldPosition());
4355 } 4342 }
4356 else 4343 else
4357 { 4344 {