diff options
Merge branch 'master' into careminster-presence-refactor
The modules will need to be updated for this to compile and run again. Please
don't use until I do the companion commit to modules later on.
Diffstat (limited to 'OpenSim/Region/Framework')
29 files changed, 702 insertions, 804 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 59c035f..6a0fb63 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
56 | /// <param name="rot"></param> | 56 | /// <param name="rot"></param> |
57 | /// <param name="attachPos"></param> | 57 | /// <param name="attachPos"></param> |
58 | /// <param name="silent"></param> | 58 | /// <param name="silent"></param> |
59 | /// <returns>true if the object was successfully attached, false otherwise</returns> | 59 | /// <returns>true if the object was successfully attached, false otherwise</returns> |
60 | bool AttachObject( | 60 | bool AttachObject( |
61 | IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent); | 61 | IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent); |
62 | 62 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index f5cd528..6289f7a 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -202,7 +202,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
202 | /// Backup the inventory to the given data store | 202 | /// Backup the inventory to the given data store |
203 | /// </summary> | 203 | /// </summary> |
204 | /// <param name="datastore"></param> | 204 | /// <param name="datastore"></param> |
205 | void ProcessInventoryBackup(IRegionDataStore datastore); | 205 | void ProcessInventoryBackup(ISimulationDataService datastore); |
206 | 206 | ||
207 | uint MaskEffectivePermissions(); | 207 | uint MaskEffectivePermissions(); |
208 | 208 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs new file mode 100644 index 0000000..95c9659 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs | |||
@@ -0,0 +1,45 @@ | |||
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 OpenSimulator 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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenMetaverse; | ||
32 | |||
33 | namespace OpenSim.Region.Framework.Interfaces | ||
34 | { | ||
35 | public interface IEstateDataService | ||
36 | { | ||
37 | EstateSettings LoadEstateSettings(UUID regionID, bool create); | ||
38 | EstateSettings LoadEstateSettings(int estateID); | ||
39 | void StoreEstateSettings(EstateSettings es); | ||
40 | List<int> GetEstates(string search); | ||
41 | bool LinkRegion(UUID regionID, int estateID); | ||
42 | List<UUID> GetRegions(int estateID); | ||
43 | bool DeleteEstate(int estateID); | ||
44 | } | ||
45 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs index 2c091e7..4c501f6 100644 --- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
65 | /// Get a group | 65 | /// Get a group |
66 | /// </summary> | 66 | /// </summary> |
67 | /// <param name="GroupID">ID of the group</param> | 67 | /// <param name="GroupID">ID of the group</param> |
68 | /// <returns>The group's data. Null if there is no such group.</returns> | 68 | /// <returns>The group's data. Null if there is no such group.</returns> |
69 | GroupRecord GetGroupRecord(UUID GroupID); | 69 | GroupRecord GetGroupRecord(UUID GroupID); |
70 | 70 | ||
71 | void ActivateGroup(IClientAPI remoteClient, UUID groupID); | 71 | void ActivateGroup(IClientAPI remoteClient, UUID groupID); |
@@ -74,14 +74,14 @@ namespace OpenSim.Region.Framework.Interfaces | |||
74 | List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID); | 74 | List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID); |
75 | List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID); | 75 | List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID); |
76 | GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID); | 76 | GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID); |
77 | GroupMembershipData[] GetMembershipData(UUID UserID); | 77 | GroupMembershipData[] GetMembershipData(UUID UserID); |
78 | GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID); | 78 | GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID); |
79 | 79 | ||
80 | void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); | 80 | void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); |
81 | 81 | ||
82 | void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile); | 82 | void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile); |
83 | 83 | ||
84 | void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); | 84 | void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); |
85 | 85 | ||
86 | GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID); | 86 | GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID); |
87 | string GetGroupTitle(UUID avatarID); | 87 | string GetGroupTitle(UUID avatarID); |
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs index 01066e6..ddf7565 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs | |||
@@ -43,14 +43,14 @@ namespace OpenSim.Region.Framework.Interfaces | |||
43 | /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> | 43 | /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> |
44 | public delegate void InventoryArchiveSaved( | 44 | public delegate void InventoryArchiveSaved( |
45 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); | 45 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); |
46 | 46 | ||
47 | public interface IInventoryArchiverModule | 47 | public interface IInventoryArchiverModule |
48 | { | 48 | { |
49 | /// <summary> | 49 | /// <summary> |
50 | /// Fired when an archive inventory save has been completed. | 50 | /// Fired when an archive inventory save has been completed. |
51 | /// </summary> | 51 | /// </summary> |
52 | event InventoryArchiveSaved OnInventoryArchiveSaved; | 52 | event InventoryArchiveSaved OnInventoryArchiveSaved; |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// Dearchive a user's inventory folder from the given stream | 55 | /// Dearchive a user's inventory folder from the given stream |
56 | /// </summary> | 56 | /// </summary> |
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
60 | /// <param name="loadStream">The stream from which the inventory archive will be loaded</param> | 60 | /// <param name="loadStream">The stream from which the inventory archive will be loaded</param> |
61 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> | 61 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> |
62 | bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream); | 62 | bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream); |
63 | 63 | ||
64 | /// <summary> | 64 | /// <summary> |
65 | /// Dearchive a user's inventory folder from the given stream | 65 | /// Dearchive a user's inventory folder from the given stream |
66 | /// </summary> | 66 | /// </summary> |
@@ -72,8 +72,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
72 | /// the loaded IAR with existing folders where possible.</param> | 72 | /// the loaded IAR with existing folders where possible.</param> |
73 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> | 73 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> |
74 | bool DearchiveInventory( | 74 | bool DearchiveInventory( |
75 | string firstName, string lastName, string invPath, string pass, Stream loadStream, | 75 | string firstName, string lastName, string invPath, string pass, Stream loadStream, |
76 | Dictionary<string, object> options); | 76 | Dictionary<string, object> options); |
77 | 77 | ||
78 | /// <summary> | 78 | /// <summary> |
79 | /// Archive a user's inventory folder to the given stream | 79 | /// Archive a user's inventory folder to the given stream |
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
85 | /// <param name="saveStream">The stream to which the inventory archive will be saved</param> | 85 | /// <param name="saveStream">The stream to which the inventory archive will be saved</param> |
86 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> | 86 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> |
87 | bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream); | 87 | bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream); |
88 | 88 | ||
89 | /// <summary> | 89 | /// <summary> |
90 | /// Archive a user's inventory folder to the given stream | 90 | /// Archive a user's inventory folder to the given stream |
91 | /// </summary> | 91 | /// </summary> |
@@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
97 | /// <param name="options">Archiving options. Currently, there are none.</param> | 97 | /// <param name="options">Archiving options. Currently, there are none.</param> |
98 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> | 98 | /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> |
99 | bool ArchiveInventory( | 99 | bool ArchiveInventory( |
100 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, | 100 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, |
101 | Dictionary<string, object> options); | 101 | Dictionary<string, object> options); |
102 | } | 102 | } |
103 | } | 103 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IMoapModule.cs b/OpenSim/Region/Framework/Interfaces/IMoapModule.cs index 24b6860..1d3d240 100644 --- a/OpenSim/Region/Framework/Interfaces/IMoapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IMoapModule.cs | |||
@@ -63,5 +63,5 @@ namespace OpenSim.Region.Framework.Interfaces | |||
63 | /// <param name="part"></param> | 63 | /// <param name="part"></param> |
64 | /// <param name="face">/param> | 64 | /// <param name="face">/param> |
65 | void ClearMediaEntry(SceneObjectPart part, int face); | 65 | void ClearMediaEntry(SceneObjectPart part, int face); |
66 | } | 66 | } |
67 | } \ No newline at end of file | 67 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs index e7562a5..18758c8 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs | |||
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
90 | /// </summary> | 90 | /// </summary> |
91 | /// <param name="entityList"></param> | 91 | /// <param name="entityList"></param> |
92 | /// <param name="fileName"></param> | 92 | /// <param name="fileName"></param> |
93 | void SavePrimListToXml2(List<EntityBase> entityList, string fileName); | 93 | void SavePrimListToXml2(EntityBase[] entityList, string fileName); |
94 | 94 | ||
95 | /// <summary> | 95 | /// <summary> |
96 | /// Save a set of prims in the xml2 format, optionally specifying a bounding box for which | 96 | /// Save a set of prims in the xml2 format, optionally specifying a bounding box for which |
@@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
101 | /// <param name="stream"></param> | 101 | /// <param name="stream"></param> |
102 | /// <param name="min"></param> | 102 | /// <param name="min"></param> |
103 | /// <param name="max"></param> | 103 | /// <param name="max"></param> |
104 | void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max); | 104 | void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max); |
105 | 105 | ||
106 | void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName); | 106 | void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName); |
107 | 107 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs new file mode 100644 index 0000000..edaa07c --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs | |||
@@ -0,0 +1,98 @@ | |||
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 OpenSimulator 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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | |||
34 | namespace OpenSim.Region.Framework.Interfaces | ||
35 | { | ||
36 | public interface ISimulationDataService | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// Stores all object's details apart from inventory | ||
40 | /// </summary> | ||
41 | /// <param name="obj"></param> | ||
42 | /// <param name="regionUUID"></param> | ||
43 | void StoreObject(SceneObjectGroup obj, UUID regionUUID); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Entirely removes the object, including inventory | ||
47 | /// </summary> | ||
48 | /// <param name="uuid"></param> | ||
49 | /// <param name="regionUUID"></param> | ||
50 | /// <returns></returns> | ||
51 | void RemoveObject(UUID uuid, UUID regionUUID); | ||
52 | |||
53 | /// <summary> | ||
54 | /// Store a prim's inventory | ||
55 | /// </summary> | ||
56 | /// <returns></returns> | ||
57 | void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items); | ||
58 | |||
59 | /// <summary> | ||
60 | /// Load persisted objects from region storage. | ||
61 | /// </summary> | ||
62 | /// <param name="regionUUID">the Region UUID</param> | ||
63 | /// <returns>List of loaded groups</returns> | ||
64 | List<SceneObjectGroup> LoadObjects(UUID regionUUID); | ||
65 | |||
66 | /// <summary> | ||
67 | /// Store a terrain revision in region storage | ||
68 | /// </summary> | ||
69 | /// <param name="ter">HeightField data</param> | ||
70 | /// <param name="regionID">region UUID</param> | ||
71 | void StoreTerrain(double[,] terrain, UUID regionID); | ||
72 | |||
73 | /// <summary> | ||
74 | /// Load the latest terrain revision from region storage | ||
75 | /// </summary> | ||
76 | /// <param name="regionID">the region UUID</param> | ||
77 | /// <returns>Heightfield data</returns> | ||
78 | double[,] LoadTerrain(UUID regionID); | ||
79 | |||
80 | void StoreLandObject(ILandObject Parcel); | ||
81 | |||
82 | /// <summary> | ||
83 | /// <list type="bullet"> | ||
84 | /// <item>delete from land where UUID=globalID</item> | ||
85 | /// <item>delete from landaccesslist where LandUUID=globalID</item> | ||
86 | /// </list> | ||
87 | /// </summary> | ||
88 | /// <param name="globalID"></param> | ||
89 | void RemoveLandObject(UUID globalID); | ||
90 | |||
91 | List<LandData> LoadLandObjects(UUID regionUUID); | ||
92 | |||
93 | void StoreRegionSettings(RegionSettings rs); | ||
94 | RegionSettings LoadRegionSettings(UUID regionUUID); | ||
95 | RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); | ||
96 | void StoreRegionWindlightSettings(RegionLightShareData wl); | ||
97 | } | ||
98 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs index 3e8e196..0a4d531 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs | |||
@@ -32,7 +32,7 @@ using OpenSim.Region.Framework.Scenes; | |||
32 | 32 | ||
33 | namespace OpenSim.Region.Framework.Interfaces | 33 | namespace OpenSim.Region.Framework.Interfaces |
34 | { | 34 | { |
35 | public interface IRegionDataStore | 35 | public interface ISimulationDataStore |
36 | { | 36 | { |
37 | /// <summary> | 37 | /// <summary> |
38 | /// Initialises the data storage engine | 38 | /// Initialises the data storage engine |
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs index d6e31f4..65c57a6 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs | |||
@@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
31 | { | 31 | { |
32 | /// <summary> | 32 | /// <summary> |
33 | /// Generate a map tile for the scene. a terrain texture for this scene | 33 | /// Generate a map tile for the scene. a terrain texture for this scene |
34 | /// </summary> | 34 | /// </summary> |
35 | void GenerateMaptile(); | 35 | void GenerateMaptile(); |
36 | } | 36 | } |
37 | } | 37 | } |
diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs index c246e32..0defa93 100644 --- a/OpenSim/Region/Framework/Scenes/EntityManager.cs +++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs | |||
@@ -34,227 +34,89 @@ using OpenMetaverse; | |||
34 | 34 | ||
35 | namespace OpenSim.Region.Framework.Scenes | 35 | namespace OpenSim.Region.Framework.Scenes |
36 | { | 36 | { |
37 | public class EntityManager : IEnumerable<EntityBase> | 37 | public class EntityManager |
38 | { | 38 | { |
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
40 | private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>(); | 40 | private readonly DoubleDictionary<UUID, uint, EntityBase> m_entities = new DoubleDictionary<UUID, uint, EntityBase>(); |
41 | private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>(); | ||
42 | //private readonly Dictionary<UUID, ScenePresence> m_pres_uuid = new Dictionary<UUID, ScenePresence>(); | ||
43 | private System.Threading.ReaderWriterLockSlim m_lock = new System.Threading.ReaderWriterLockSlim(); | ||
44 | 41 | ||
45 | [Obsolete("Use Add() instead.")] | 42 | public int Count |
46 | public void Add(UUID id, EntityBase eb) | ||
47 | { | 43 | { |
48 | Add(eb); | 44 | get { return m_entities.Count; } |
49 | } | 45 | } |
50 | 46 | ||
51 | public void Add(EntityBase entity) | 47 | public void Add(EntityBase entity) |
52 | { | 48 | { |
53 | m_lock.EnterWriteLock(); | 49 | m_entities.Add(entity.UUID, entity.LocalId, entity); |
54 | try | ||
55 | { | ||
56 | try | ||
57 | { | ||
58 | m_eb_uuid.Add(entity.UUID, entity); | ||
59 | m_eb_localID.Add(entity.LocalId, entity); | ||
60 | } | ||
61 | catch(Exception e) | ||
62 | { | ||
63 | m_log.ErrorFormat("Add Entity failed: {0}", e.Message); | ||
64 | } | ||
65 | } | ||
66 | finally | ||
67 | { | ||
68 | m_lock.ExitWriteLock(); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | public void InsertOrReplace(EntityBase entity) | ||
73 | { | ||
74 | m_lock.EnterWriteLock(); | ||
75 | try | ||
76 | { | ||
77 | try | ||
78 | { | ||
79 | m_eb_uuid[entity.UUID] = entity; | ||
80 | m_eb_localID[entity.LocalId] = entity; | ||
81 | } | ||
82 | catch(Exception e) | ||
83 | { | ||
84 | m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message); | ||
85 | } | ||
86 | } | ||
87 | finally | ||
88 | { | ||
89 | m_lock.ExitWriteLock(); | ||
90 | } | ||
91 | } | 50 | } |
92 | 51 | ||
93 | public void Clear() | 52 | public void Clear() |
94 | { | 53 | { |
95 | m_lock.EnterWriteLock(); | 54 | m_entities.Clear(); |
96 | try | ||
97 | { | ||
98 | m_eb_uuid.Clear(); | ||
99 | m_eb_localID.Clear(); | ||
100 | } | ||
101 | finally | ||
102 | { | ||
103 | m_lock.ExitWriteLock(); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | public int Count | ||
108 | { | ||
109 | get | ||
110 | { | ||
111 | return m_eb_uuid.Count; | ||
112 | } | ||
113 | } | 55 | } |
114 | 56 | ||
115 | public bool ContainsKey(UUID id) | 57 | public bool ContainsKey(UUID id) |
116 | { | 58 | { |
117 | try | 59 | return m_entities.ContainsKey(id); |
118 | { | ||
119 | return m_eb_uuid.ContainsKey(id); | ||
120 | } | ||
121 | catch | ||
122 | { | ||
123 | return false; | ||
124 | } | ||
125 | } | 60 | } |
126 | 61 | ||
127 | public bool ContainsKey(uint localID) | 62 | public bool ContainsKey(uint localID) |
128 | { | 63 | { |
129 | try | 64 | return m_entities.ContainsKey(localID); |
130 | { | ||
131 | return m_eb_localID.ContainsKey(localID); | ||
132 | } | ||
133 | catch | ||
134 | { | ||
135 | return false; | ||
136 | } | ||
137 | } | 65 | } |
138 | 66 | ||
139 | public bool Remove(uint localID) | 67 | public bool Remove(uint localID) |
140 | { | 68 | { |
141 | m_lock.EnterWriteLock(); | 69 | return m_entities.Remove(localID); |
142 | try | ||
143 | { | ||
144 | try | ||
145 | { | ||
146 | bool a = false; | ||
147 | EntityBase entity; | ||
148 | if (m_eb_localID.TryGetValue(localID, out entity)) | ||
149 | a = m_eb_uuid.Remove(entity.UUID); | ||
150 | |||
151 | bool b = m_eb_localID.Remove(localID); | ||
152 | return a && b; | ||
153 | } | ||
154 | catch (Exception e) | ||
155 | { | ||
156 | m_log.ErrorFormat("Remove Entity failed for {0}", localID, e); | ||
157 | return false; | ||
158 | } | ||
159 | } | ||
160 | finally | ||
161 | { | ||
162 | m_lock.ExitWriteLock(); | ||
163 | } | ||
164 | } | 70 | } |
165 | 71 | ||
166 | public bool Remove(UUID id) | 72 | public bool Remove(UUID id) |
167 | { | 73 | { |
168 | m_lock.EnterWriteLock(); | 74 | return m_entities.Remove(id); |
169 | try | ||
170 | { | ||
171 | try | ||
172 | { | ||
173 | bool a = false; | ||
174 | EntityBase entity; | ||
175 | if (m_eb_uuid.TryGetValue(id, out entity)) | ||
176 | a = m_eb_localID.Remove(entity.LocalId); | ||
177 | |||
178 | bool b = m_eb_uuid.Remove(id); | ||
179 | return a && b; | ||
180 | } | ||
181 | catch (Exception e) | ||
182 | { | ||
183 | m_log.ErrorFormat("Remove Entity failed for {0}", id, e); | ||
184 | return false; | ||
185 | } | ||
186 | } | ||
187 | finally | ||
188 | { | ||
189 | m_lock.ExitWriteLock(); | ||
190 | } | ||
191 | } | 75 | } |
192 | 76 | ||
193 | public List<EntityBase> GetAllByType<T>() | 77 | public EntityBase[] GetAllByType<T>() |
194 | { | 78 | { |
195 | List<EntityBase> tmp = new List<EntityBase>(); | 79 | List<EntityBase> tmp = new List<EntityBase>(); |
196 | 80 | ||
197 | m_lock.EnterReadLock(); | 81 | m_entities.ForEach( |
198 | try | 82 | delegate(EntityBase entity) |
199 | { | ||
200 | try | ||
201 | { | ||
202 | foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid) | ||
203 | { | ||
204 | if (pair.Value is T) | ||
205 | { | ||
206 | tmp.Add(pair.Value); | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | catch (Exception e) | ||
211 | { | 83 | { |
212 | m_log.ErrorFormat("GetAllByType failed for {0}", e); | 84 | if (entity is T) |
213 | tmp = null; | 85 | tmp.Add(entity); |
214 | } | 86 | } |
215 | } | 87 | ); |
216 | finally | ||
217 | { | ||
218 | m_lock.ExitReadLock(); | ||
219 | } | ||
220 | 88 | ||
221 | return tmp; | 89 | return tmp.ToArray(); |
222 | } | 90 | } |
223 | 91 | ||
224 | public List<EntityBase> GetEntities() | 92 | public EntityBase[] GetEntities() |
225 | { | 93 | { |
226 | m_lock.EnterReadLock(); | 94 | List<EntityBase> tmp = new List<EntityBase>(m_entities.Count); |
227 | try | 95 | m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); }); |
228 | { | 96 | return tmp.ToArray(); |
229 | return new List<EntityBase>(m_eb_uuid.Values); | 97 | } |
230 | } | 98 | |
231 | finally | 99 | public void ForEach(Action<EntityBase> action) |
232 | { | 100 | { |
233 | m_lock.ExitReadLock(); | 101 | m_entities.ForEach(action); |
234 | } | 102 | } |
103 | |||
104 | public EntityBase Find(Predicate<EntityBase> predicate) | ||
105 | { | ||
106 | return m_entities.FindValue(predicate); | ||
235 | } | 107 | } |
236 | 108 | ||
237 | public EntityBase this[UUID id] | 109 | public EntityBase this[UUID id] |
238 | { | 110 | { |
239 | get | 111 | get |
240 | { | 112 | { |
241 | m_lock.EnterReadLock(); | 113 | EntityBase entity; |
242 | try | 114 | m_entities.TryGetValue(id, out entity); |
243 | { | 115 | return entity; |
244 | EntityBase entity; | ||
245 | if (m_eb_uuid.TryGetValue(id, out entity)) | ||
246 | return entity; | ||
247 | else | ||
248 | return null; | ||
249 | } | ||
250 | finally | ||
251 | { | ||
252 | m_lock.ExitReadLock(); | ||
253 | } | ||
254 | } | 116 | } |
255 | set | 117 | set |
256 | { | 118 | { |
257 | InsertOrReplace(value); | 119 | Add(value); |
258 | } | 120 | } |
259 | } | 121 | } |
260 | 122 | ||
@@ -262,65 +124,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
262 | { | 124 | { |
263 | get | 125 | get |
264 | { | 126 | { |
265 | m_lock.EnterReadLock(); | 127 | EntityBase entity; |
266 | try | 128 | m_entities.TryGetValue(localID, out entity); |
267 | { | 129 | return entity; |
268 | EntityBase entity; | ||
269 | if (m_eb_localID.TryGetValue(localID, out entity)) | ||
270 | return entity; | ||
271 | else | ||
272 | return null; | ||
273 | } | ||
274 | finally | ||
275 | { | ||
276 | m_lock.ExitReadLock(); | ||
277 | } | ||
278 | } | 130 | } |
279 | set | 131 | set |
280 | { | 132 | { |
281 | InsertOrReplace(value); | 133 | Add(value); |
282 | } | 134 | } |
283 | } | 135 | } |
284 | 136 | ||
285 | public bool TryGetValue(UUID key, out EntityBase obj) | 137 | public bool TryGetValue(UUID key, out EntityBase obj) |
286 | { | 138 | { |
287 | m_lock.EnterReadLock(); | 139 | return m_entities.TryGetValue(key, out obj); |
288 | try | ||
289 | { | ||
290 | return m_eb_uuid.TryGetValue(key, out obj); | ||
291 | } | ||
292 | finally | ||
293 | { | ||
294 | m_lock.ExitReadLock(); | ||
295 | } | ||
296 | } | 140 | } |
297 | 141 | ||
298 | public bool TryGetValue(uint key, out EntityBase obj) | 142 | public bool TryGetValue(uint key, out EntityBase obj) |
299 | { | 143 | { |
300 | m_lock.EnterReadLock(); | 144 | return m_entities.TryGetValue(key, out obj); |
301 | try | ||
302 | { | ||
303 | return m_eb_localID.TryGetValue(key, out obj); | ||
304 | } | ||
305 | finally | ||
306 | { | ||
307 | m_lock.ExitReadLock(); | ||
308 | } | ||
309 | } | ||
310 | |||
311 | /// <summary> | ||
312 | /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. | ||
313 | /// </summary> | ||
314 | /// <returns></returns> | ||
315 | public IEnumerator<EntityBase> GetEnumerator() | ||
316 | { | ||
317 | return GetEntities().GetEnumerator(); | ||
318 | } | ||
319 | |||
320 | IEnumerator IEnumerable.GetEnumerator() | ||
321 | { | ||
322 | return GetEnumerator(); | ||
323 | } | 145 | } |
324 | |||
325 | } | 146 | } |
326 | } | 147 | } |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 3fae5e6..e923932 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | 61 | ||
62 | public event OnTerrainUpdateDelegate OnTerrainUpdate; | 62 | public event OnTerrainUpdateDelegate OnTerrainUpdate; |
63 | 63 | ||
64 | public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup); | 64 | public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup); |
65 | 65 | ||
66 | public event OnBackupDelegate OnBackup; | 66 | public event OnBackupDelegate OnBackup; |
67 | 67 | ||
@@ -336,7 +336,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
336 | /// If the object is being attached, then the avatarID will be present. If the object is being detached then | 336 | /// If the object is being attached, then the avatarID will be present. If the object is being detached then |
337 | /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). | 337 | /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). |
338 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); | 338 | public delegate void Attach(uint localID, UUID itemID, UUID avatarID); |
339 | public event Attach OnAttach; | 339 | public event Attach OnAttach; |
340 | 340 | ||
341 | /// <summary> | 341 | /// <summary> |
342 | /// Called immediately after an object is loaded from storage. | 342 | /// Called immediately after an object is loaded from storage. |
@@ -348,7 +348,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
348 | /// Called immediately before an object is saved to storage. | 348 | /// Called immediately before an object is saved to storage. |
349 | /// </summary> | 349 | /// </summary> |
350 | /// <param name="persistingSo"> | 350 | /// <param name="persistingSo"> |
351 | /// The scene object being persisted. | 351 | /// The scene object being persisted. |
352 | /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory. | 352 | /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory. |
353 | /// </param> | 353 | /// </param> |
354 | /// <param name="originalSo"> | 354 | /// <param name="originalSo"> |
@@ -367,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
367 | public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); | 367 | public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); |
368 | 368 | ||
369 | public delegate void RegionUp(GridRegion region); | 369 | public delegate void RegionUp(GridRegion region); |
370 | public event RegionUp OnRegionUp; | 370 | public event RegionUp OnRegionUp; |
371 | 371 | ||
372 | public class MoneyTransferArgs : EventArgs | 372 | public class MoneyTransferArgs : EventArgs |
373 | { | 373 | { |
@@ -688,7 +688,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
688 | } | 688 | } |
689 | } | 689 | } |
690 | 690 | ||
691 | public void TriggerOnBackup(IRegionDataStore dstore, bool forced) | 691 | public void TriggerOnBackup(ISimulationDataService dstore, bool forced) |
692 | { | 692 | { |
693 | OnBackupDelegate handlerOnAttach = OnBackup; | 693 | OnBackupDelegate handlerOnAttach = OnBackup; |
694 | if (handlerOnAttach != null) | 694 | if (handlerOnAttach != null) |
@@ -2087,7 +2087,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2087 | } | 2087 | } |
2088 | } | 2088 | } |
2089 | } | 2089 | } |
2090 | } | 2090 | } |
2091 | 2091 | ||
2092 | public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) | 2092 | public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) |
2093 | { | 2093 | { |
@@ -2129,7 +2129,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2129 | } | 2129 | } |
2130 | } | 2130 | } |
2131 | } | 2131 | } |
2132 | } | 2132 | } |
2133 | 2133 | ||
2134 | public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, | 2134 | public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, |
2135 | int local_id, IClientAPI remote_client) | 2135 | int local_id, IClientAPI remote_client) |
@@ -2151,6 +2151,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2151 | } | 2151 | } |
2152 | } | 2152 | } |
2153 | } | 2153 | } |
2154 | } | 2154 | } |
2155 | } | 2155 | } |
2156 | } | 2156 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 3a3ec2b..c75f8ba 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -1,3 +1,30 @@ | |||
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 OpenSimulator 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 | |||
1 | using System; | 28 | using System; |
2 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
3 | using log4net; | 30 | using log4net; |
@@ -35,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
35 | 62 | ||
36 | /// <summary> | 63 | /// <summary> |
37 | /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the | 64 | /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the |
38 | /// viewer before child prim updates. | 65 | /// viewer before child prim updates. |
39 | /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up | 66 | /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up |
40 | /// being double. We do it both ways so that there is a still a priority delta even if the priority is already | 67 | /// being double. We do it both ways so that there is a still a priority delta even if the priority is already |
41 | /// double.MinValue or double.MaxValue. | 68 | /// double.MinValue or double.MaxValue. |
@@ -123,9 +150,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
123 | if (entity is SceneObjectPart) | 150 | if (entity is SceneObjectPart) |
124 | { | 151 | { |
125 | // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene | 152 | // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene |
126 | // before its scheduled update was triggered | 153 | // before its scheduled update was triggered |
127 | //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | 154 | //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; |
128 | entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; | 155 | entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; |
129 | } | 156 | } |
130 | else | 157 | else |
131 | { | 158 | { |
@@ -152,15 +179,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
152 | Vector3 entityPos = entity.AbsolutePosition; | 179 | Vector3 entityPos = entity.AbsolutePosition; |
153 | if (entity is SceneObjectPart) | 180 | if (entity is SceneObjectPart) |
154 | { | 181 | { |
155 | SceneObjectGroup group = m_scene.GetGroupByPrim(entity.LocalId); | 182 | // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene |
156 | if (group == null) | 183 | // before its scheduled update was triggered |
157 | { | 184 | //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; |
158 | entityPos = entity.AbsolutePosition; | 185 | entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; |
159 | } | ||
160 | else | ||
161 | { | ||
162 | entityPos = group.AbsolutePosition; | ||
163 | } | ||
164 | } | 186 | } |
165 | else | 187 | else |
166 | { | 188 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index ccbd880..867fb10 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
58 | { | 58 | { |
59 | m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); | 59 | m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); |
60 | 60 | ||
61 | foreach (EntityBase group in Entities) | 61 | EntityBase[] entities = Entities.GetEntities(); |
62 | foreach (EntityBase group in entities) | ||
62 | { | 63 | { |
63 | if (group is SceneObjectGroup) | 64 | if (group is SceneObjectGroup) |
64 | { | 65 | { |
@@ -132,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
132 | item.Owner, item.Name, item.ID); | 133 | item.Owner, item.Name, item.ID); |
133 | 134 | ||
134 | return false; | 135 | return false; |
135 | } | 136 | } |
136 | } | 137 | } |
137 | 138 | ||
138 | /// <summary> | 139 | /// <summary> |
@@ -1987,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1987 | return null; | 1988 | return null; |
1988 | 1989 | ||
1989 | if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos)) | 1990 | if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos)) |
1990 | return null; | 1991 | return null; |
1991 | 1992 | ||
1992 | if (!Permissions.BypassPermissions()) | 1993 | if (!Permissions.BypassPermissions()) |
1993 | { | 1994 | { |
@@ -2065,7 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2065 | 2066 | ||
2066 | List<SceneObjectPart> partList = null; | 2067 | List<SceneObjectPart> partList = null; |
2067 | lock (sog.Children) | 2068 | lock (sog.Children) |
2068 | partList = new List<SceneObjectPart>(sog.Children.Values); | 2069 | partList = new List<SceneObjectPart>(sog.Children.Values); |
2069 | 2070 | ||
2070 | foreach (SceneObjectPart child in partList) | 2071 | foreach (SceneObjectPart child in partList) |
2071 | child.Inventory.ChangeInventoryOwner(ownerID); | 2072 | child.Inventory.ChangeInventoryOwner(ownerID); |
@@ -2080,7 +2081,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2080 | 2081 | ||
2081 | List<SceneObjectPart> partList = null; | 2082 | List<SceneObjectPart> partList = null; |
2082 | lock (sog.Children) | 2083 | lock (sog.Children) |
2083 | partList = new List<SceneObjectPart>(sog.Children.Values); | 2084 | partList = new List<SceneObjectPart>(sog.Children.Values); |
2084 | 2085 | ||
2085 | foreach (SceneObjectPart child in partList) | 2086 | foreach (SceneObjectPart child in partList) |
2086 | { | 2087 | { |
@@ -2090,7 +2091,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2090 | 2091 | ||
2091 | sog.SetOwnerId(groupID); | 2092 | sog.SetOwnerId(groupID); |
2092 | sog.ApplyNextOwnerPermissions(); | 2093 | sog.ApplyNextOwnerPermissions(); |
2093 | } | 2094 | } |
2094 | } | 2095 | } |
2095 | 2096 | ||
2096 | foreach (uint localID in localIDs) | 2097 | foreach (uint localID in localIDs) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index c511774..7788e43 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
116 | /// <param name="remoteClient"></param> | 116 | /// <param name="remoteClient"></param> |
117 | public void RequestPrim(uint primLocalID, IClientAPI remoteClient) | 117 | public void RequestPrim(uint primLocalID, IClientAPI remoteClient) |
118 | { | 118 | { |
119 | List<EntityBase> EntityList = GetEntities(); | 119 | EntityBase[] entityList = GetEntities(); |
120 | 120 | foreach (EntityBase ent in entityList) | |
121 | foreach (EntityBase ent in EntityList) | ||
122 | { | 121 | { |
123 | if (ent is SceneObjectGroup) | 122 | if (ent is SceneObjectGroup) |
124 | { | 123 | { |
@@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
138 | /// <param name="remoteClient"></param> | 137 | /// <param name="remoteClient"></param> |
139 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) | 138 | public void SelectPrim(uint primLocalID, IClientAPI remoteClient) |
140 | { | 139 | { |
141 | List<EntityBase> EntityList = GetEntities(); | 140 | EntityBase[] entityList = GetEntities(); |
142 | 141 | foreach (EntityBase ent in entityList) | |
143 | foreach (EntityBase ent in EntityList) | ||
144 | { | 142 | { |
145 | if (ent is SceneObjectGroup) | 143 | if (ent is SceneObjectGroup) |
146 | { | 144 | { |
@@ -166,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
166 | 164 | ||
167 | List<SceneObjectPart> partList = null; | 165 | List<SceneObjectPart> partList = null; |
168 | lock (sog.Children) | 166 | lock (sog.Children) |
169 | partList = new List<SceneObjectPart>(sog.Children.Values); | 167 | partList = new List<SceneObjectPart>(sog.Children.Values); |
170 | 168 | ||
171 | foreach (SceneObjectPart part in partList) | 169 | foreach (SceneObjectPart part in partList) |
172 | { | 170 | { |
@@ -259,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
259 | 257 | ||
260 | public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | 258 | public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) |
261 | { | 259 | { |
262 | List<EntityBase> EntityList = GetEntities(); | 260 | EntityBase[] EntityList = GetEntities(); |
263 | 261 | ||
264 | SurfaceTouchEventArgs surfaceArg = null; | 262 | SurfaceTouchEventArgs surfaceArg = null; |
265 | if (surfaceArgs != null && surfaceArgs.Count > 0) | 263 | if (surfaceArgs != null && surfaceArgs.Count > 0) |
@@ -303,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
303 | 301 | ||
304 | public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | 302 | public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) |
305 | { | 303 | { |
306 | List<EntityBase> EntityList = GetEntities(); | 304 | EntityBase[] EntityList = GetEntities(); |
307 | 305 | ||
308 | SurfaceTouchEventArgs surfaceArg = null; | 306 | SurfaceTouchEventArgs surfaceArg = null; |
309 | if (surfaceArgs != null && surfaceArgs.Count > 0) | 307 | if (surfaceArgs != null && surfaceArgs.Count > 0) |
@@ -343,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
343 | 341 | ||
344 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | 342 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) |
345 | { | 343 | { |
346 | List<EntityBase> EntityList = GetEntities(); | 344 | EntityBase[] EntityList = GetEntities(); |
347 | 345 | ||
348 | SurfaceTouchEventArgs surfaceArg = null; | 346 | SurfaceTouchEventArgs surfaceArg = null; |
349 | if (surfaceArgs != null && surfaceArgs.Count > 0) | 347 | if (surfaceArgs != null && surfaceArgs.Count > 0) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 4e80bf2..06890a0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs | |||
@@ -997,6 +997,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
997 | } | 997 | } |
998 | } | 998 | } |
999 | return true; | 999 | return true; |
1000 | } | 1000 | } |
1001 | } | 1001 | } |
1002 | } \ No newline at end of file | 1002 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index be342ab..0e1b4b1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
57 | 57 | ||
58 | public partial class Scene : SceneBase | 58 | public partial class Scene : SceneBase |
59 | { | 59 | { |
60 | public delegate void SynchronizeSceneHandler(Scene scene); | ||
61 | public SynchronizeSceneHandler SynchronizeScene = null; | ||
62 | |||
63 | /* Used by the loadbalancer plugin on GForge */ | ||
64 | protected int m_splitRegionID = 0; | ||
65 | public int SplitRegionID | ||
66 | { | ||
67 | get { return m_splitRegionID; } | ||
68 | set { m_splitRegionID = value; } | ||
69 | } | ||
70 | |||
71 | private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; | 60 | private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; |
72 | private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; | 61 | private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; |
73 | 62 | ||
74 | #region Fields | 63 | public delegate void SynchronizeSceneHandler(Scene scene); |
75 | 64 | ||
76 | protected Timer m_restartWaitTimer = new Timer(); | 65 | #region Fields |
77 | 66 | ||
67 | public SynchronizeSceneHandler SynchronizeScene; | ||
78 | public SimStatsReporter StatsReporter; | 68 | public SimStatsReporter StatsReporter; |
79 | |||
80 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | ||
81 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | ||
82 | |||
83 | private volatile int m_bordersLocked = 0; | ||
84 | public bool BordersLocked | ||
85 | { | ||
86 | get { return m_bordersLocked == 1; } | ||
87 | set | ||
88 | { | ||
89 | if (value == true) | ||
90 | m_bordersLocked = 1; | ||
91 | else | ||
92 | m_bordersLocked = 0; | ||
93 | } | ||
94 | } | ||
95 | public List<Border> NorthBorders = new List<Border>(); | 69 | public List<Border> NorthBorders = new List<Border>(); |
96 | public List<Border> EastBorders = new List<Border>(); | 70 | public List<Border> EastBorders = new List<Border>(); |
97 | public List<Border> SouthBorders = new List<Border>(); | 71 | public List<Border> SouthBorders = new List<Border>(); |
98 | public List<Border> WestBorders = new List<Border>(); | 72 | public List<Border> WestBorders = new List<Border>(); |
99 | 73 | ||
100 | /// <value> | 74 | /// <summary>Are we applying physics to any of the prims in this scene?</summary> |
101 | /// The scene graph for this scene | ||
102 | /// </value> | ||
103 | /// TODO: Possibly stop other classes being able to manipulate this directly. | ||
104 | private SceneGraph m_sceneGraph; | ||
105 | |||
106 | /// <summary> | ||
107 | /// Are we applying physics to any of the prims in this scene? | ||
108 | /// </summary> | ||
109 | public bool m_physicalPrim; | 75 | public bool m_physicalPrim; |
110 | public float m_maxNonphys = 256; | 76 | public float m_maxNonphys = 256; |
111 | public float m_maxPhys = 10; | 77 | public float m_maxPhys = 10; |
@@ -119,25 +85,131 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | // root agents when ACL denies access to root agent | 85 | // root agents when ACL denies access to root agent |
120 | public bool m_strictAccessControl = true; | 86 | public bool m_strictAccessControl = true; |
121 | public int MaxUndoCount = 5; | 87 | public int MaxUndoCount = 5; |
88 | public bool LoginsDisabled = true; | ||
89 | public bool LoadingPrims; | ||
90 | public IXfer XferManager; | ||
91 | |||
92 | // the minimum time that must elapse before a changed object will be considered for persisted | ||
93 | public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; | ||
94 | // the maximum time that must elapse before a changed object will be considered for persisted | ||
95 | public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L; | ||
96 | |||
97 | protected int m_splitRegionID; | ||
98 | protected Timer m_restartWaitTimer = new Timer(); | ||
99 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | ||
100 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | ||
101 | protected string m_simulatorVersion = "OpenSimulator Server"; | ||
102 | protected ModuleLoader m_moduleLoader; | ||
103 | protected AgentCircuitManager m_authenticateHandler; | ||
104 | protected SceneCommunicationService m_sceneGridService; | ||
105 | protected ISnmpModule m_snmpService = null; | ||
106 | |||
107 | protected ISimulationDataService m_SimulationDataService; | ||
108 | protected IEstateDataService m_EstateDataService; | ||
109 | protected IAssetService m_AssetService; | ||
110 | protected IAuthorizationService m_AuthorizationService; | ||
111 | protected IInventoryService m_InventoryService; | ||
112 | protected IGridService m_GridService; | ||
113 | protected ILibraryService m_LibraryService; | ||
114 | protected ISimulationService m_simulationService; | ||
115 | protected IAuthenticationService m_AuthenticationService; | ||
116 | protected IPresenceService m_PresenceService; | ||
117 | protected IUserAccountService m_UserAccountService; | ||
118 | protected IAvatarService m_AvatarService; | ||
119 | protected IGridUserService m_GridUserService; | ||
120 | |||
121 | protected IXMLRPC m_xmlrpcModule; | ||
122 | protected IWorldComm m_worldCommModule; | ||
123 | protected IAvatarFactory m_AvatarFactory; | ||
124 | protected IConfigSource m_config; | ||
125 | protected IRegionSerialiserModule m_serialiser; | ||
126 | protected IDialogModule m_dialogModule; | ||
127 | protected IEntityTransferModule m_teleportModule; | ||
128 | protected ICapabilitiesModule m_capsModule; | ||
129 | // Central Update Loop | ||
130 | protected int m_fps = 10; | ||
131 | protected uint m_frame; | ||
132 | protected float m_timespan = 0.089f; | ||
133 | protected DateTime m_lastupdate = DateTime.UtcNow; | ||
134 | |||
135 | // TODO: Possibly stop other classes being able to manipulate this directly. | ||
136 | private SceneGraph m_sceneGraph; | ||
137 | private volatile int m_bordersLocked; | ||
122 | private int m_RestartTimerCounter; | 138 | private int m_RestartTimerCounter; |
123 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 139 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
124 | private int m_incrementsof15seconds; | 140 | private int m_incrementsof15seconds; |
125 | private volatile bool m_backingup; | 141 | private volatile bool m_backingup; |
126 | |||
127 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 142 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
128 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 143 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); |
144 | private Object m_heartbeatLock = new Object(); | ||
129 | 145 | ||
130 | protected string m_simulatorVersion = "OpenSimulator Server"; | 146 | private int m_update_physics = 1; |
147 | private int m_update_entitymovement = 1; | ||
148 | private int m_update_objects = 1; // Update objects which have scheduled themselves for updates | ||
149 | private int m_update_presences = 1; // Update scene presence movements | ||
150 | private int m_update_events = 1; | ||
151 | private int m_update_backup = 200; | ||
152 | private int m_update_terrain = 50; | ||
153 | private int m_update_land = 1; | ||
154 | private int m_update_coarse_locations = 50; | ||
131 | 155 | ||
132 | protected ModuleLoader m_moduleLoader; | 156 | private int frameMS; |
133 | protected StorageManager m_storageManager; | 157 | private int physicsMS2; |
134 | protected AgentCircuitManager m_authenticateHandler; | 158 | private int physicsMS; |
159 | private int otherMS; | ||
160 | private int tempOnRezMS; | ||
161 | private int eventMS; | ||
162 | private int backupMS; | ||
163 | private int terrainMS; | ||
164 | private int landMS; | ||
165 | private int lastCompletedFrame; | ||
135 | 166 | ||
136 | protected SceneCommunicationService m_sceneGridService; | ||
137 | public bool LoginsDisabled = true; | ||
138 | public bool LoadingPrims = false; | ||
139 | public bool CombineRegions = false; | 167 | public bool CombineRegions = false; |
168 | private bool m_physics_enabled = true; | ||
169 | private bool m_scripts_enabled = true; | ||
170 | private string m_defaultScriptEngine; | ||
171 | private int m_LastLogin; | ||
172 | private Thread HeartbeatThread; | ||
173 | private volatile bool shuttingdown; | ||
174 | |||
175 | private int m_lastUpdate; | ||
176 | private bool m_firstHeartbeat = true; | ||
177 | |||
178 | private object m_deleting_scene_object = new object(); | ||
179 | private object m_cleaningAttachments = new object(); | ||
180 | |||
181 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | ||
182 | private bool m_reprioritizationEnabled = true; | ||
183 | private double m_reprioritizationInterval = 5000.0; | ||
184 | private double m_rootReprioritizationDistance = 10.0; | ||
185 | private double m_childReprioritizationDistance = 20.0; | ||
186 | |||
187 | private Timer m_mapGenerationTimer = new Timer(); | ||
188 | private bool m_generateMaptiles; | ||
189 | |||
190 | #endregion Fields | ||
140 | 191 | ||
192 | #region Properties | ||
193 | |||
194 | /* Used by the loadbalancer plugin on GForge */ | ||
195 | public int SplitRegionID | ||
196 | { | ||
197 | get { return m_splitRegionID; } | ||
198 | set { m_splitRegionID = value; } | ||
199 | } | ||
200 | |||
201 | public bool BordersLocked | ||
202 | { | ||
203 | get { return m_bordersLocked == 1; } | ||
204 | set | ||
205 | { | ||
206 | if (value == true) | ||
207 | m_bordersLocked = 1; | ||
208 | else | ||
209 | m_bordersLocked = 0; | ||
210 | } | ||
211 | } | ||
212 | |||
141 | public new float TimeDilation | 213 | public new float TimeDilation |
142 | { | 214 | { |
143 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } | 215 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } |
@@ -148,9 +220,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
148 | get { return m_sceneGridService; } | 220 | get { return m_sceneGridService; } |
149 | } | 221 | } |
150 | 222 | ||
151 | public IXfer XferManager; | ||
152 | |||
153 | protected ISnmpModule m_snmpService = null; | ||
154 | public ISnmpModule SnmpService | 223 | public ISnmpModule SnmpService |
155 | { | 224 | { |
156 | get | 225 | get |
@@ -164,10 +233,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
164 | } | 233 | } |
165 | } | 234 | } |
166 | 235 | ||
167 | protected IAssetService m_AssetService; | 236 | public ISimulationDataService SimulationDataService |
168 | protected IAuthorizationService m_AuthorizationService; | 237 | { |
238 | get | ||
239 | { | ||
240 | if (m_SimulationDataService == null) | ||
241 | { | ||
242 | m_SimulationDataService = RequestModuleInterface<ISimulationDataService>(); | ||
169 | 243 | ||
170 | private Object m_heartbeatLock = new Object(); | 244 | if (m_SimulationDataService == null) |
245 | { | ||
246 | throw new Exception("No ISimulationDataService available."); | ||
247 | } | ||
248 | } | ||
249 | |||
250 | return m_SimulationDataService; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | public IEstateDataService EstateDataService | ||
255 | { | ||
256 | get | ||
257 | { | ||
258 | if (m_EstateDataService == null) | ||
259 | { | ||
260 | m_EstateDataService = RequestModuleInterface<IEstateDataService>(); | ||
261 | |||
262 | if (m_EstateDataService == null) | ||
263 | { | ||
264 | throw new Exception("No IEstateDataService available."); | ||
265 | } | ||
266 | } | ||
267 | |||
268 | return m_EstateDataService; | ||
269 | } | ||
270 | } | ||
171 | 271 | ||
172 | public IAssetService AssetService | 272 | public IAssetService AssetService |
173 | { | 273 | { |
@@ -206,8 +306,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
206 | } | 306 | } |
207 | } | 307 | } |
208 | 308 | ||
209 | protected IInventoryService m_InventoryService; | ||
210 | |||
211 | public IInventoryService InventoryService | 309 | public IInventoryService InventoryService |
212 | { | 310 | { |
213 | get | 311 | get |
@@ -226,8 +324,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | } | 324 | } |
227 | } | 325 | } |
228 | 326 | ||
229 | protected IGridService m_GridService; | ||
230 | |||
231 | public IGridService GridService | 327 | public IGridService GridService |
232 | { | 328 | { |
233 | get | 329 | get |
@@ -246,8 +342,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
246 | } | 342 | } |
247 | } | 343 | } |
248 | 344 | ||
249 | protected ILibraryService m_LibraryService; | ||
250 | |||
251 | public ILibraryService LibraryService | 345 | public ILibraryService LibraryService |
252 | { | 346 | { |
253 | get | 347 | get |
@@ -259,7 +353,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
259 | } | 353 | } |
260 | } | 354 | } |
261 | 355 | ||
262 | protected ISimulationService m_simulationService; | ||
263 | public ISimulationService SimulationService | 356 | public ISimulationService SimulationService |
264 | { | 357 | { |
265 | get | 358 | get |
@@ -270,7 +363,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
270 | } | 363 | } |
271 | } | 364 | } |
272 | 365 | ||
273 | protected IAuthenticationService m_AuthenticationService; | ||
274 | public IAuthenticationService AuthenticationService | 366 | public IAuthenticationService AuthenticationService |
275 | { | 367 | { |
276 | get | 368 | get |
@@ -281,7 +373,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
281 | } | 373 | } |
282 | } | 374 | } |
283 | 375 | ||
284 | protected IPresenceService m_PresenceService; | ||
285 | public IPresenceService PresenceService | 376 | public IPresenceService PresenceService |
286 | { | 377 | { |
287 | get | 378 | get |
@@ -291,7 +382,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
291 | return m_PresenceService; | 382 | return m_PresenceService; |
292 | } | 383 | } |
293 | } | 384 | } |
294 | protected IUserAccountService m_UserAccountService; | 385 | |
295 | public IUserAccountService UserAccountService | 386 | public IUserAccountService UserAccountService |
296 | { | 387 | { |
297 | get | 388 | get |
@@ -302,8 +393,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
302 | } | 393 | } |
303 | } | 394 | } |
304 | 395 | ||
305 | protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService; | 396 | public IAvatarService AvatarService |
306 | public OpenSim.Services.Interfaces.IAvatarService AvatarService | ||
307 | { | 397 | { |
308 | get | 398 | get |
309 | { | 399 | { |
@@ -313,7 +403,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
313 | } | 403 | } |
314 | } | 404 | } |
315 | 405 | ||
316 | protected IGridUserService m_GridUserService; | ||
317 | public IGridUserService GridUserService | 406 | public IGridUserService GridUserService |
318 | { | 407 | { |
319 | get | 408 | get |
@@ -324,58 +413,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
324 | } | 413 | } |
325 | } | 414 | } |
326 | 415 | ||
327 | protected IXMLRPC m_xmlrpcModule; | ||
328 | protected IWorldComm m_worldCommModule; | ||
329 | public IAttachmentsModule AttachmentsModule { get; set; } | 416 | public IAttachmentsModule AttachmentsModule { get; set; } |
330 | protected IAvatarFactory m_AvatarFactory; | 417 | |
331 | public IAvatarFactory AvatarFactory | 418 | public IAvatarFactory AvatarFactory |
332 | { | 419 | { |
333 | get { return m_AvatarFactory; } | 420 | get { return m_AvatarFactory; } |
334 | } | 421 | } |
335 | protected IConfigSource m_config; | ||
336 | protected IRegionSerialiserModule m_serialiser; | ||
337 | protected IDialogModule m_dialogModule; | ||
338 | protected IEntityTransferModule m_teleportModule; | ||
339 | 422 | ||
340 | protected ICapabilitiesModule m_capsModule; | ||
341 | public ICapabilitiesModule CapsModule | 423 | public ICapabilitiesModule CapsModule |
342 | { | 424 | { |
343 | get { return m_capsModule; } | 425 | get { return m_capsModule; } |
344 | } | 426 | } |
345 | 427 | ||
346 | protected override IConfigSource GetConfig() | ||
347 | { | ||
348 | return m_config; | ||
349 | } | ||
350 | |||
351 | // Central Update Loop | ||
352 | |||
353 | protected int m_fps = 10; | ||
354 | protected uint m_frame; | ||
355 | protected float m_timespan = 0.089f; | ||
356 | protected DateTime m_lastupdate = DateTime.UtcNow; | ||
357 | |||
358 | private int m_update_physics = 1; | ||
359 | private int m_update_entitymovement = 1; | ||
360 | private int m_update_objects = 1; // Update objects which have scheduled themselves for updates | ||
361 | private int m_update_presences = 1; // Update scene presence movements | ||
362 | private int m_update_events = 1; | ||
363 | private int m_update_backup = 200; | ||
364 | private int m_update_terrain = 50; | ||
365 | private int m_update_land = 1; | ||
366 | private int m_update_coarse_locations = 50; | ||
367 | |||
368 | private int frameMS; | ||
369 | private int physicsMS2; | ||
370 | private int physicsMS; | ||
371 | private int otherMS; | ||
372 | private int tempOnRezMS; | ||
373 | private int eventMS; | ||
374 | private int backupMS; | ||
375 | private int terrainMS; | ||
376 | private int landMS; | ||
377 | private int lastCompletedFrame; | ||
378 | |||
379 | public int MonitorFrameTime { get { return frameMS; } } | 428 | public int MonitorFrameTime { get { return frameMS; } } |
380 | public int MonitorPhysicsUpdateTime { get { return physicsMS; } } | 429 | public int MonitorPhysicsUpdateTime { get { return physicsMS; } } |
381 | public int MonitorPhysicsSyncTime { get { return physicsMS2; } } | 430 | public int MonitorPhysicsSyncTime { get { return physicsMS2; } } |
@@ -387,37 +436,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
387 | public int MonitorLandTime { get { return landMS; } } | 436 | public int MonitorLandTime { get { return landMS; } } |
388 | public int MonitorLastFrameTick { get { return lastCompletedFrame; } } | 437 | public int MonitorLastFrameTick { get { return lastCompletedFrame; } } |
389 | 438 | ||
390 | private bool m_physics_enabled = true; | ||
391 | private bool m_scripts_enabled = true; | ||
392 | private string m_defaultScriptEngine; | ||
393 | private int m_LastLogin; | ||
394 | private Thread HeartbeatThread; | ||
395 | private volatile bool shuttingdown; | ||
396 | |||
397 | private int m_lastUpdate; | ||
398 | private bool m_firstHeartbeat = true; | ||
399 | |||
400 | private object m_deleting_scene_object = new object(); | ||
401 | private object m_cleaningAttachments = new object(); | ||
402 | |||
403 | // the minimum time that must elapse before a changed object will be considered for persisted | ||
404 | public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; | ||
405 | // the maximum time that must elapse before a changed object will be considered for persisted | ||
406 | public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L; | ||
407 | |||
408 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | ||
409 | private bool m_reprioritizationEnabled = true; | ||
410 | private double m_reprioritizationInterval = 5000.0; | ||
411 | private double m_rootReprioritizationDistance = 10.0; | ||
412 | private double m_childReprioritizationDistance = 20.0; | ||
413 | |||
414 | private Timer m_mapGenerationTimer = new Timer(); | ||
415 | bool m_generateMaptiles = false; | ||
416 | |||
417 | #endregion | ||
418 | |||
419 | #region Properties | ||
420 | |||
421 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } | 439 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } |
422 | public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } | 440 | public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } |
423 | public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } | 441 | public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } |
@@ -497,13 +515,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
497 | set { m_sceneGraph.RestorePresences = value; } | 515 | set { m_sceneGraph.RestorePresences = value; } |
498 | } | 516 | } |
499 | 517 | ||
500 | #endregion | 518 | #endregion Properties |
501 | 519 | ||
502 | #region Constructors | 520 | #region Constructors |
503 | 521 | ||
504 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, | 522 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, |
505 | SceneCommunicationService sceneGridService, | 523 | SceneCommunicationService sceneGridService, |
506 | StorageManager storeManager, | 524 | ISimulationDataService simDataService, IEstateDataService estateDataService, |
507 | ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, | 525 | ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, |
508 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) | 526 | bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) |
509 | { | 527 | { |
@@ -539,7 +557,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
539 | m_moduleLoader = moduleLoader; | 557 | m_moduleLoader = moduleLoader; |
540 | m_authenticateHandler = authen; | 558 | m_authenticateHandler = authen; |
541 | m_sceneGridService = sceneGridService; | 559 | m_sceneGridService = sceneGridService; |
542 | m_storageManager = storeManager; | 560 | m_SimulationDataService = simDataService; |
561 | m_EstateDataService = estateDataService; | ||
543 | m_regInfo = regInfo; | 562 | m_regInfo = regInfo; |
544 | m_regionHandle = m_regInfo.RegionHandle; | 563 | m_regionHandle = m_regInfo.RegionHandle; |
545 | m_regionName = m_regInfo.RegionName; | 564 | m_regionName = m_regInfo.RegionName; |
@@ -558,13 +577,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
558 | #region Region Settings | 577 | #region Region Settings |
559 | 578 | ||
560 | // Load region settings | 579 | // Load region settings |
561 | m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); | 580 | m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID); |
562 | m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID); | ||
563 | 581 | ||
564 | if (m_storageManager.EstateDataStore != null) | 582 | m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID); |
565 | { | 583 | if (estateDataService != null) |
566 | m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); | 584 | m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); |
567 | } | ||
568 | 585 | ||
569 | #endregion Region Settings | 586 | #endregion Region Settings |
570 | 587 | ||
@@ -574,9 +591,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
574 | 591 | ||
575 | //Bind Storage Manager functions to some land manager functions for this scene | 592 | //Bind Storage Manager functions to some land manager functions for this scene |
576 | EventManager.OnLandObjectAdded += | 593 | EventManager.OnLandObjectAdded += |
577 | new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); | 594 | new EventManager.LandObjectAdded(simDataService.StoreLandObject); |
578 | EventManager.OnLandObjectRemoved += | 595 | EventManager.OnLandObjectRemoved += |
579 | new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); | 596 | new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); |
580 | 597 | ||
581 | m_sceneGraph = new SceneGraph(this, m_regInfo); | 598 | m_sceneGraph = new SceneGraph(this, m_regInfo); |
582 | 599 | ||
@@ -1062,29 +1079,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1062 | if (ScriptEngine) | 1079 | if (ScriptEngine) |
1063 | { | 1080 | { |
1064 | m_log.Info("Stopping all Scripts in Scene"); | 1081 | m_log.Info("Stopping all Scripts in Scene"); |
1065 | foreach (EntityBase ent in Entities) | 1082 | |
1083 | EntityBase[] entities = Entities.GetEntities(); | ||
1084 | foreach (EntityBase ent in entities) | ||
1066 | { | 1085 | { |
1067 | if (ent is SceneObjectGroup) | 1086 | if (ent is SceneObjectGroup) |
1068 | { | 1087 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); |
1069 | ((SceneObjectGroup) ent).RemoveScriptInstances(false); | ||
1070 | } | ||
1071 | } | 1088 | } |
1072 | } | 1089 | } |
1073 | else | 1090 | else |
1074 | { | 1091 | { |
1075 | m_log.Info("Starting all Scripts in Scene"); | 1092 | m_log.Info("Starting all Scripts in Scene"); |
1076 | lock (Entities) | 1093 | |
1094 | EntityBase[] entities = Entities.GetEntities(); | ||
1095 | foreach (EntityBase ent in entities) | ||
1077 | { | 1096 | { |
1078 | foreach (EntityBase ent in Entities) | 1097 | if (ent is SceneObjectGroup) |
1079 | { | 1098 | { |
1080 | if (ent is SceneObjectGroup) | 1099 | SceneObjectGroup sog = (SceneObjectGroup)ent; |
1081 | { | 1100 | sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); |
1082 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); | 1101 | sog.ResumeScripts(); |
1083 | ((SceneObjectGroup)ent).ResumeScripts(); | ||
1084 | } | ||
1085 | } | 1102 | } |
1086 | } | 1103 | } |
1087 | } | 1104 | } |
1105 | |||
1088 | m_scripts_enabled = !ScriptEngine; | 1106 | m_scripts_enabled = !ScriptEngine; |
1089 | m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); | 1107 | m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); |
1090 | } | 1108 | } |
@@ -1131,12 +1149,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1131 | shuttingdown = true; | 1149 | shuttingdown = true; |
1132 | 1150 | ||
1133 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1151 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1134 | List<EntityBase> entities = GetEntities(); | 1152 | EntityBase[] entities = GetEntities(); |
1135 | foreach (EntityBase entity in entities) | 1153 | foreach (EntityBase entity in entities) |
1136 | { | 1154 | { |
1137 | if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) | 1155 | if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) |
1138 | { | 1156 | { |
1139 | ((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore, false); | 1157 | ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false); |
1140 | } | 1158 | } |
1141 | } | 1159 | } |
1142 | 1160 | ||
@@ -1192,8 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1192 | while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) | 1210 | while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) |
1193 | { | 1211 | { |
1194 | MainConsole.Instance.Output("The current estate has no owner set."); | 1212 | MainConsole.Instance.Output("The current estate has no owner set."); |
1195 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); | 1213 | List<char> excluded = new List<char>(new char[1]{' '}); |
1196 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User"); | 1214 | string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); |
1215 | string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); | ||
1197 | 1216 | ||
1198 | UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); | 1217 | UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); |
1199 | 1218 | ||
@@ -1577,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1577 | { | 1596 | { |
1578 | lock (m_returns) | 1597 | lock (m_returns) |
1579 | { | 1598 | { |
1580 | EventManager.TriggerOnBackup(m_storageManager.DataStore, forced); | 1599 | EventManager.TriggerOnBackup(SimulationDataService, forced); |
1581 | m_backingup = false; | 1600 | m_backingup = false; |
1582 | 1601 | ||
1583 | foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) | 1602 | foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) |
@@ -1618,7 +1637,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1618 | { | 1637 | { |
1619 | if (group != null) | 1638 | if (group != null) |
1620 | { | 1639 | { |
1621 | group.ProcessBackup(m_storageManager.DataStore, true); | 1640 | group.ProcessBackup(SimulationDataService, true); |
1622 | } | 1641 | } |
1623 | } | 1642 | } |
1624 | 1643 | ||
@@ -1660,20 +1679,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1660 | /// </summary> | 1679 | /// </summary> |
1661 | public void SaveTerrain() | 1680 | public void SaveTerrain() |
1662 | { | 1681 | { |
1663 | m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); | 1682 | SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); |
1664 | } | 1683 | } |
1665 | 1684 | ||
1666 | public void StoreWindlightProfile(RegionLightShareData wl) | 1685 | public void StoreWindlightProfile(RegionLightShareData wl) |
1667 | { | 1686 | { |
1668 | m_regInfo.WindlightSettings = wl; | 1687 | m_regInfo.WindlightSettings = wl; |
1669 | wl.Save(); | 1688 | SimulationDataService.StoreRegionWindlightSettings(wl); |
1670 | m_storageManager.DataStore.StoreRegionWindlightSettings(wl); | ||
1671 | m_eventManager.TriggerOnSaveNewWindlightProfile(); | 1689 | m_eventManager.TriggerOnSaveNewWindlightProfile(); |
1672 | } | 1690 | } |
1673 | 1691 | ||
1674 | public void LoadWindlightProfile() | 1692 | public void LoadWindlightProfile() |
1675 | { | 1693 | { |
1676 | m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID); | 1694 | m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID); |
1677 | m_eventManager.TriggerOnSaveNewWindlightProfile(); | 1695 | m_eventManager.TriggerOnSaveNewWindlightProfile(); |
1678 | } | 1696 | } |
1679 | 1697 | ||
@@ -1684,13 +1702,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1684 | { | 1702 | { |
1685 | try | 1703 | try |
1686 | { | 1704 | { |
1687 | double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID); | 1705 | double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID); |
1688 | if (map == null) | 1706 | if (map == null) |
1689 | { | 1707 | { |
1690 | m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); | 1708 | m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); |
1691 | Heightmap = new TerrainChannel(); | 1709 | Heightmap = new TerrainChannel(); |
1692 | 1710 | ||
1693 | m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); | 1711 | SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); |
1694 | } | 1712 | } |
1695 | else | 1713 | else |
1696 | { | 1714 | { |
@@ -1707,7 +1725,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1707 | { | 1725 | { |
1708 | Heightmap = new TerrainChannel(); | 1726 | Heightmap = new TerrainChannel(); |
1709 | 1727 | ||
1710 | m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); | 1728 | SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); |
1711 | } | 1729 | } |
1712 | } | 1730 | } |
1713 | catch (Exception e) | 1731 | catch (Exception e) |
@@ -1754,7 +1772,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1754 | public void loadAllLandObjectsFromStorage(UUID regionID) | 1772 | public void loadAllLandObjectsFromStorage(UUID regionID) |
1755 | { | 1773 | { |
1756 | m_log.Info("[SCENE]: Loading land objects from storage"); | 1774 | m_log.Info("[SCENE]: Loading land objects from storage"); |
1757 | List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID); | 1775 | List<LandData> landData = SimulationDataService.LoadLandObjects(regionID); |
1758 | 1776 | ||
1759 | if (LandChannel != null) | 1777 | if (LandChannel != null) |
1760 | { | 1778 | { |
@@ -1785,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1785 | LoadingPrims = true; | 1803 | LoadingPrims = true; |
1786 | m_log.Info("[SCENE]: Loading objects from datastore"); | 1804 | m_log.Info("[SCENE]: Loading objects from datastore"); |
1787 | 1805 | ||
1788 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); | 1806 | List<SceneObjectGroup> PrimsFromDB = SimulationDataService.LoadObjects(regionID); |
1789 | 1807 | ||
1790 | m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore"); | 1808 | m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore"); |
1791 | 1809 | ||
@@ -1978,7 +1996,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1978 | sceneObject.ScheduleGroupForFullUpdate(); | 1996 | sceneObject.ScheduleGroupForFullUpdate(); |
1979 | 1997 | ||
1980 | return sceneObject; | 1998 | return sceneObject; |
1981 | } | 1999 | } |
1982 | 2000 | ||
1983 | /// <summary> | 2001 | /// <summary> |
1984 | /// Add an object into the scene that has come from storage | 2002 | /// Add an object into the scene that has come from storage |
@@ -2074,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2074 | /// <returns></returns> | 2092 | /// <returns></returns> |
2075 | public bool AddNewSceneObject( | 2093 | public bool AddNewSceneObject( |
2076 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | 2094 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) |
2077 | { | 2095 | { |
2078 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); | 2096 | return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); |
2079 | } | 2097 | } |
2080 | 2098 | ||
@@ -2094,8 +2112,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2094 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | 2112 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); |
2095 | lock (Entities) | 2113 | lock (Entities) |
2096 | { | 2114 | { |
2097 | ICollection<EntityBase> entities = new List<EntityBase>(Entities); | 2115 | EntityBase[] entities = Entities.GetEntities(); |
2098 | |||
2099 | foreach (EntityBase e in entities) | 2116 | foreach (EntityBase e in entities) |
2100 | { | 2117 | { |
2101 | if (e is SceneObjectGroup) | 2118 | if (e is SceneObjectGroup) |
@@ -2190,12 +2207,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2190 | // group has recently been delinked from another group but that this change has not been persisted | 2207 | // group has recently been delinked from another group but that this change has not been persisted |
2191 | // to the DB. | 2208 | // to the DB. |
2192 | ForceSceneObjectBackup(so); | 2209 | ForceSceneObjectBackup(so); |
2193 | so.DetachFromBackup(); | 2210 | so.DetachFromBackup(); |
2194 | m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); | 2211 | SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID); |
2195 | } | 2212 | } |
2196 | 2213 | ||
2197 | // We need to keep track of this state in case this group is still queued for further backup. | 2214 | // We need to keep track of this state in case this group is still queued for further backup. |
2198 | so.IsDeleted = true; | 2215 | so.IsDeleted = true; |
2199 | 2216 | ||
2200 | return true; | 2217 | return true; |
2201 | } | 2218 | } |
@@ -2482,7 +2499,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2482 | ScenePresence sp = GetScenePresence(userID); | 2499 | ScenePresence sp = GetScenePresence(userID); |
2483 | if (sp != null && AttachmentsModule != null) | 2500 | if (sp != null && AttachmentsModule != null) |
2484 | { | 2501 | { |
2485 | uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); | 2502 | uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); |
2486 | AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); | 2503 | AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); |
2487 | } | 2504 | } |
2488 | 2505 | ||
@@ -2531,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2531 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); | 2548 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); |
2532 | 2549 | ||
2533 | // Don't sent a full update here because this will cause full updates to be sent twice for | 2550 | // Don't sent a full update here because this will cause full updates to be sent twice for |
2534 | // attachments on region crossings, resulting in viewer glitches. | 2551 | // attachments on region crossings, resulting in viewer glitches. |
2535 | AddRestoredSceneObject(sceneObject, false, false, false); | 2552 | AddRestoredSceneObject(sceneObject, false, false, false); |
2536 | 2553 | ||
2537 | // Handle attachment special case | 2554 | // Handle attachment special case |
@@ -2788,7 +2805,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2788 | } | 2805 | } |
2789 | 2806 | ||
2790 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) | 2807 | public virtual void SubscribeToClientPrimEvents(IClientAPI client) |
2791 | { | 2808 | { |
2792 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; | 2809 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; |
2793 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 2810 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2794 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; | 2811 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; |
@@ -2824,7 +2841,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2824 | client.OnUndo += m_sceneGraph.HandleUndo; | 2841 | client.OnUndo += m_sceneGraph.HandleUndo; |
2825 | client.OnRedo += m_sceneGraph.HandleRedo; | 2842 | client.OnRedo += m_sceneGraph.HandleRedo; |
2826 | client.OnObjectDescription += m_sceneGraph.PrimDescription; | 2843 | client.OnObjectDescription += m_sceneGraph.PrimDescription; |
2827 | client.OnObjectDrop += m_sceneGraph.DropObject; | 2844 | client.OnObjectDrop += m_sceneGraph.DropObject; |
2828 | client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; | 2845 | client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; |
2829 | client.OnObjectOwner += ObjectOwner; | 2846 | client.OnObjectOwner += ObjectOwner; |
2830 | } | 2847 | } |
@@ -3804,7 +3821,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3804 | public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) | 3821 | public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) |
3805 | { | 3822 | { |
3806 | ScenePresence presence = GetScenePresence(agentID); | 3823 | ScenePresence presence = GetScenePresence(agentID); |
3807 | if(presence != null) | 3824 | if (presence != null) |
3808 | { | 3825 | { |
3809 | try | 3826 | try |
3810 | { | 3827 | { |
@@ -4083,6 +4100,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4083 | 4100 | ||
4084 | #region Other Methods | 4101 | #region Other Methods |
4085 | 4102 | ||
4103 | protected override IConfigSource GetConfig() | ||
4104 | { | ||
4105 | return m_config; | ||
4106 | } | ||
4107 | |||
4086 | #endregion | 4108 | #endregion |
4087 | 4109 | ||
4088 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) | 4110 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) |
@@ -4107,9 +4129,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4107 | /// </summary> | 4129 | /// </summary> |
4108 | public void ForceClientUpdate() | 4130 | public void ForceClientUpdate() |
4109 | { | 4131 | { |
4110 | List<EntityBase> EntityList = GetEntities(); | 4132 | EntityBase[] entityList = GetEntities(); |
4111 | 4133 | foreach (EntityBase ent in entityList) | |
4112 | foreach (EntityBase ent in EntityList) | ||
4113 | { | 4134 | { |
4114 | if (ent is SceneObjectGroup) | 4135 | if (ent is SceneObjectGroup) |
4115 | { | 4136 | { |
@@ -4127,9 +4148,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4127 | { | 4148 | { |
4128 | m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); | 4149 | m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); |
4129 | 4150 | ||
4130 | List<EntityBase> EntityList = GetEntities(); | 4151 | EntityBase[] entityList = GetEntities(); |
4131 | 4152 | foreach (EntityBase ent in entityList) | |
4132 | foreach (EntityBase ent in EntityList) | ||
4133 | { | 4153 | { |
4134 | if (ent is SceneObjectGroup) | 4154 | if (ent is SceneObjectGroup) |
4135 | { | 4155 | { |
@@ -4498,7 +4518,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4498 | /// will not affect the original list of objects in the scene. | 4518 | /// will not affect the original list of objects in the scene. |
4499 | /// </summary> | 4519 | /// </summary> |
4500 | /// <returns></returns> | 4520 | /// <returns></returns> |
4501 | public List<EntityBase> GetEntities() | 4521 | public EntityBase[] GetEntities() |
4502 | { | 4522 | { |
4503 | return m_sceneGraph.GetEntities(); | 4523 | return m_sceneGraph.GetEntities(); |
4504 | } | 4524 | } |
@@ -4532,9 +4552,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4532 | 4552 | ||
4533 | public void CleanTempObjects() | 4553 | public void CleanTempObjects() |
4534 | { | 4554 | { |
4535 | List<EntityBase> objs = GetEntities(); | 4555 | EntityBase[] entities = GetEntities(); |
4536 | 4556 | foreach (EntityBase obj in entities) | |
4537 | foreach (EntityBase obj in objs) | ||
4538 | { | 4557 | { |
4539 | if (obj is SceneObjectGroup) | 4558 | if (obj is SceneObjectGroup) |
4540 | { | 4559 | { |
@@ -4554,7 +4573,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4554 | 4573 | ||
4555 | public void DeleteFromStorage(UUID uuid) | 4574 | public void DeleteFromStorage(UUID uuid) |
4556 | { | 4575 | { |
4557 | m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); | 4576 | SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID); |
4558 | } | 4577 | } |
4559 | 4578 | ||
4560 | public int GetHealth() | 4579 | public int GetHealth() |
@@ -4963,17 +4982,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
4963 | 4982 | ||
4964 | public List<UUID> GetEstateRegions(int estateID) | 4983 | public List<UUID> GetEstateRegions(int estateID) |
4965 | { | 4984 | { |
4966 | if (m_storageManager.EstateDataStore == null) | 4985 | IEstateDataService estateDataService = EstateDataService; |
4967 | return new List<UUID>(); | 4986 | if (estateDataService == null) |
4987 | return new List<UUID>(0); | ||
4968 | 4988 | ||
4969 | return m_storageManager.EstateDataStore.GetRegions(estateID); | 4989 | return estateDataService.GetRegions(estateID); |
4970 | } | 4990 | } |
4971 | 4991 | ||
4972 | public void ReloadEstateData() | 4992 | public void ReloadEstateData() |
4973 | { | 4993 | { |
4974 | m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); | 4994 | IEstateDataService estateDataService = EstateDataService; |
4975 | 4995 | if (estateDataService != null) | |
4976 | TriggerEstateSunUpdate(); | 4996 | { |
4997 | m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false); | ||
4998 | TriggerEstateSunUpdate(); | ||
4999 | } | ||
4977 | } | 5000 | } |
4978 | 5001 | ||
4979 | public void TriggerEstateSunUpdate() | 5002 | public void TriggerEstateSunUpdate() |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f8591ba..c71aefa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -521,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
521 | /// <param name="shorthelp"></param> | 521 | /// <param name="shorthelp"></param> |
522 | /// <param name="longhelp"></param> | 522 | /// <param name="longhelp"></param> |
523 | /// <param name="descriptivehelp"></param> | 523 | /// <param name="descriptivehelp"></param> |
524 | /// <param name="callback"></param> | 524 | /// <param name="callback"></param> |
525 | public void AddCommand( | 525 | public void AddCommand( |
526 | object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | 526 | object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) |
527 | { | 527 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index a39f27a..6246400 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -81,10 +81,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
81 | protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>(); | 81 | protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>(); |
82 | protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); | 82 | protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); |
83 | 83 | ||
84 | // SceneObjects is not currently populated or used. | ||
85 | //public Dictionary<UUID, SceneObjectGroup> SceneObjects; | ||
86 | protected internal EntityManager Entities = new EntityManager(); | 84 | protected internal EntityManager Entities = new EntityManager(); |
87 | // protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>(); | ||
88 | protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); | 85 | protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); |
89 | 86 | ||
90 | protected RegionInfo m_regInfo; | 87 | protected RegionInfo m_regInfo; |
@@ -323,7 +320,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
323 | /// <param name="pos">Position of the object</param> | 320 | /// <param name="pos">Position of the object</param> |
324 | /// <param name="rot">Rotation of the object</param> | 321 | /// <param name="rot">Rotation of the object</param> |
325 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> | 322 | /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> |
326 | /// <returns></returns> | 323 | /// <returns></returns> |
327 | public bool AddNewSceneObject( | 324 | public bool AddNewSceneObject( |
328 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) | 325 | SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) |
329 | { | 326 | { |
@@ -347,7 +344,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
347 | } | 344 | } |
348 | 345 | ||
349 | return true; | 346 | return true; |
350 | } | 347 | } |
351 | 348 | ||
352 | /// <summary> | 349 | /// <summary> |
353 | /// Add an object to the scene. This will both update the scene, and send information about the | 350 | /// Add an object to the scene. This will both update the scene, and send information about the |
@@ -370,68 +367,57 @@ namespace OpenSim.Region.Framework.Scenes | |||
370 | if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) | 367 | if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) |
371 | return false; | 368 | return false; |
372 | 369 | ||
373 | lock (sceneObject) | 370 | if (Entities.ContainsKey(sceneObject.UUID)) |
374 | { | 371 | return false; |
375 | if (Entities.ContainsKey(sceneObject.UUID)) | 372 | |
376 | { | 373 | List<SceneObjectPart> children; |
377 | // m_log.WarnFormat( | 374 | lock (sceneObject.Children) |
378 | // "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request", | 375 | children = new List<SceneObjectPart>(sceneObject.Children.Values); |
379 | // sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); | 376 | |
380 | return false; | 377 | // Clamp child prim sizes and add child prims to the m_numPrim count |
381 | } | 378 | if (m_parentScene.m_clampPrimSize) |
382 | 379 | { | |
383 | // m_log.DebugFormat( | 380 | foreach (SceneObjectPart part in children) |
384 | // "[SCENE GRAPH]: Adding object {0} {1} to region {2}", | ||
385 | // sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); | ||
386 | |||
387 | lock (sceneObject.Children) | ||
388 | { | 381 | { |
389 | if (m_parentScene.m_clampPrimSize) | 382 | Vector3 scale = part.Shape.Scale; |
390 | { | 383 | |
391 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 384 | if (scale.X > m_parentScene.m_maxNonphys) |
392 | { | 385 | scale.X = m_parentScene.m_maxNonphys; |
393 | Vector3 scale = part.Shape.Scale; | 386 | if (scale.Y > m_parentScene.m_maxNonphys) |
394 | 387 | scale.Y = m_parentScene.m_maxNonphys; | |
395 | if (scale.X > m_parentScene.m_maxNonphys) | 388 | if (scale.Z > m_parentScene.m_maxNonphys) |
396 | scale.X = m_parentScene.m_maxNonphys; | 389 | scale.Z = m_parentScene.m_maxNonphys; |
397 | if (scale.Y > m_parentScene.m_maxNonphys) | 390 | |
398 | scale.Y = m_parentScene.m_maxNonphys; | 391 | part.Shape.Scale = scale; |
399 | if (scale.Z > m_parentScene.m_maxNonphys) | ||
400 | scale.Z = m_parentScene.m_maxNonphys; | ||
401 | |||
402 | part.Shape.Scale = scale; | ||
403 | } | ||
404 | } | ||
405 | |||
406 | m_numPrim += sceneObject.Children.Count; | ||
407 | } | 392 | } |
408 | 393 | } | |
409 | sceneObject.AttachToScene(m_parentScene); | 394 | m_numPrim += children.Count; |
410 | 395 | ||
411 | if (sendClientUpdates) | 396 | sceneObject.AttachToScene(m_parentScene); |
412 | sceneObject.ScheduleGroupForFullUpdate(); | ||
413 | |||
414 | Entities.Add(sceneObject); | ||
415 | 397 | ||
416 | if (attachToBackup) | 398 | if (sendClientUpdates) |
417 | sceneObject.AttachToBackup(); | 399 | sceneObject.ScheduleGroupForFullUpdate(); |
418 | 400 | ||
419 | if (OnObjectCreate != null) | 401 | Entities.Add(sceneObject); |
420 | OnObjectCreate(sceneObject); | 402 | |
421 | 403 | if (attachToBackup) | |
422 | lock (SceneObjectGroupsByFullID) | 404 | sceneObject.AttachToBackup(); |
423 | { | 405 | |
424 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 406 | if (OnObjectCreate != null) |
425 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 407 | OnObjectCreate(sceneObject); |
426 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; | 408 | |
427 | } | 409 | lock (SceneObjectGroupsByFullID) |
428 | 410 | { | |
429 | lock (SceneObjectGroupsByLocalID) | 411 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; |
430 | { | 412 | foreach (SceneObjectPart part in children) |
431 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | 413 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; |
432 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 414 | } |
433 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; | 415 | |
434 | } | 416 | lock (SceneObjectGroupsByLocalID) |
417 | { | ||
418 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | ||
419 | foreach (SceneObjectPart part in children) | ||
420 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; | ||
435 | } | 421 | } |
436 | 422 | ||
437 | return true; | 423 | return true; |
@@ -443,42 +429,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
443 | /// <returns>true if the object was deleted, false if there was no object to delete</returns> | 429 | /// <returns>true if the object was deleted, false if there was no object to delete</returns> |
444 | public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) | 430 | public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) |
445 | { | 431 | { |
446 | if (Entities.ContainsKey(uuid)) | 432 | EntityBase entity; |
447 | { | 433 | if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup) |
448 | SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; | 434 | return false; |
449 | 435 | ||
450 | if (!resultOfObjectLinked) | 436 | SceneObjectGroup grp = (SceneObjectGroup)entity; |
451 | { | ||
452 | m_numPrim -= grp.PrimCount; | ||
453 | 437 | ||
454 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 438 | if (!resultOfObjectLinked) |
455 | RemovePhysicalPrim(grp.PrimCount); | 439 | { |
456 | } | 440 | m_numPrim -= grp.PrimCount; |
457 | 441 | ||
458 | if (OnObjectRemove != null) | 442 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
459 | OnObjectRemove(Entities[uuid]); | 443 | RemovePhysicalPrim(grp.PrimCount); |
444 | } | ||
460 | 445 | ||
461 | lock (SceneObjectGroupsByFullID) | 446 | if (OnObjectRemove != null) |
462 | { | 447 | OnObjectRemove(Entities[uuid]); |
463 | foreach (SceneObjectPart part in grp.Children.Values) | ||
464 | SceneObjectGroupsByFullID.Remove(part.UUID); | ||
465 | SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); | ||
466 | } | ||
467 | lock (SceneObjectGroupsByLocalID) | ||
468 | { | ||
469 | foreach (SceneObjectPart part in grp.Children.Values) | ||
470 | SceneObjectGroupsByLocalID.Remove(part.LocalId); | ||
471 | SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); | ||
472 | } | ||
473 | 448 | ||
474 | Entities.Remove(uuid); | 449 | lock (SceneObjectGroupsByFullID) |
475 | //SceneObjectGroup part; | 450 | { |
476 | //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 451 | foreach (SceneObjectPart part in grp.Children.Values) |
452 | SceneObjectGroupsByFullID.Remove(part.UUID); | ||
453 | SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); | ||
454 | } | ||
477 | 455 | ||
478 | return true; | 456 | lock (SceneObjectGroupsByLocalID) |
457 | { | ||
458 | foreach (SceneObjectPart part in grp.Children.Values) | ||
459 | SceneObjectGroupsByLocalID.Remove(part.LocalId); | ||
460 | SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); | ||
479 | } | 461 | } |
480 | 462 | ||
481 | return false; | 463 | return Entities.Remove(uuid); |
482 | } | 464 | } |
483 | 465 | ||
484 | /// <summary> | 466 | /// <summary> |
@@ -490,9 +472,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
490 | protected internal void AddToUpdateList(SceneObjectGroup obj) | 472 | protected internal void AddToUpdateList(SceneObjectGroup obj) |
491 | { | 473 | { |
492 | lock (m_updateList) | 474 | lock (m_updateList) |
493 | { | ||
494 | m_updateList[obj.UUID] = obj; | 475 | m_updateList[obj.UUID] = obj; |
495 | } | ||
496 | } | 476 | } |
497 | 477 | ||
498 | public void FireAttachToBackup(SceneObjectGroup obj) | 478 | public void FireAttachToBackup(SceneObjectGroup obj) |
@@ -526,34 +506,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
526 | { | 506 | { |
527 | if (!Monitor.TryEnter(m_updateLock)) | 507 | if (!Monitor.TryEnter(m_updateLock)) |
528 | return; | 508 | return; |
529 | 509 | try | |
530 | List<SceneObjectGroup> updates; | ||
531 | |||
532 | // Some updates add more updates to the updateList. | ||
533 | // Get the current list of updates and clear the list before iterating | ||
534 | lock (m_updateList) | ||
535 | { | ||
536 | updates = new List<SceneObjectGroup>(m_updateList.Values); | ||
537 | m_updateList.Clear(); | ||
538 | } | ||
539 | |||
540 | // Go through all updates | ||
541 | for (int i = 0; i < updates.Count; i++) | ||
542 | { | 510 | { |
543 | SceneObjectGroup sog = updates[i]; | 511 | List<SceneObjectGroup> updates; |
544 | 512 | ||
545 | // Don't abort the whole update if one entity happens to give us an exception. | 513 | // Some updates add more updates to the updateList. |
546 | try | 514 | // Get the current list of updates and clear the list before iterating |
515 | lock (m_updateList) | ||
547 | { | 516 | { |
548 | sog.Update(); | 517 | updates = new List<SceneObjectGroup>(m_updateList.Values); |
518 | m_updateList.Clear(); | ||
549 | } | 519 | } |
550 | catch (Exception e) | 520 | |
521 | // Go through all updates | ||
522 | for (int i = 0; i < updates.Count; i++) | ||
551 | { | 523 | { |
552 | m_log.ErrorFormat( | 524 | SceneObjectGroup sog = updates[i]; |
553 | "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); | 525 | |
526 | // Don't abort the whole update if one entity happens to give us an exception. | ||
527 | try | ||
528 | { | ||
529 | sog.Update(); | ||
530 | } | ||
531 | catch (Exception e) | ||
532 | { | ||
533 | m_log.ErrorFormat( | ||
534 | "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); | ||
535 | } | ||
554 | } | 536 | } |
555 | } | 537 | } |
556 | Monitor.Exit(m_updateLock); | 538 | finally |
539 | { | ||
540 | Monitor.Exit(m_updateLock); | ||
541 | } | ||
557 | } | 542 | } |
558 | 543 | ||
559 | protected internal void AddPhysicalPrim(int number) | 544 | protected internal void AddPhysicalPrim(int number) |
@@ -920,38 +905,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
920 | /// <returns>null if no scene object group containing that prim is found</returns> | 905 | /// <returns>null if no scene object group containing that prim is found</returns> |
921 | public SceneObjectGroup GetGroupByPrim(uint localID) | 906 | public SceneObjectGroup GetGroupByPrim(uint localID) |
922 | { | 907 | { |
923 | if (Entities.ContainsKey(localID)) | 908 | EntityBase entity; |
924 | return Entities[localID] as SceneObjectGroup; | 909 | if (Entities.TryGetValue(localID, out entity)) |
910 | return entity as SceneObjectGroup; | ||
925 | 911 | ||
926 | //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); | 912 | //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); |
927 | SceneObjectGroup sog; | 913 | SceneObjectGroup sog; |
928 | lock (SceneObjectGroupsByLocalID) | 914 | lock (SceneObjectGroupsByLocalID) |
915 | SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); | ||
916 | |||
917 | if (sog != null) | ||
929 | { | 918 | { |
930 | if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) | 919 | if (sog.HasChildPrim(localID)) |
931 | { | 920 | return sog; |
932 | if (sog.HasChildPrim(localID)) | 921 | SceneObjectGroupsByLocalID.Remove(localID); |
933 | return sog; | ||
934 | SceneObjectGroupsByLocalID.Remove(localID); | ||
935 | } | ||
936 | } | 922 | } |
937 | 923 | ||
938 | List<EntityBase> EntityList = GetEntities(); | 924 | EntityBase[] entityList = GetEntities(); |
939 | foreach (EntityBase ent in EntityList) | 925 | foreach (EntityBase ent in entityList) |
940 | { | 926 | { |
941 | //m_log.DebugFormat("Looking at entity {0}", ent.UUID); | 927 | //m_log.DebugFormat("Looking at entity {0}", ent.UUID); |
942 | if (ent is SceneObjectGroup) | 928 | if (ent is SceneObjectGroup) |
943 | { | 929 | { |
944 | if (((SceneObjectGroup)ent).HasChildPrim(localID)) | 930 | sog = (SceneObjectGroup)ent; |
931 | if (sog.HasChildPrim(localID)) | ||
945 | { | 932 | { |
946 | sog = (SceneObjectGroup)ent; | ||
947 | lock (SceneObjectGroupsByLocalID) | 933 | lock (SceneObjectGroupsByLocalID) |
948 | { | ||
949 | SceneObjectGroupsByLocalID[localID] = sog; | 934 | SceneObjectGroupsByLocalID[localID] = sog; |
950 | } | ||
951 | return sog; | 935 | return sog; |
952 | } | 936 | } |
953 | } | 937 | } |
954 | } | 938 | } |
939 | |||
955 | return null; | 940 | return null; |
956 | } | 941 | } |
957 | 942 | ||
@@ -964,36 +949,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
964 | { | 949 | { |
965 | SceneObjectGroup sog; | 950 | SceneObjectGroup sog; |
966 | lock (SceneObjectGroupsByFullID) | 951 | lock (SceneObjectGroupsByFullID) |
952 | SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); | ||
953 | |||
954 | if (sog != null) | ||
967 | { | 955 | { |
968 | if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) | 956 | lock (sog.Children) |
969 | { | 957 | { |
970 | lock (sog.Children) | 958 | if (sog.Children.ContainsKey(fullID)) |
971 | { | 959 | return sog; |
972 | if (sog.Children.ContainsKey(fullID)) | ||
973 | return sog; | ||
974 | } | ||
975 | |||
976 | SceneObjectGroupsByFullID.Remove(fullID); | ||
977 | } | 960 | } |
978 | } | ||
979 | 961 | ||
980 | List<EntityBase> EntityList = GetEntities(); | 962 | lock (SceneObjectGroupsByFullID) |
963 | SceneObjectGroupsByFullID.Remove(fullID); | ||
964 | } | ||
981 | 965 | ||
982 | foreach (EntityBase ent in EntityList) | 966 | EntityBase[] entityList = GetEntities(); |
967 | foreach (EntityBase ent in entityList) | ||
983 | { | 968 | { |
984 | if (ent is SceneObjectGroup) | 969 | if (ent is SceneObjectGroup) |
985 | { | 970 | { |
986 | if (((SceneObjectGroup)ent).HasChildPrim(fullID)) | 971 | sog = (SceneObjectGroup)ent; |
972 | if (sog.HasChildPrim(fullID)) | ||
987 | { | 973 | { |
988 | sog = (SceneObjectGroup)ent; | ||
989 | lock (SceneObjectGroupsByFullID) | 974 | lock (SceneObjectGroupsByFullID) |
990 | { | ||
991 | SceneObjectGroupsByFullID[fullID] = sog; | 975 | SceneObjectGroupsByFullID[fullID] = sog; |
992 | } | ||
993 | return sog; | 976 | return sog; |
994 | } | 977 | } |
995 | } | 978 | } |
996 | } | 979 | } |
980 | |||
997 | return null; | 981 | return null; |
998 | } | 982 | } |
999 | 983 | ||
@@ -1002,7 +986,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1002 | // Primitive Ray Tracing | 986 | // Primitive Ray Tracing |
1003 | float closestDistance = 280f; | 987 | float closestDistance = 280f; |
1004 | EntityIntersection result = new EntityIntersection(); | 988 | EntityIntersection result = new EntityIntersection(); |
1005 | List<EntityBase> EntityList = GetEntities(); | 989 | EntityBase[] EntityList = GetEntities(); |
1006 | foreach (EntityBase ent in EntityList) | 990 | foreach (EntityBase ent in EntityList) |
1007 | { | 991 | { |
1008 | if (ent is SceneObjectGroup) | 992 | if (ent is SceneObjectGroup) |
@@ -1040,23 +1024,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1040 | /// <returns>null if the part was not found</returns> | 1024 | /// <returns>null if the part was not found</returns> |
1041 | protected internal SceneObjectPart GetSceneObjectPart(string name) | 1025 | protected internal SceneObjectPart GetSceneObjectPart(string name) |
1042 | { | 1026 | { |
1043 | List<EntityBase> EntityList = GetEntities(); | 1027 | SceneObjectPart sop = null; |
1044 | 1028 | ||
1045 | // FIXME: use a dictionary here | 1029 | Entities.Find( |
1046 | foreach (EntityBase ent in EntityList) | 1030 | delegate(EntityBase entity) |
1047 | { | ||
1048 | if (ent is SceneObjectGroup) | ||
1049 | { | 1031 | { |
1050 | foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) | 1032 | if (entity is SceneObjectGroup) |
1051 | { | 1033 | { |
1052 | if (p.Name == name) | 1034 | foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts()) |
1053 | { | 1035 | { |
1054 | return p; | 1036 | if (p.Name == name) |
1037 | { | ||
1038 | sop = p; | ||
1039 | return true; | ||
1040 | } | ||
1055 | } | 1041 | } |
1056 | } | 1042 | } |
1043 | |||
1044 | return false; | ||
1057 | } | 1045 | } |
1058 | } | 1046 | ); |
1059 | return null; | 1047 | |
1048 | return sop; | ||
1060 | } | 1049 | } |
1061 | 1050 | ||
1062 | /// <summary> | 1051 | /// <summary> |
@@ -1077,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1077 | /// it | 1066 | /// it |
1078 | /// </summary> | 1067 | /// </summary> |
1079 | /// <returns></returns> | 1068 | /// <returns></returns> |
1080 | protected internal List<EntityBase> GetEntities() | 1069 | protected internal EntityBase[] GetEntities() |
1081 | { | 1070 | { |
1082 | return Entities.GetEntities(); | 1071 | return Entities.GetEntities(); |
1083 | } | 1072 | } |
@@ -1086,7 +1075,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1086 | { | 1075 | { |
1087 | Dictionary<uint, float> topScripts = new Dictionary<uint, float>(); | 1076 | Dictionary<uint, float> topScripts = new Dictionary<uint, float>(); |
1088 | 1077 | ||
1089 | List<EntityBase> EntityList = GetEntities(); | 1078 | EntityBase[] EntityList = GetEntities(); |
1090 | int limit = 0; | 1079 | int limit = 0; |
1091 | foreach (EntityBase ent in EntityList) | 1080 | foreach (EntityBase ent in EntityList) |
1092 | { | 1081 | { |
@@ -1140,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1140 | /// <param name="action"></param> | 1129 | /// <param name="action"></param> |
1141 | protected internal void ForEachSOG(Action<SceneObjectGroup> action) | 1130 | protected internal void ForEachSOG(Action<SceneObjectGroup> action) |
1142 | { | 1131 | { |
1143 | List<EntityBase> objlist = Entities.GetAllByType<SceneObjectGroup>(); | 1132 | EntityBase[] objlist = Entities.GetAllByType<SceneObjectGroup>(); |
1144 | foreach (EntityBase ent in objlist) | 1133 | foreach (EntityBase ent in objlist) |
1145 | { | 1134 | { |
1146 | SceneObjectGroup obj = (SceneObjectGroup)ent; | 1135 | SceneObjectGroup obj = (SceneObjectGroup)ent; |
@@ -1353,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1353 | SceneObjectGroup group = GetGroupByPrim(localID); | 1342 | SceneObjectGroup group = GetGroupByPrim(localID); |
1354 | 1343 | ||
1355 | if (group != null) | 1344 | if (group != null) |
1356 | { | 1345 | { |
1357 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) | 1346 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) |
1358 | { | 1347 | { |
1359 | if (m_parentScene.AttachmentsModule != null) | 1348 | if (m_parentScene.AttachmentsModule != null) |
@@ -1798,8 +1787,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1798 | UUID objid = UUID.Zero; | 1787 | UUID objid = UUID.Zero; |
1799 | SceneObjectPart obj = null; | 1788 | SceneObjectPart obj = null; |
1800 | 1789 | ||
1801 | List<EntityBase> EntityList = GetEntities(); | 1790 | EntityBase[] entityList = GetEntities(); |
1802 | foreach (EntityBase ent in EntityList) | 1791 | foreach (EntityBase ent in entityList) |
1803 | { | 1792 | { |
1804 | if (ent is SceneObjectGroup) | 1793 | if (ent is SceneObjectGroup) |
1805 | { | 1794 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 470fdd7..a952508 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1326,7 +1326,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1326 | AbsolutePosition = detachedpos; | 1326 | AbsolutePosition = detachedpos; |
1327 | m_rootPart.AttachedAvatar = UUID.Zero; | 1327 | m_rootPart.AttachedAvatar = UUID.Zero; |
1328 | 1328 | ||
1329 | //Anakin Lohner bug #3839 | 1329 | //Anakin Lohner bug #3839 |
1330 | lock (m_parts) | 1330 | lock (m_parts) |
1331 | { | 1331 | { |
1332 | foreach (SceneObjectPart p in m_parts.Values) | 1332 | foreach (SceneObjectPart p in m_parts.Values) |
@@ -1556,7 +1556,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1556 | } | 1556 | } |
1557 | 1557 | ||
1558 | /// <summary> | 1558 | /// <summary> |
1559 | /// Delete this group from its scene. | 1559 | /// Delete this group from its scene. |
1560 | /// </summary> | 1560 | /// </summary> |
1561 | /// | 1561 | /// |
1562 | /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood | 1562 | /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood |
@@ -1731,12 +1731,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1731 | /// Processes backup. | 1731 | /// Processes backup. |
1732 | /// </summary> | 1732 | /// </summary> |
1733 | /// <param name="datastore"></param> | 1733 | /// <param name="datastore"></param> |
1734 | public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) | 1734 | public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup) |
1735 | { | 1735 | { |
1736 | if (!m_isBackedUp) | 1736 | if (!m_isBackedUp) |
1737 | { | 1737 | { |
1738 | // m_log.DebugFormat( | 1738 | // m_log.DebugFormat( |
1739 | // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); | 1739 | // "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); |
1740 | return; | 1740 | return; |
1741 | } | 1741 | } |
1742 | 1742 | ||
@@ -1748,7 +1748,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1748 | } | 1748 | } |
1749 | 1749 | ||
1750 | // Since this is the top of the section of call stack for backing up a particular scene object, don't let | 1750 | // Since this is the top of the section of call stack for backing up a particular scene object, don't let |
1751 | // any exception propogate upwards. | 1751 | // any exception propogate upwards. |
1752 | try | 1752 | try |
1753 | { | 1753 | { |
1754 | if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart | 1754 | if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart |
@@ -1944,7 +1944,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1944 | part.PhysActor.LocalID = part.LocalId; | 1944 | part.PhysActor.LocalID = part.LocalId; |
1945 | part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); | 1945 | part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); |
1946 | } | 1946 | } |
1947 | |||
1948 | } | 1947 | } |
1949 | if (userExposed) | 1948 | if (userExposed) |
1950 | { | 1949 | { |
@@ -1954,7 +1953,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1954 | 1953 | ||
1955 | ScheduleGroupForFullUpdate(); | 1954 | ScheduleGroupForFullUpdate(); |
1956 | } | 1955 | } |
1957 | |||
1958 | } | 1956 | } |
1959 | finally | 1957 | finally |
1960 | { | 1958 | { |
@@ -2515,16 +2513,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2515 | /// <returns>null if a child part with the primID was not found</returns> | 2513 | /// <returns>null if a child part with the primID was not found</returns> |
2516 | public SceneObjectPart GetChildPart(UUID primID) | 2514 | public SceneObjectPart GetChildPart(UUID primID) |
2517 | { | 2515 | { |
2518 | SceneObjectPart childPart = null; | 2516 | SceneObjectPart childPart; |
2519 | |||
2520 | lock (m_parts) | 2517 | lock (m_parts) |
2521 | { | 2518 | m_parts.TryGetValue(primID, out childPart); |
2522 | if (m_parts.ContainsKey(primID)) | ||
2523 | { | ||
2524 | childPart = m_parts[primID]; | ||
2525 | } | ||
2526 | } | ||
2527 | |||
2528 | return childPart; | 2519 | return childPart; |
2529 | } | 2520 | } |
2530 | 2521 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index eefe8bb..5c4a2a3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -508,7 +508,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
508 | public UUID UUID | 508 | public UUID UUID |
509 | { | 509 | { |
510 | get { return m_uuid; } | 510 | get { return m_uuid; } |
511 | set { m_uuid = value; } | 511 | set |
512 | { | ||
513 | m_uuid = value; | ||
514 | |||
515 | // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part | ||
516 | if (Inventory != null) | ||
517 | Inventory.ResetInventoryIDs(); | ||
518 | } | ||
512 | } | 519 | } |
513 | 520 | ||
514 | public uint LocalId | 521 | public uint LocalId |
@@ -1027,12 +1034,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1027 | return m_mediaUrl; | 1034 | return m_mediaUrl; |
1028 | } | 1035 | } |
1029 | 1036 | ||
1030 | set | 1037 | set |
1031 | { | 1038 | { |
1032 | m_mediaUrl = value; | 1039 | m_mediaUrl = value; |
1033 | 1040 | ||
1034 | if (ParentGroup != null) | 1041 | if (ParentGroup != null) |
1035 | ParentGroup.HasGroupChanged = true; | 1042 | ParentGroup.HasGroupChanged = true; |
1036 | } | 1043 | } |
1037 | } | 1044 | } |
1038 | 1045 | ||
@@ -1045,7 +1052,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1045 | // m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID); | 1052 | // m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID); |
1046 | m_createSelected = value; | 1053 | m_createSelected = value; |
1047 | } | 1054 | } |
1048 | } | 1055 | } |
1049 | 1056 | ||
1050 | #endregion | 1057 | #endregion |
1051 | 1058 | ||
@@ -1207,7 +1214,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1207 | 1214 | ||
1208 | /// <summary> | 1215 | /// <summary> |
1209 | /// Property flags. See OpenMetaverse.PrimFlags | 1216 | /// Property flags. See OpenMetaverse.PrimFlags |
1210 | /// </summary> | 1217 | /// </summary> |
1211 | /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge | 1218 | /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge |
1212 | public PrimFlags Flags | 1219 | public PrimFlags Flags |
1213 | { | 1220 | { |
@@ -1372,7 +1379,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1372 | 1379 | ||
1373 | /// <summary> | 1380 | /// <summary> |
1374 | /// Tell the scene presence that it should send updates for this part to its client | 1381 | /// Tell the scene presence that it should send updates for this part to its client |
1375 | /// </summary> | 1382 | /// </summary> |
1376 | public void AddFullUpdateToAvatar(ScenePresence presence) | 1383 | public void AddFullUpdateToAvatar(ScenePresence presence) |
1377 | { | 1384 | { |
1378 | presence.SceneViewer.QueuePartForUpdate(this); | 1385 | presence.SceneViewer.QueuePartForUpdate(this); |
@@ -1431,7 +1438,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1431 | 1438 | ||
1432 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) | 1439 | m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) |
1433 | { | 1440 | { |
1434 | if(!sp.IsChildAgent) | 1441 | if (!sp.IsChildAgent) |
1435 | sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); | 1442 | sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); |
1436 | }); | 1443 | }); |
1437 | } | 1444 | } |
@@ -1683,7 +1690,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1683 | 1690 | ||
1684 | // m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); | 1691 | // m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); |
1685 | 1692 | ||
1686 | return dupe; | 1693 | return dupe; |
1687 | } | 1694 | } |
1688 | 1695 | ||
1689 | protected void AssetReceived(string id, Object sender, AssetBase asset) | 1696 | protected void AssetReceived(string id, Object sender, AssetBase asset) |
@@ -1993,10 +2000,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1993 | } | 2000 | } |
1994 | 2001 | ||
1995 | public uint GetEffectiveObjectFlags() | 2002 | public uint GetEffectiveObjectFlags() |
1996 | { | 2003 | { |
1997 | // Commenting this section of code out since it doesn't actually do anything, as enums are handled by | 2004 | // Commenting this section of code out since it doesn't actually do anything, as enums are handled by |
1998 | // value rather than reference | 2005 | // value rather than reference |
1999 | // PrimFlags f = _flags; | 2006 | // PrimFlags f = _flags; |
2000 | // if (m_parentGroup == null || m_parentGroup.RootPart == this) | 2007 | // if (m_parentGroup == null || m_parentGroup.RootPart == this) |
2001 | // f &= ~(PrimFlags.Touch | PrimFlags.Money); | 2008 | // f &= ~(PrimFlags.Touch | PrimFlags.Money); |
2002 | 2009 | ||
@@ -2793,7 +2800,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2793 | UUID = UUID.Random(); | 2800 | UUID = UUID.Random(); |
2794 | LinkNum = linkNum; | 2801 | LinkNum = linkNum; |
2795 | LocalId = 0; | 2802 | LocalId = 0; |
2796 | Inventory.ResetInventoryIDs(); | ||
2797 | } | 2803 | } |
2798 | 2804 | ||
2799 | /// <summary> | 2805 | /// <summary> |
@@ -4756,7 +4762,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4756 | if (ParentGroup == null || ParentGroup.IsDeleted) | 4762 | if (ParentGroup == null || ParentGroup.IsDeleted) |
4757 | return; | 4763 | return; |
4758 | 4764 | ||
4759 | if (IsAttachment && ParentGroup.RootPart != this) | 4765 | if (IsAttachment && ParentGroup.RootPart != this) |
4760 | return; | 4766 | return; |
4761 | 4767 | ||
4762 | // Causes this thread to dig into the Client Thread Data. | 4768 | // Causes this thread to dig into the Client Thread Data. |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 1959427..2de439b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
125 | { | 125 | { |
126 | m_items.LockItemsForWrite(true); | 126 | m_items.LockItemsForWrite(true); |
127 | 127 | ||
128 | if (0 == Items.Count) | 128 | if (Items.Count == 0) |
129 | { | 129 | { |
130 | m_items.LockItemsForWrite(false); | 130 | m_items.LockItemsForWrite(false); |
131 | return; | 131 | return; |
@@ -1010,7 +1010,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1010 | /// Process inventory backup | 1010 | /// Process inventory backup |
1011 | /// </summary> | 1011 | /// </summary> |
1012 | /// <param name="datastore"></param> | 1012 | /// <param name="datastore"></param> |
1013 | public void ProcessInventoryBackup(IRegionDataStore datastore) | 1013 | public void ProcessInventoryBackup(ISimulationDataService datastore) |
1014 | { | 1014 | { |
1015 | if (HasInventoryChanged) | 1015 | if (HasInventoryChanged) |
1016 | { | 1016 | { |
@@ -1257,7 +1257,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1257 | engine.ResumeScript(item.ItemID); | 1257 | engine.ResumeScript(item.ItemID); |
1258 | } | 1258 | } |
1259 | } | 1259 | } |
1260 | } | 1260 | } |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | Items.LockItemsForRead(false); | 1263 | Items.LockItemsForRead(false); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d88f2cc..6d0ecf0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1427,7 +1427,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1427 | // Setting parent ID would fix this, if we knew what value | 1427 | // Setting parent ID would fix this, if we knew what value |
1428 | // to use. Or we could add a m_isSitting variable. | 1428 | // to use. Or we could add a m_isSitting variable. |
1429 | //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | 1429 | //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); |
1430 | SitGround = true; | 1430 | SitGround = true; |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | // In the future, these values might need to go global. | 1433 | // In the future, these values might need to go global. |
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs index f478a4a..b45291f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs +++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs | |||
@@ -73,9 +73,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
73 | { | 73 | { |
74 | m_pendingObjects = new Queue<SceneObjectGroup>(); | 74 | m_pendingObjects = new Queue<SceneObjectGroup>(); |
75 | 75 | ||
76 | lock(m_pendingObjects) | 76 | lock (m_pendingObjects) |
77 | { | 77 | { |
78 | foreach (EntityBase e in m_presence.Scene.Entities) | 78 | EntityBase[] entities = m_presence.Scene.Entities.GetEntities(); |
79 | foreach (EntityBase e in entities) | ||
79 | { | 80 | { |
80 | if (e != null && e is SceneObjectGroup) | 81 | if (e != null && e is SceneObjectGroup) |
81 | m_pendingObjects.Enqueue((SceneObjectGroup)e); | 82 | m_pendingObjects.Enqueue((SceneObjectGroup)e); |
@@ -84,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
84 | } | 85 | } |
85 | } | 86 | } |
86 | 87 | ||
87 | lock(m_pendingObjects) | 88 | lock (m_pendingObjects) |
88 | { | 89 | { |
89 | while (m_pendingObjects != null && m_pendingObjects.Count > 0) | 90 | while (m_pendingObjects != null && m_pendingObjects.Count > 0) |
90 | { | 91 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index b6677f0..5494549 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | |||
@@ -84,9 +84,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
84 | int primCount = 0; | 84 | int primCount = 0; |
85 | stream.WriteLine("<scene>\n"); | 85 | stream.WriteLine("<scene>\n"); |
86 | 86 | ||
87 | List<EntityBase> EntityList = scene.GetEntities(); | 87 | EntityBase[] entityList = scene.GetEntities(); |
88 | 88 | foreach (EntityBase ent in entityList) | |
89 | foreach (EntityBase ent in EntityList) | ||
90 | { | 89 | { |
91 | if (ent is SceneObjectGroup) | 90 | if (ent is SceneObjectGroup) |
92 | { | 91 | { |
@@ -204,16 +203,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
204 | 203 | ||
205 | public static void SavePrimsToXml2(Scene scene, string fileName) | 204 | public static void SavePrimsToXml2(Scene scene, string fileName) |
206 | { | 205 | { |
207 | List<EntityBase> EntityList = scene.GetEntities(); | 206 | EntityBase[] entityList = scene.GetEntities(); |
208 | 207 | SavePrimListToXml2(entityList, fileName); | |
209 | SavePrimListToXml2(EntityList, fileName); | ||
210 | } | 208 | } |
211 | 209 | ||
212 | public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) | 210 | public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) |
213 | { | 211 | { |
214 | List<EntityBase> EntityList = scene.GetEntities(); | 212 | EntityBase[] entityList = scene.GetEntities(); |
215 | 213 | SavePrimListToXml2(entityList, stream, min, max); | |
216 | SavePrimListToXml2(EntityList, stream, min, max); | ||
217 | } | 214 | } |
218 | 215 | ||
219 | public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) | 216 | public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) |
@@ -222,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
222 | "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", | 219 | "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", |
223 | primName, scene.RegionInfo.RegionName, fileName); | 220 | primName, scene.RegionInfo.RegionName, fileName); |
224 | 221 | ||
225 | List<EntityBase> entityList = scene.GetEntities(); | 222 | EntityBase[] entityList = scene.GetEntities(); |
226 | List<EntityBase> primList = new List<EntityBase>(); | 223 | List<EntityBase> primList = new List<EntityBase>(); |
227 | 224 | ||
228 | foreach (EntityBase ent in entityList) | 225 | foreach (EntityBase ent in entityList) |
@@ -236,10 +233,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
236 | } | 233 | } |
237 | } | 234 | } |
238 | 235 | ||
239 | SavePrimListToXml2(primList, fileName); | 236 | SavePrimListToXml2(primList.ToArray(), fileName); |
240 | } | 237 | } |
241 | 238 | ||
242 | public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName) | 239 | public static void SavePrimListToXml2(EntityBase[] entityList, string fileName) |
243 | { | 240 | { |
244 | FileStream file = new FileStream(fileName, FileMode.Create); | 241 | FileStream file = new FileStream(fileName, FileMode.Create); |
245 | try | 242 | try |
@@ -260,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
260 | } | 257 | } |
261 | } | 258 | } |
262 | 259 | ||
263 | public static void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max) | 260 | public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) |
264 | { | 261 | { |
265 | int primCount = 0; | 262 | int primCount = 0; |
266 | stream.WriteLine("<scene>\n"); | 263 | stream.WriteLine("<scene>\n"); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index c9662ef..7d9a6a9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | |||
@@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
71 | Assert.That(dupeSo.Children.Count, Is.EqualTo(2)); | 71 | Assert.That(dupeSo.Children.Count, Is.EqualTo(2)); |
72 | 72 | ||
73 | SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1); | 73 | SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1); |
74 | SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); | 74 | SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); |
75 | Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId)); | 75 | Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId)); |
76 | Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId)); | 76 | Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId)); |
77 | 77 | ||
@@ -84,6 +84,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
84 | Assert.That(dupePart1.PhysActor, Is.Not.Null); | 84 | Assert.That(dupePart1.PhysActor, Is.Not.Null); |
85 | Assert.That(dupePart2.PhysActor, Is.Not.Null); | 85 | Assert.That(dupePart2.PhysActor, Is.Not.Null); |
86 | */ | 86 | */ |
87 | } | 87 | } |
88 | } | 88 | } |
89 | } \ No newline at end of file | 89 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index e3ef263..60824be 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -270,7 +270,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
270 | TestHelper.InMethod(); | 270 | TestHelper.InMethod(); |
271 | //log4net.Config.XmlConfigurator.Configure(); | 271 | //log4net.Config.XmlConfigurator.Configure(); |
272 | 272 | ||
273 | TestScene scene = SceneSetupHelpers.SetupScene(); | 273 | TestScene scene = SceneSetupHelpers.SetupScene(); |
274 | 274 | ||
275 | string rootPartName = "rootpart"; | 275 | string rootPartName = "rootpart"; |
276 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 276 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
@@ -282,17 +282,17 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
282 | { Name = rootPartName, UUID = rootPartUuid }; | 282 | { Name = rootPartName, UUID = rootPartUuid }; |
283 | SceneObjectPart linkPart | 283 | SceneObjectPart linkPart |
284 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 284 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
285 | { Name = linkPartName, UUID = linkPartUuid }; | 285 | { Name = linkPartName, UUID = linkPartUuid }; |
286 | 286 | ||
287 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); | 287 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); |
288 | sog.AddPart(linkPart); | 288 | sog.AddPart(linkPart); |
289 | scene.AddNewSceneObject(sog, true); | 289 | scene.AddNewSceneObject(sog, true); |
290 | 290 | ||
291 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked | 291 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked |
292 | // scene backup thread. | 292 | // scene backup thread. |
293 | scene.Backup(true); | 293 | scene.Backup(true); |
294 | 294 | ||
295 | List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); | 295 | List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); |
296 | 296 | ||
297 | Assert.That(storedObjects.Count, Is.EqualTo(1)); | 297 | Assert.That(storedObjects.Count, Is.EqualTo(1)); |
298 | Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2)); | 298 | Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2)); |
@@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
309 | TestHelper.InMethod(); | 309 | TestHelper.InMethod(); |
310 | //log4net.Config.XmlConfigurator.Configure(); | 310 | //log4net.Config.XmlConfigurator.Configure(); |
311 | 311 | ||
312 | TestScene scene = SceneSetupHelpers.SetupScene(); | 312 | TestScene scene = SceneSetupHelpers.SetupScene(); |
313 | 313 | ||
314 | string rootPartName = "rootpart"; | 314 | string rootPartName = "rootpart"; |
315 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); | 315 | UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); |
@@ -321,11 +321,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
321 | { Name = rootPartName, UUID = rootPartUuid }; | 321 | { Name = rootPartName, UUID = rootPartUuid }; |
322 | SceneObjectPart linkPart | 322 | SceneObjectPart linkPart |
323 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 323 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
324 | { Name = linkPartName, UUID = linkPartUuid }; | 324 | { Name = linkPartName, UUID = linkPartUuid }; |
325 | 325 | ||
326 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); | 326 | SceneObjectGroup sog = new SceneObjectGroup(rootPart); |
327 | sog.AddPart(linkPart); | 327 | sog.AddPart(linkPart); |
328 | scene.AddNewSceneObject(sog, true); | 328 | scene.AddNewSceneObject(sog, true); |
329 | 329 | ||
330 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked | 330 | // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked |
331 | // scene backup thread. | 331 | // scene backup thread. |
@@ -333,9 +333,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
333 | 333 | ||
334 | // These changes should occur immediately without waiting for a backup pass | 334 | // These changes should occur immediately without waiting for a backup pass |
335 | SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); | 335 | SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); |
336 | scene.DeleteSceneObject(groupToDelete, false); | 336 | scene.DeleteSceneObject(groupToDelete, false); |
337 | 337 | ||
338 | List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); | 338 | List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); |
339 | 339 | ||
340 | Assert.That(storedObjects.Count, Is.EqualTo(1)); | 340 | Assert.That(storedObjects.Count, Is.EqualTo(1)); |
341 | Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1)); | 341 | Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1)); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index da8199d..fe59d4f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -59,8 +59,8 @@ namespace OpenSim.Region.Framework.Tests | |||
59 | string userFirstName = "Jock"; | 59 | string userFirstName = "Jock"; |
60 | string userLastName = "Stirrup"; | 60 | string userLastName = "Stirrup"; |
61 | string userPassword = "troll"; | 61 | string userPassword = "troll"; |
62 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 62 | UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
63 | return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); | 63 | return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); |
64 | } | 64 | } |
65 | 65 | ||
66 | protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId) | 66 | protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId) |
@@ -70,14 +70,16 @@ namespace OpenSim.Region.Framework.Tests | |||
70 | SceneObjectPart part1 | 70 | SceneObjectPart part1 |
71 | = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) | 71 | = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) |
72 | { Name = part1Name, UUID = part1Id }; | 72 | { Name = part1Name, UUID = part1Id }; |
73 | return new SceneObjectGroup(part1); | 73 | return new SceneObjectGroup(part1); |
74 | } | 74 | } |
75 | 75 | ||
76 | protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) | 76 | protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) |
77 | { | 77 | { |
78 | AssetNotecard nc = new AssetNotecard("Hello World!"); | 78 | AssetNotecard nc = new AssetNotecard(); |
79 | nc.BodyText = "Hello World!"; | ||
80 | nc.Encode(); | ||
79 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | 81 | UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); |
80 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | 82 | UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); |
81 | AssetBase ncAsset | 83 | AssetBase ncAsset |
82 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); | 84 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); |
83 | scene.AssetService.Store(ncAsset); | 85 | scene.AssetService.Store(ncAsset); |
@@ -112,9 +114,9 @@ namespace OpenSim.Region.Framework.Tests | |||
112 | scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); | 114 | scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); |
113 | 115 | ||
114 | InventoryItemBase ncUserItem | 116 | InventoryItemBase ncUserItem |
115 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); | 117 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); |
116 | Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found"); | 118 | Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found"); |
117 | } | 119 | } |
118 | 120 | ||
119 | /// <summary> | 121 | /// <summary> |
120 | /// Test MoveTaskInventoryItem where the item has no parent folder assigned. | 122 | /// Test MoveTaskInventoryItem where the item has no parent folder assigned. |
@@ -136,7 +138,7 @@ namespace OpenSim.Region.Framework.Tests | |||
136 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); | 138 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); |
137 | 139 | ||
138 | InventoryItemBase ncUserItem | 140 | InventoryItemBase ncUserItem |
139 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); | 141 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); |
140 | Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found"); | 142 | Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found"); |
141 | } | 143 | } |
142 | } | 144 | } |
diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs deleted file mode 100644 index 9375b4a..0000000 --- a/OpenSim/Region/Framework/StorageManager.cs +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
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 OpenSimulator 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 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
31 | using OpenSim.Region.Framework.Interfaces; | ||
32 | |||
33 | namespace OpenSim.Region.Framework | ||
34 | { | ||
35 | public class StorageManager | ||
36 | { | ||
37 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
38 | |||
39 | protected IRegionDataStore m_dataStore; | ||
40 | |||
41 | public IRegionDataStore DataStore | ||
42 | { | ||
43 | get { return m_dataStore; } | ||
44 | } | ||
45 | |||
46 | private IEstateDataStore m_estateDataStore; | ||
47 | |||
48 | public IEstateDataStore EstateDataStore | ||
49 | { | ||
50 | get { return m_estateDataStore; } | ||
51 | } | ||
52 | |||
53 | public StorageManager(IRegionDataStore storage) | ||
54 | { | ||
55 | m_dataStore = storage; | ||
56 | } | ||
57 | |||
58 | public StorageManager(string dllName, string connectionstring, string estateconnectionstring) | ||
59 | { | ||
60 | m_log.Info("[DATASTORE]: Attempting to load " + dllName); | ||
61 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
62 | |||
63 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
64 | { | ||
65 | if (pluginType.IsPublic) | ||
66 | { | ||
67 | Type typeInterface = pluginType.GetInterface("IRegionDataStore", true); | ||
68 | |||
69 | if (typeInterface != null) | ||
70 | { | ||
71 | IRegionDataStore plug = | ||
72 | (IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
73 | plug.Initialise(connectionstring); | ||
74 | |||
75 | m_dataStore = plug; | ||
76 | |||
77 | m_log.Info("[DATASTORE]: Added IRegionDataStore Interface"); | ||
78 | } | ||
79 | |||
80 | typeInterface = pluginType.GetInterface("IEstateDataStore", true); | ||
81 | |||
82 | if (typeInterface != null) | ||
83 | { | ||
84 | IEstateDataStore estPlug = | ||
85 | (IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
86 | estPlug.Initialise(estateconnectionstring); | ||
87 | |||
88 | m_estateDataStore = estPlug; | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | |||
93 | //TODO: Add checking and warning to make sure it initialised. | ||
94 | } | ||
95 | } | ||
96 | } | ||